FileDocCategorySizeDatePackage
TestBody.javaAPI DocApache Axis 1.42487Sat Apr 22 18:57:26 BST 2006test.encoding

TestBody

public class TestBody extends TestCase
Verify that deserialization actually can cause the soap service to be set...

Fields Summary
private String
namespace
private String
request
Constructors Summary
public TestBody(String name)

        super(name);
    
Methods Summary
public static voidmain(java.lang.String[] args)

        TestBody tester = new TestBody("test");
        tester.testBodyNamespace();
    
public voidtestBodyNamespace()


         
        SimpleProvider provider = new SimpleProvider();

        // register the service with the engine
        SOAPService target = new SOAPService(new RPCProvider());
        target.setOption(JavaProvider.OPTION_CLASSNAME, "test.encoding.TestBody");
        provider.deployService(new QName(null,namespace), target);

        // setup
        AxisEngine engine = new AxisServer(provider);
        engine.init();

        // create a message in context
        MessageContext msgContext = new MessageContext(engine);
        Message message = new Message(request);
        message.setMessageContext(msgContext);

        // ensure that the message is parsed
        SOAPEnvelope envelope = message.getSOAPEnvelope();
        RPCElement body = (RPCElement) envelope.getFirstBody();

        // This is not necessarily true anymore...
        //assertEquals("Namespace does not equal the message context target service.", namespace, msgContext.getTargetService());

        // verify the service is set
        assertEquals("The target is not the same as the message context service handler", target, msgContext.getService());