Package org.apache.axiom.soap

Examples of org.apache.axiom.soap.SOAPEnvelope


        try {
            MessageContext msgCtx = TestUtils.getAxis2MessageContext("<empty/>", null).
                    getAxis2MessageContext();
            ResponseMessageBuilder builder = new ResponseMessageBuilder(msgCtx);
            SOAPEnvelope env = builder.genUnSubscribeResponse(sub);
            OMElement resultOm = env.getBody().getFirstElement();
            OMElement expectedOm = AXIOMUtil.stringToOM(expected);
            assertTrue(compare(expectedOm, resultOm));

        } catch (Exception e) {
            fail("Error while constructing the test message context: " + e.getMessage());
View Full Code Here


        try {
            MessageContext msgCtx = TestUtils.getAxis2MessageContext("<empty/>", null).
                    getAxis2MessageContext();
            ResponseMessageBuilder builder = new ResponseMessageBuilder(msgCtx);
            SOAPEnvelope env = builder.genRenewSubscriptionResponse(sub);
            OMElement resultOm = env.getBody().getFirstElement();
            OMElement expectedOm = AXIOMUtil.stringToOM(expected);
            assertTrue(compare(expectedOm, resultOm));

        } catch (Exception e) {
            fail("Error while constructing the test message context: " + e.getMessage());
View Full Code Here

        try {
            MessageContext msgCtx = TestUtils.getAxis2MessageContext("<empty/>", null).
                    getAxis2MessageContext();
            ResponseMessageBuilder builder = new ResponseMessageBuilder(msgCtx);
            SOAPEnvelope env = builder.genGetStatusResponse(sub);
            OMElement resultOm = env.getBody().getFirstElement();
            OMElement expectedOm = AXIOMUtil.stringToOM(expected);
            assertTrue(compare(expectedOm, resultOm));

        } catch (Exception e) {
            fail("Error while constructing the test message context: " + e.getMessage());
View Full Code Here

                                   baseContextSupport.getNavigator());
            Context context = new Context(contextSupport);
            context.setNodeSet(new SingletonList(synCtx.getEnvelope()));
            return context;
        } else if (obj instanceof SOAPEnvelope) {
            SOAPEnvelope env = (SOAPEnvelope)obj;
            ContextSupport baseContextSupport = getContextSupport();
            ContextSupport contextSupport =
                new ContextSupport(baseContextSupport.getNamespaceContext(),
                                   baseContextSupport.getFunctionContext(),
                                   new SynapseXPathVariableContext(baseContextSupport.getVariableContext(), env),
View Full Code Here

        try {
            // get a copy of the message for the processing, if the continueParent is set to true
            // this original message can go in further mediations and hence we should not change
            // the original message context
            SOAPEnvelope envelope = MessageHelper.cloneSOAPEnvelope(synCtx.getEnvelope());

            // get the iteration elements and iterate through the list,
            // this call will also detach all the iteration elements
            List splitElements = EIPUtils.getDetachedMatchingElements(envelope, expression);

            if (synLog.isTraceOrDebugEnabled()) {
                synLog.traceOrDebug("Splitting with XPath : " + expression + " resulted in " +
                    splitElements.size() + " elements");
            }

            // if not preservePayload remove all the child elements
            if (!preservePayload && envelope.getBody() != null) {
                for (Iterator itr = envelope.getBody().getChildren(); itr.hasNext();) {
                    ((OMNode) itr.next()).detach();
                }
            }

            int msgCount = splitElements.size();
View Full Code Here

        newCtx.setProperty(
            EIPConstants.MESSAGE_SEQUENCE,
            msgNumber + EIPConstants.MESSAGE_SEQUENCE_DELEMITER + msgCount);

        // get a clone of the envelope to be attached
        SOAPEnvelope newEnvelope = MessageHelper.cloneSOAPEnvelope(envelope);

        // if payload should be preserved then attach the iteration element to the
        // node specified by the attachPath
        if (preservePayload) {

            Object attachElem = attachPath.evaluate(newEnvelope);
            if (attachElem != null &&
                attachElem instanceof List && !((List) attachElem).isEmpty()) {
                attachElem = ((List) attachElem).get(0);
            }

            // for the moment attaching element should be an OMElement
            if (attachElem != null && attachElem instanceof OMElement) {
                ((OMElement) attachElem).addChild(o);
            } else {
                handleException("Error in attaching the splitted elements :: " +
                    "Unable to get the attach path specified by the expression " +
                    attachPath, synCtx);
            }

        } else if (newEnvelope.getBody() != null) {
            // if not preserve payload then attach the iteration element to the body
            newEnvelope.getBody().addChild(o);
        }

        // set the envelope and mediate as specified in the target
        newCtx.setEnvelope(newEnvelope);
View Full Code Here

        assertNull(txtRtvr.getSourceText(context));
    }

    public void testSOAPEnvelopeTextRetriever() throws Exception {
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope env = fac.getDefaultEnvelope();

        OMElement payload = AXIOMUtil.stringToOM(fac,
                "<getQuote id=\"attr\"><symbol>TEST</symbol><property>1</property>" +
                        "<property>2</property></getQuote>");
        env.getBody().addChild(payload);
        MessageContext msgCtx = new MessageContext();
        msgCtx.setEnvelope(env);
        EvaluatorContext context = new EvaluatorContext(null, null);
        context.setMessageContext(msgCtx);
View Full Code Here

    public SOAPEnvelopeTextRetriever(String source) {
        this.source = source;
    }

    public String getSourceText(EvaluatorContext context) throws EvaluatorException {
        SOAPEnvelope envelope = context.getMessageContext().getEnvelope();
        Object result;
       
        try {
            if (compiledXPath == null) {
                compiledXPath = new AXIOMXPath(source);
View Full Code Here

                "<pojoCommand name='org.apache.synapse.mediators.ext.POJOCommandTestImplementedMediator' " +
                        "xmlns='http://ws.apache.org/ns/synapse'><property name=\"testProp\" " +
                        "value=\"TestProperty\" expression=\"//testNode\"/></pojoCommand>"), new Properties());
        POJOCommandTestHelper.reset();
        MessageContext ctx = new TestMessageContext();
        SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
        envelope.getBody().addChild(createOMElement("<original><testNode/></original>"));
        ctx.setEnvelope(envelope);
        pcm.mediate(ctx);
        assertEquals("TestProperty", POJOCommandTestHelper.getInstance().getChangedProperty());
        assertEquals("<original>TestProperty</original>", ctx.getEnvelope().getBody().getFirstOMChild().toString());
        assertTrue(POJOCommandTestHelper.getInstance().isExecuted());
View Full Code Here

        SynapseConfiguration synCfg = new SynapseConfiguration();
        AxisConfiguration config = new AxisConfiguration();
        testCtx = new Axis2MessageContext(new org.apache.axis2.context.MessageContext(),
            synCfg, new Axis2SynapseEnvironment(new ConfigurationContext(config), synCfg));
        ((Axis2MessageContext)testCtx).getAxis2MessageContext().setConfigurationContext(new ConfigurationContext(config));
        SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
        envelope.getBody().addChild(createOMElement("<original>test-split-context</original>"));
        testCtx.setEnvelope(envelope);
        testCtx.setSoapAction("urn:test");
        SequenceMediator seqMed = new SequenceMediator();
        helperMediator = new SplitTestHelperMediator();
        helperMediator.init(testCtx.getEnvironment());
View Full Code Here

TOP

Related Classes of org.apache.axiom.soap.SOAPEnvelope

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.