Package org.apache.axis2.soap

Examples of org.apache.axis2.soap.SOAPHeaderBlock


    if (identifier == null)
      throw new OMException(
          "Cant add ack Req block since the identifier is null");

    SOAPHeader SOAPHdr = (SOAPHeader) header;
    SOAPHeaderBlock ackReqHdrBlock = SOAPHdr.addHeaderBlock(
        Sandesha2Constants.WSRM.ACK_REQUESTED, rmNamespace);
    ackReqHdrBlock.setMustUnderstand(true);

    identifier.toOMElement(ackReqHdrBlock);

    if (messageNumber != null) {
      messageNumber.toOMElement(ackReqHdrBlock);
View Full Code Here


        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

        Integer headerBlockPresent = (Integer) msgContext.getOperationContext().getProperty("HEADER_BLOCK_PRESENT", true);
        if (headerBlockPresent.equals(new Integer(1))) {
            SOAPHeader headerAdd = (SOAPHeader) msgContext.getOperationContext().getProperty("HEADER_BLOCK", true);
           Iterator headerBlocks = headerAdd.examineAllHeaderBlocks();
            while(headerBlocks.hasNext()){
                SOAPHeaderBlock headerBlock=(SOAPHeaderBlock) headerBlocks.next();
                msgContext.getEnvelope().getHeader().addChild(headerBlock);
            }
        } else {
            msgContext.getEnvelope().getHeader().discard();
        }
View Full Code Here

    public void testSendingMustUnderstandWithNextRole() throws Exception {
        SOAPFactory fac = OMAbstractFactory.getSOAP12Factory();
        SOAPEnvelope envelope = fac.getDefaultEnvelope();
        OMNamespace headerNs = fac.createOMNamespace("http://dummyHeader", "dh");
        SOAPHeaderBlock h1 =
            fac.createSOAPHeaderBlock("DummyHeader", headerNs, envelope.getHeader());
        h1.setMustUnderstand(true);
        h1.addChild(fac.createText("Dummy String"));
        h1.setRole(SOAP12Constants.SOAP_ROLE_NEXT);
        OMElement payload = TestingUtils.createDummyOMElement();
        envelope.getBody().addChild(payload);
        sendMessageWithHeader(envelope);

    }
View Full Code Here


        OMNamespace axis2Namespace = fac.createOMNamespace(Constants.AXIS2_NAMESPACE_URI,
                                                           Constants.AXIS2_NAMESPACE_PREFIX);
        SOAPEnvelope defaultEnvelope = fac.getDefaultEnvelope();
        SOAPHeaderBlock soapHeaderBlock = defaultEnvelope.getHeader().addHeaderBlock(Constants.SERVICE_GROUP_ID,
                                                                                     axis2Namespace);

        String serviceGroupId = result.getHeader().getFirstChildWithName(new QName("ReplyTo"))
                .getFirstChildWithName(new QName("ReferenceParameters")).
                getFirstChildWithName(new QName("ServiceGroupId")).getText();

        soapHeaderBlock.setText(serviceGroupId);

        SOAPEnvelope soapEnvelope = call.invokeBlocking(operationName.getLocalPart(),
                                                        defaultEnvelope);
        String text = soapEnvelope.getBody().getFirstElement().getText();
        assertEquals("Number of requests should be 2", 2, Integer.parseInt(text));
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

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

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

        if (se.getHeader() == null) {
            return;
        }
        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
                if (role != null && !SOAP12Constants.SOAP_ROLE_NEXT.equals(role)) {
View Full Code Here

        EndpointReference epr = messageInformationHeaders.getTo();
        if (epr != null) {

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

            AnyContentType referenceParameters = epr.getReferenceParameters();
            if (referenceParameters != null) {
                processAnyContentType(referenceParameters, soapHeader);
View Full Code Here

    private OMElement processStringInfo(String value,
                                        String type,
                                        SOAPHeader soapHeader) {
        if (!"".equals(value) && value != null) {
            SOAPHeaderBlock soapHeaderBlock =
                    soapHeader.addHeaderBlock(type, addressingNamespaceObject);
            soapHeaderBlock.addChild(
                    OMAbstractFactory.getOMFactory().createText(value));
            return soapHeaderBlock;
        }
        return null;
    }
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.