Package org.apache.axis.message

Examples of org.apache.axis.message.SOAPEnvelope


     * Test RPC element serialization when we have no MessageContext
     */
    public void testRPCElement()
    {
        try {
            SOAPEnvelope env = new SOAPEnvelope();
            RPCElement method = new RPCElement("ns",
                                               "method",
                                               new Object [] { "argument" });
            env.addBodyElement(method);
            env.toString();
        } catch (Exception e) {
            fail(e.getMessage());
        }

        // If there was no exception, we succeeded in serializing it.
View Full Code Here


       
        Document document = XMLUtils.newDocument(reqSource);
       
        String msgString = null;
       
        SOAPEnvelope msg = new SOAPEnvelope();
        RPCParam arg1 = new RPCParam("urn:myNamespace", "testParam", document.getFirstChild());
        arg1.setXSITypeGeneration(Boolean.FALSE);
       
        RPCElement body = new RPCElement("urn:myNamespace", "method1", new Object[] { arg1 });
        msg.addBodyElement(body);
        body.setEncodingStyle(Constants.URI_LITERAL_ENC);
       
        SerializationContext context = new SerializationContextImpl(stringWriter, msgContext);
        msg.output(context);
       
        msgString = stringWriter.toString();
        assertTrue(msgString.indexOf("xmlns=\"\"")==-1);
    }   
View Full Code Here

       
        Document document = XMLUtils.newDocument(reqSource);
       
        String msgString = null;
       
        SOAPEnvelope msg = new SOAPEnvelope();
        RPCParam arg1 = new RPCParam("urn:myNamespace", "testParam", document.getFirstChild());
        arg1.setXSITypeGeneration(Boolean.FALSE);
       
        RPCElement body = new RPCElement("urn:myNamespace", "method1", new Object[] { arg1 });
        msg.addBodyElement(body);
        body.setEncodingStyle(Constants.URI_LITERAL_ENC);
       
        SerializationContext context = new SerializationContextImpl(stringWriter, msgContext);
        msg.output(context);
       
        msgString = stringWriter.toString();
       
        // Now reparse into DOM so we can check namespaces.
        StringReader resReader = new StringReader(msgString);
View Full Code Here

    public void invoke(MessageContext msgContext) throws AxisFault {
        category.debug("Enter: EchoHandler::invoke" );
        try {
            Message  msg = msgContext.getRequestMessage();
            SOAPEnvelope env = (SOAPEnvelope) msg.getAsSOAPEnvelope();
            msgContext.setResponseMessage( new Message( env ) );
        }
        catch( Exception e ) {
            category.error( e );
            throw new AxisFault( e );
View Full Code Here

        // Don't serialize xsi:type attributes
        sd.setSendTypeAttr(false);

        msgContext.setServiceDescription(sd);

        SOAPEnvelope msg = new SOAPEnvelope();
        RPCParam arg1 = new RPCParam("urn:myNamespace",
                                     "testParam",
                                     "this is a string");
        RPCElement body = new RPCElement("urn:myNamespace",
                                         "method1",
                                         new Object[]{ arg1 });
        msg.addBodyElement(body);

        Writer stringWriter = new StringWriter();
        SerializationContext context = new SerializationContext(stringWriter,
                                                                msgContext);

        msg.output(context);

        String msgString = stringWriter.toString();
        assertTrue("Found unexpected xsi:type!",
                   msgString.indexOf("xsi:type") == -1);
    }
View Full Code Here

     */
    public void undo(MessageContext msgContext) {
    }

    public void invoke(MessageContext msgContext) throws AxisFault {
        SOAPEnvelope env = new SOAPEnvelope();

        RPCParam retVal = new RPCParam("return", new Integer(5));
        RPCParam outParam1 = new RPCParam("out1", OUTPARAM1);
        RPCParam outParam2 = new RPCParam("out2", OUTPARAM2);

        RPCElement rpc = new RPCElement("namespace", "response", new Object []
                            { retVal, outParam1, outParam2 });

        env.addBodyElement(rpc);

        msgContext.setResponseMessage(new Message(env));
    }
View Full Code Here

            if (msg == null) {
                msg = new Message((AxisFault)e);
                msgContext.setResponseMessage(msg);
            } else {
                try {
                    SOAPEnvelope env = msg.getAsSOAPEnvelope();
                    env.clearBody();
                    env.addBodyElement(new SOAPFaultElement((AxisFault)e));
                } catch (AxisFault af) {
                    // Should never reach here!
                }
            }
        }
View Full Code Here

    public void invoke(MessageContext msgContext) throws AxisFault {
        category.debug("Enter: DebugHandler::invoke" );
        try {
            Message       msg = msgContext.getRequestMessage();

            SOAPEnvelope message = (SOAPEnvelope)msg.getAsSOAPEnvelope();
            SOAPHeader header = message.getHeaderByName(Constants.URI_DEBUG,
                                                        "Debug");

            if (header != null) {
                Integer i = ((Integer)header
                             .getValueAsType(SOAPTypeMappingRegistry.XSD_INT));
View Full Code Here

            if (respMsg == null) {
                respMsg = new Message(fault);
                serverContext.setResponseMessage(respMsg);
            } else {
                SOAPFaultElement faultEl = new SOAPFaultElement(fault);
                SOAPEnvelope env = respMsg.getAsSOAPEnvelope();
                env.clearBody();
                env.addBodyElement(faultEl);
            }
        }

        // copy back the response, and force its format to String in order to
        // exercise the deserializers.
View Full Code Here

            client
              .getMessageContext()
               .setServiceDescription(new ServiceDescription("Admin", false));
           
            input.close();
            SOAPEnvelope envelope =
                                   (SOAPEnvelope) outMsg.getAsSOAPEnvelope();
            SOAPBodyElement body = envelope.getFirstBody();
            StringWriter writer = new StringWriter();
            client.addOption(AxisEngine.PROP_XML_DECL, new Boolean(false));
            SerializationContext ctx = new SerializationContext(writer,
                                                  client.getMessageContext());
            ctx.setPretty(true);
View Full Code Here

TOP

Related Classes of org.apache.axis.message.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.