Package org.apache.axis2.soap

Examples of org.apache.axis2.soap.SOAPHeaderBlock


        try {
            OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(
                    getTestResourceFile("soap/soapmessage.xml"));
            SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
            SOAPHeader soapHeader = soapEnvelope.getHeader();
            SOAPHeaderBlock soapHeaderBlock = omFactory.createSOAPHeaderBlock(
                    "soapHeaderBlockOne", namespace, soapHeader);
            assertTrue(
                    "Programatically created SOAPHeaderBlock should have done = true ",
                    soapHeaderBlock.isComplete());
            SOAPHeaderBlock soapHeaderBlockTwo = omFactory.createSOAPHeaderBlock(
                    "soapHeaderBlockOne", namespace, soapHeader, omBuilder);
            assertTrue(
                    "SOAPHeaderBlock with a builder should start with done = false ",
                    !soapHeaderBlockTwo.isComplete());
            assertTrue("This SOAPHeaderBlock must have a builder ",
                    soapHeaderBlockTwo.getBuilder() instanceof OMXMLParserWrapper);


        } catch (Exception e) {
            log.info(e.getMessage());
        }
View Full Code Here


        EndpointReference epr = messageContextOptions.getTo();
        if (epr != null && !isAddressingHeaderAlreadyAvailable(WSA_TO, envelope, addressingNamespaceObject)) {

            String address = epr.getAddress();
            if (!"".equals(address) && address != null) {
                SOAPHeaderBlock toHeaderBlock = envelope.getHeader().addHeaderBlock(WSA_TO, addressingNamespaceObject);
                toHeaderBlock.setText(address);
            }

            processReferenceInformation(epr.getAllReferenceParameters(), soapHeader, addressingNamespaceObject);
            processReferenceInformation(epr.getAllReferenceProperties(), soapHeader, addressingNamespaceObject);
View Full Code Here

    private OMElement processStringInfo(String value,
                                        String type,
                                        SOAPEnvelope soapEnvelope, OMNamespace addressingNamespaceObject) {
        if (!"".equals(value) && value != null) {
            SOAPHeaderBlock soapHeaderBlock =
                    soapEnvelope.getHeader().addHeaderBlock(type, addressingNamespaceObject);
            soapHeaderBlock.addChild(
                    OMAbstractFactory.getOMFactory().createText(value));
            return soapHeaderBlock;
        }
        return null;
    }
View Full Code Here

                                   SOAPEnvelope envelope, OMNamespace addressingNamespaceObject, String addressingNamespace) {
        if (epr == null || isAddressingHeaderAlreadyAvailable(type, envelope, addressingNamespaceObject)) {
            return;
        }

        SOAPHeaderBlock soapHeaderBlock =
                envelope.getHeader().addHeaderBlock(type, addressingNamespaceObject);

        String address = epr.getAddress();
        if (!"".equals(address) && address != null) {
            OMElement addressElement =
                    OMAbstractFactory.getOMFactory().createOMElement(
                            EPR_ADDRESS,
                            addressingNamespaceObject);
            soapHeaderBlock.addChild(addressElement);
            addressElement.setText(address);
        }

        addToHeader(epr, soapHeaderBlock, addressingNamespaceObject, addressingNamespace);


        Map referenceParameters = epr.getAllReferenceParameters();
        if (referenceParameters != null) {
            OMElement reference =
                    OMAbstractFactory.getOMFactory().createOMElement(
                            EPR_REFERENCE_PARAMETERS,
                            addressingNamespaceObject);
            soapHeaderBlock.addChild(reference);
            processReferenceInformation(referenceParameters, reference, addressingNamespaceObject);

        }

        if (Submission.WSA_NAMESPACE.equals(addressingNamespace)) {
View Full Code Here

    private void extractReferenceParameters(
            SOAPHeader header,
            Options messageContextOptions) {
        Iterator headerBlocks = header.getChildren();
        while (headerBlocks.hasNext()) {
            SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) headerBlocks.next();
            if (Final.WSA_TYPE_ATTRIBUTE_VALUE.equals(soapHeaderBlock.getAttribute(
                                            new QName(Final.WSA_NAMESPACE,
                                                    Final.WSA_IS_REFERENCE_PARAMETER_ATTRIBUTE)).getAttributeValue())) {
                messageContextOptions.addReferenceParameter(soapHeaderBlock);
            }
        }
View Full Code Here

            String addressingNamespace)
            throws AddressingException {

        Iterator addressingHeadersIt = addressingHeaders.iterator();
        while (addressingHeadersIt.hasNext()) {
            SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) addressingHeadersIt.next();
            EndpointReference epr;
            if (AddressingConstants.WSA_TO.equals(soapHeaderBlock.getLocalName())) {
                //here the addressing epr overidde what ever already there in the message context
                epr = new EndpointReference(soapHeaderBlock.getText());
                messageContextOptions.setTo(epr);

                // check for reference parameters
                extractToEprReferenceParameters(epr, header);
                soapHeaderBlock.setProcessed();

            } else if (AddressingConstants.WSA_FROM.equals(soapHeaderBlock.getLocalName())) {
                epr = messageContextOptions.getFrom();
                if (epr == null) {
                    epr = new EndpointReference("")// I don't know the address now. Let me pass the empty string now and fill this
                                                      // once I process the Elements under this.
                    messageContextOptions.setFrom(epr);
                }
                extractEPRInformation(soapHeaderBlock, epr, addressingNamespace);
                soapHeaderBlock.setProcessed();
            } else if (AddressingConstants.WSA_REPLY_TO.equals(soapHeaderBlock.getLocalName())) {
                epr = messageContextOptions.getReplyTo();
                if (epr == null) {
                    epr = new EndpointReference("");
                    messageContextOptions.setReplyTo(epr);
                }
                extractEPRInformation(soapHeaderBlock, epr, addressingNamespace);
                soapHeaderBlock.setProcessed();
            } else if (AddressingConstants.WSA_FAULT_TO.equals(soapHeaderBlock.getLocalName())) {
                epr = messageContextOptions.getFaultTo();
                if (epr == null) {
                    epr = new EndpointReference("");
                    messageContextOptions.setFaultTo(epr);
                }
                extractEPRInformation(soapHeaderBlock, epr, addressingNamespace);
                soapHeaderBlock.setProcessed();
            } else if (AddressingConstants.WSA_MESSAGE_ID.equals(soapHeaderBlock.getLocalName())) {
                messageContextOptions.setMessageId(soapHeaderBlock.getText());
                soapHeaderBlock.setProcessed();
            } else if (AddressingConstants.WSA_ACTION.equals(soapHeaderBlock.getLocalName())) {
                messageContextOptions.setAction(soapHeaderBlock.getText());
                soapHeaderBlock.setProcessed();
            } else if (AddressingConstants.WSA_RELATES_TO.equals(soapHeaderBlock.getLocalName())) {
                String address = soapHeaderBlock.getText();
                OMAttribute relationshipType =
                        soapHeaderBlock.getAttribute(
                                new QName(AddressingConstants.WSA_RELATES_TO_RELATIONSHIP_TYPE));
                String relationshipTypeDefaultValue =
                        Submission.WSA_NAMESPACE.equals(addressingNamespace)
                                ? Submission.WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE
                                : Final.WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE;
                RelatesTo relatesTo =
                        new RelatesTo(
                                address,
                                relationshipType == null
                                        ? relationshipTypeDefaultValue
                                        : relationshipType.getAttributeValue());
                messageContextOptions.setRelatesTo(relatesTo);
                soapHeaderBlock.setProcessed();

            }
        }
        return messageContextOptions;
    }
View Full Code Here

    }

    private void extractToEprReferenceParameters(EndpointReference toEPR, SOAPHeader header) {
        Iterator headerBlocks = header.getChildElements();
        while (headerBlocks.hasNext()) {
            SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) headerBlocks.next();
            OMAttribute isRefParamAttr = soapHeaderBlock.getAttribute(new QName(addressingNamespace, "IsReferenceParameter"));
            if (isRefParamAttr != null && "true".equals(isRefParamAttr.getAttributeValue())) {
                toEPR.addReferenceParameter(soapHeaderBlock.getQName(), soapHeaderBlock.getText());
            }
        }
    }
View Full Code Here

        OMNamespace namespace = findNamespace(ns.getName(), ns.getPrefix());
        if (namespace != null) {
            ns = namespace;
        }

        SOAPHeaderBlock soapHeaderBlock = null;
        try {
            soapHeaderBlock = new SOAP11HeaderBlockImpl(localName, ns, this);
        } catch (SOAPProcessingException e) {
            throw new OMException(e);
        }
View Full Code Here

        }

        Iterator hbs = se.getHeader().examineAllHeaderBlocks();

        while (hbs.hasNext()) {
            SOAPHeaderBlock hb = (SOAPHeaderBlock) hbs.next();

            // if this header block has been processed or mustUnderstand isn't
            // turned on then its cool
            if (hb.isProcessed() || !hb.getMustUnderstand()) {
                continue;
            }

            // if this header block is not targetted to me then its not my
            // problem. Currently this code only supports the "next" role; we
            // need to fix this to allow the engine/service to be in one or more
            // additional roles and then to check that any headers targetted for
            // that role too have been dealt with.

            String role = hb.getRole();

            if (!msgContext.isSOAP11()) {

                // if must understand and soap 1.2 the Role should be NEXT , if it is null we considerr
                // it to be NEXT
View Full Code Here

    if (messageNumber == null)
      throw new OMException(
          "Cant add Sequence part since MessageNumber is null");


    SOAPHeaderBlock sequenceHeaderBlock = soapHeader.addHeaderBlock(
        Sandesha2Constants.WSRM.SEQUENCE, seqNoNamespace);
    sequenceHeaderBlock.setMustUnderstand(true);
    identifier.toOMElement(sequenceHeaderBlock);
    messageNumber.toOMElement(sequenceHeaderBlock);
    if (lastMessage != null)
      lastMessage.toOMElement(sequenceHeaderBlock);
View Full Code Here

TOP

Related Classes of org.apache.axis2.soap.SOAPHeaderBlock

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.