Skip to main content

List when sent across SOAP

1 reply [Last post]
sharmagrv
Offline
Joined: 2005-07-12
Points: 0

Hi everyone,

I have a schema that needs to be sent across in SOAP message. I have attached an abridged version of this schema. The purpose for such a complicated schema is:
If A1 is present, it can also have A2
But if A1 is not present A2 has to be there
The schema for the same is attached at the end.

On trying Jaxws the Arg class generated does not have a structure but has a List which is expected behaviour as clear from my earlier question. But when I start using this Arg class to generate client and server, I see that though the client is able to successfully generate the list the server always miss them. Using the same piece of code for a modified wsdl i.e. use A3 instead of A2 in second sequence works fine.

Is there a working example where List is used? For reference I am attaching the relevant client and server code also. In client the response I receive is 'Length of List is-0'.

The WSDL structure:
===================

Server:
=======
public Resp getSoapResponse(Arg request){
StringBuffer str = new StringBuffer();
ArrayList> list = ( ArrayList>) request.getContent();
str.append("Length of List is- " + request.getContent().size());
Resp resp = new Resp();
resp.setR1(str.toString());
return resp;
}

Client:
======
try {
ServiceFactory serviceFactory = ServiceFactory.newInstance();

Nic1Service service = (Nic1Service) serviceFactory.createService((java.net.URL)null, Nic1Service.class);

Nic1ServicePortType port = service.getNic1ServicePort();

ObjectFactory objf = new ObjectFactory();

Arg request = new Arg();

request.getContent().add(objf.createArgA1("111"));

request.getContent().add(objf.createArgA2("222"));

System.out.println("Input Size is: " + request.getContent().size());

Resp resp = port.getSoapResponse(request);
System.out.println("The response is: " + resp.getR1()) ;

} catch (RemoteException ex) {
ex.printStackTrace();
}

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kohlert
Offline
Joined: 2003-06-16
Points: 0

We will look into this as soon as we can.