Package org.apache.cxf.headers

Examples of org.apache.cxf.headers.Header


       
        message.setContent(Node.class, headerInfo[0]);
       
        Node node = ((Element) headerInfo[1]).getChildNodes().item(0);
       
        message.getHeaders().add(new Header(new QName(node.getNamespaceURI(), node.getLocalName()), node));
       
        control.replay();

        SOAPHandlerInterceptor li = new SOAPHandlerInterceptor(binding);
        li.handleMessage(message);
        control.verify();

        // Verify SOAPMessage header
        SOAPMessage soapMessageNew = message.getContent(SOAPMessage.class);      

        Element headerElementNew = DOMUtils.getFirstElement(soapMessageNew.getSOAPHeader());
       
        SoapVersion soapVersion = Soap11.getInstance();
        assertEquals("false", headerElementNew.getAttributeNS(soapVersion.getNamespace(), "mustUnderstand"));

        // Verify XMLStreamReader
        XMLStreamReader xmlReader = message.getContent(XMLStreamReader.class);
        QName qn = xmlReader.getName();
        assertEquals("sendReceiveData", qn.getLocalPart());
       
        // Verify Header Element
        Iterator<Header> iter = message.getHeaders().iterator();
        Element requiredHeader = null;
        while (iter.hasNext()) {
            Header localHdr = iter.next();
            if (localHdr.getObject() instanceof Element) {
                Element elem = (Element) localHdr.getObject();
                if (elem.getNamespaceURI().equals("http://apache.org/hello_world_rpclit/types")
                        && elem.getLocalName().equals("header1")) {
                    requiredHeader = (Element) localHdr.getObject();
                    break;               
                }
            }
        }
       
View Full Code Here


            String act = elem.getAttributeNS(message.getVersion().getNamespace(),
                    message.getVersion().getAttrNameRole());
               
            shead.setActor(act);
            shead.setMustUnderstand(Boolean.valueOf(mu) || "1".equals(mu));
            Header oldHdr = message.getHeader(
                    new QName(elem.getNamespaceURI(), elem.getLocalName()));
            if (oldHdr != null) {
                message.getHeaders().remove(oldHdr);
            }
            message.getHeaders().add(shead);                       
View Full Code Here

                encodeReferenceParameters(maps, hdr, marshaller);
               
                Node childNode = hdr.getFirstChild();
               
                while (childNode != null) {
                    Header holder = new Header(
                                               new QName(childNode.getNamespaceURI(),
                                                         childNode.getLocalName()),
                                                         childNode);
                    header.add(holder);
                    childNode = childNode.getNextSibling();
View Full Code Here

                Unmarshaller unmarshaller = null;
                Set<Element> referenceParameterHeaders = null;

                Iterator<Header> iter = header.iterator();
                while (iter.hasNext()) {
                    Header hdr = iter.next();
                    if (hdr.getObject() instanceof Element) {
                        Element headerElement = (Element)hdr.getObject();
                        String headerURI = headerElement.getNamespaceURI();
                        // Need to check the uri before getting unmarshaller else
                        // would get wrong unmarshaller and fail to process required
                        // headers.
                        if (transformer.isSupported(headerURI)) {
View Full Code Here

     * @param maps the current MAPs
     */
    private void discardMAPs(List<Header> header, AddressingProperties maps) {
        Iterator<Header> iter = header.iterator();
        while (iter.hasNext()) {
            Header hdr = iter.next();
            if (Names.WSA_NAMESPACE_NAME.equals(hdr.getName().getNamespaceURI())) {
                iter.remove();
            }
        }
    }
View Full Code Here

                if (node != null && MessageUtils.isPartialResponse(message)) {
                    // make sure the response is returned as HTTP 200 and not 202
                    message.put(Message.RESPONSE_CODE, HttpURLConnection.HTTP_OK);
                }
                while (node != null) {
                    Header holder = null;
                    if (node.getLocalName().equals("Sequence")) {
                        holder = new SoapHeader(new QName(node.getNamespaceURI(), node.getLocalName()), node);
                        ((SoapHeader)holder).setMustUnderstand(true);
                    } else {
                        holder = new Header(new QName(node.getNamespaceURI(), node.getLocalName()), node);
                    }
                    message.getHeaders().add(holder);
                    node = node.getNextSibling();
                }
            }
View Full Code Here

                    "xmlns:" + RMConstants.NAMESPACE_PREFIX);
                attr.setValue(rmps.getNamespaceURI());
                ((Element)node).setAttributeNodeNS(attr);
            }
            List<Header> headers = message.getHeaders();
            headers.add(new Header(new QName(node.getNamespaceURI(), node.getLocalName()), node));
        } catch (JAXBException je) {
            LOG.log(Level.WARNING, "SOAP_HEADER_ENCODE_FAILURE_MSG", je);
        }       
    }
View Full Code Here

        if (oobHdr != null & oobHdr instanceof List) {
            Iterator iter = oobHdr.iterator();
            while (iter.hasNext()) {
                Object hdr = iter.next();
                if (hdr instanceof Header) {
                    Header hdr1 = (Header)hdr;
                    if (hdr1.getObject() instanceof Node) {
                        try {
                            JAXBElement job = (JAXBElement)JAXBContext
                                .newInstance(org.apache.cxf.outofband.header.ObjectFactory.class)
                                .createUnmarshaller().unmarshal((Node)hdr1.getObject());
                            hdrToTest = (OutofBandHeader)job.getValue();
                        } catch (JAXBException ex) {
                            ex.printStackTrace();
                        }
                    }
View Full Code Here

        if (oobHdr != null & oobHdr instanceof List) {
            Iterator iter = oobHdr.iterator();
            while (iter.hasNext()) {
                Object hdr = iter.next();
                if (hdr instanceof Header) {
                    Header hdr1 = (Header)hdr;
                    if (hdr1.getObject() instanceof Node) {
                        try {
                            JAXBElement job = (JAXBElement)JAXBContext
                                .newInstance(org.apache.cxf.outofband.header.ObjectFactory.class)
                                .createUnmarshaller().unmarshal((Node)hdr1.getObject());
                            hdrToTest.add((OutofBandHeader)job.getValue());
                        } catch (JAXBException ex) {
                            ex.printStackTrace();
                        }
                    }
View Full Code Here

                encodeReferenceParameters(maps, hdr, marshaller);
               
                Node childNode = hdr.getFirstChild();
               
                while (childNode != null) {
                    Header holder = new Header(
                                               new QName(childNode.getNamespaceURI(),
                                                         childNode.getLocalName()),
                                                         childNode);
                    header.add(holder);
                    childNode = childNode.getNextSibling();
View Full Code Here

TOP

Related Classes of org.apache.cxf.headers.Header

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.