// Set up a server and deploy our service
BasicServerConfig config = new BasicServerConfig();
AxisServer server = new AxisServer(config);
SOAPService service = new SOAPService(new RPCProvider());
service.setOption("className", "test.encoding.TestOmittedValues");
service.setOption("allowedMethods", "*");
ServiceDesc desc = service.getServiceDescription();
// We need parameter descriptors to make sure we can match by name
// (the only way omitted==null can work).
ParameterDesc [] params = new ParameterDesc [] {
new ParameterDesc(new QName("", "param1"), ParameterDesc.IN, null),
new ParameterDesc(new QName("", "param2"), ParameterDesc.IN, null),
new ParameterDesc(new QName("", "param3"), ParameterDesc.IN, null),
};
OperationDesc oper = new OperationDesc("method", params, null);
desc.addOperationDesc(oper);
config.deployService("testOmittedValue", service);
String msg = header + missingParam2 + footer;
Message message = new Message(msg);
MessageContext context = new MessageContext(server);
context.setRequestMessage(message);
Call call = new Call(new Service());
LocalTransport transport = new LocalTransport(server);
transport.setRemoteService("testOmittedValue");
call.setTransport(transport);
SOAPEnvelope resEnv = call.invoke(message.getSOAPEnvelope());
RPCElement rpcElem = (RPCElement)resEnv.getFirstBody();
RPCParam param = (RPCParam)rpcElem.getParams().get(0);
assertEquals("OK!", param.getObjectValue());