FileDocCategorySizeDatePackage
TestOutParams2.javaAPI DocApache Axis 1.44169Sat Apr 22 18:57:28 BST 2006test.outparams2

TestOutParams2

public class TestOutParams2 extends TestCase
Test if operation is invoked with parameters in good order when out parameter is not the last parameter.
It makes sure that bug described at http://issues.apache.org/jira/browse/AXIS-1975 is corrected.
author
Cedric Chabanois (cchabanois@natsystem.fr)

Fields Summary
private final String
message
A fixed message, with one parameter
private org.apache.axis.client.Service
s_service
private org.apache.axis.client.Call
client
private org.apache.axis.configuration.SimpleProvider
provider
private org.apache.axis.server.AxisServer
server
private static boolean
called
Constructors Summary
public TestOutParams2(String name)


       
        super(name);
        server.init();
    
public TestOutParams2()

        super("Test Out Params");
    
Methods Summary
public static voidmain(java.lang.String[] args)

        try {
            TestOutParams2 tester = new TestOutParams2("OutParams Test");
            tester.testOutputParams();
        } catch (Exception e) {
            e.printStackTrace();
        }
    
public voidserviceMethod(javax.xml.rpc.holders.StringHolder out1, byte in1)

        called = true;
    
public voidtestOutputParams()

        // Register the service
        s_service = new Service();
        client = (Call) s_service.createCall();

        SOAPService service = new SOAPService(null, new RPCProvider(), null);
        service.setName("TestOutParamsService");
        service.setOption("className", "test.outparams2.TestOutParams2");
        service.setOption("allowedMethods", "serviceMethod");

        ServiceDesc description = new JavaServiceDesc();
        OperationDesc operation = new OperationDesc();
        operation.setName("serviceMethod");
        ParameterDesc out1 = new ParameterDesc();
        out1.setName("out1");
        out1.setMode(ParameterDesc.OUT);
        operation.addParameter(out1);
        ParameterDesc in1 = new ParameterDesc();
        in1.setName("in1");
        in1.setMode(ParameterDesc.IN);
        operation.addParameter(in1);
        description.addOperationDesc(operation);
        service.setServiceDescription(description);

        EngineConfiguration defaultConfig = (new DefaultEngineConfigurationFactory())
                .getServerEngineConfig();
        SimpleProvider config = new SimpleProvider(defaultConfig);
        config.deployService("outParamsTest", service);
        provider.deployService("outParamsTest", service);

        // Make sure the local transport uses the server we just configured
        client.setTransport(new LocalTransport(server));

        Message msg = new Message(message, false);
        SOAPEnvelope env = msg.getSOAPEnvelope();

        // invoke
        client.invoke(env);
        assertTrue(this.called);