Package org.apache.cxf.binding.soap

Examples of org.apache.cxf.binding.soap.SoapHeader


            } else {
                obj = p.getDataBinding().createReader(Node.class).read(elem);
            }
            //TODO - add the interceptors
               
            SoapHeader shead = new SoapHeader(new QName(elem.getNamespaceURI(),
                                                        elem.getLocalName()),
                                               obj,
                                               dataBinding);
            shead.setDirection(SoapHeader.Direction.DIRECTION_IN);
               
            String mu = elem.getAttributeNS(message.getVersion().getNamespace(),
                    message.getVersion().getAttrNameMustUnderstand());
            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);
            }
View Full Code Here


            return null;
        }
        Document doc = DOMUtils.createDocument();
        Element el = doc.createElementNS(WSConstants.WSSE_NS, "wsse:Security");
        el.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsse", WSConstants.WSSE_NS);
        SoapHeader sh = new SoapHeader(new QName(WSConstants.WSSE_NS, "Security"), el);
        sh.setMustUnderstand(true);
        message.getHeaders().add(sh);
        return sh;
    }
View Full Code Here

                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);
                }
                headers.add(holder);
View Full Code Here

            return null;
        }
        Document doc = DOMUtils.createDocument();
        Element el = doc.createElementNS(WSConstants.WSSE_NS, "wsse:Security");
        el.setAttributeNS(WSConstants.XMLNS_NS, "xmlns:wsse", WSConstants.WSSE_NS);
        SoapHeader sh = new SoapHeader(new QName(WSConstants.WSSE_NS, "Security"), el);
        sh.setMustUnderstand(true);
        message.getHeaders().add(sh);
        return sh;
    }
View Full Code Here

                    LOG.trace("Skipped header: " + header + " since it is not a SoapHeader");
                }
                continue;
            }
           
            SoapHeader soapHeader = SoapHeader.class.cast(header);
            for (Iterator<SoapVersion> itv = SoapVersionFactory.getInstance().getVersions(); itv.hasNext();) {
                SoapVersion version = itv.next();

                if (soapHeader.getActor() != null
                    && soapHeader.getActor().equals(version.getNextRole())) {
                    // dropping headers if actor/role equals to {ns}/role|actor/next
                    // cxf SoapHeader needs to have soap:header@relay attribute,
                    // then we can check for it here as well
                    if (LOG.isTraceEnabled()) {
                        LOG.trace("Filtered header: " + header);
View Full Code Here

        OutofBandHeader ob = new OutofBandHeader();
        ob.setName("testOobHeader");
        ob.setValue("testOobHeaderValue");
        ob.setHdrAttribute(invalid ? "dontProcess" : "testHdrAttribute");

        SoapHeader hdr = new SoapHeader(
                new QName(Constants.TEST_HDR_NS, Constants.TEST_HDR_REQUEST_ELEM),
                ob,
                new JAXBDataBinding(ob.getClass()));
        hdr.setMustUnderstand(true);

        List<Header> headers = new ArrayList<Header>();
        headers.add(hdr);
        return headers;
    }
View Full Code Here

            String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><outofbandHeader "
                + "xmlns=\"http://cxf.apache.org/outofband/Header\" hdrAttribute=\"testHdrAttribute\" "
                + "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" soap:mustUnderstand=\"1\">"
                + "<name>New_testOobHeader</name><value>New_testOobHeaderValue</value></outofbandHeader>";
           
            SoapHeader newHeader = new SoapHeader(soapHeaders.get(0).getName(),
                                                  DOMUtils.readXml(new StringReader(xml)).getDocumentElement());
            // make sure direction is IN since it is a request message.
            newHeader.setDirection(Direction.DIRECTION_IN);
            //newHeader.setMustUnderstand(false);
            soapHeaders.add(newHeader);
           
        }
View Full Code Here

            // Insert a new header
            String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><outofbandHeader "
                + "xmlns=\"http://cxf.apache.org/outofband/Header\" hdrAttribute=\"testHdrAttribute\" "
                + "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" soap:mustUnderstand=\"1\">"
                + "<name>New_testOobHeader</name><value>New_testOobHeaderValue</value></outofbandHeader>";
            SoapHeader newHeader = new SoapHeader(soapHeaders.get(0).getName(),
                           DOMUtils.readXml(new StringReader(xml)).getDocumentElement());
            // make sure direction is OUT since it is a response message.
            newHeader.setDirection(Direction.DIRECTION_OUT);
            //newHeader.setMustUnderstand(false);
            soapHeaders.add(newHeader);
           
        }
View Full Code Here

            if (!(header instanceof SoapHeader)) {
                LOG.trace("Skipped header: {} since it is not a SoapHeader", header);
                continue;
            }
           
            SoapHeader soapHeader = SoapHeader.class.cast(header);
            for (Iterator<SoapVersion> itv = SoapVersionFactory.getInstance().getVersions(); itv.hasNext();) {
                SoapVersion version = itv.next();

                if (soapHeader.getActor() != null
                    && soapHeader.getActor().equals(version.getNextRole())) {
                    // dropping headers if actor/role equals to {ns}/role|actor/next
                    // cxf SoapHeader needs to have soap:header@relay attribute,
                    // then we can check for it here as well
                    LOG.trace("Filtered header: {}", header);
                    iterator.remove();
View Full Code Here

        String requestBody = "<ns2:inoutHeader xmlns:ns2=\"http://apache.org/camel/component/cxf/soap/headers\">"
            + "<requestType>CXF user</requestType></ns2:inoutHeader>";
        List<Source> elements = new ArrayList<Source>();
        elements.add(new DOMSource(DOMUtils.readXml(new StringReader(requestBody)).getDocumentElement()));
        final List<SoapHeader> headers = new ArrayList<SoapHeader>();
        headers.add(new SoapHeader(qname,
                                   DOMUtils.readXml(new StringReader(requestHeader)).getDocumentElement()));
        final CxfPayload<SoapHeader> cxfPayload = new CxfPayload<SoapHeader>(headers, elements, null);
       
        Exchange exchange = template.request(uri, new Processor() {
            public void process(Exchange exchange) throws Exception {
View Full Code Here

TOP

Related Classes of org.apache.cxf.binding.soap.SoapHeader

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.