XML & Web services: Returing Objects using JAX-WS

  1. Returing Objects using JAX-WS (1 messages)

    Hi, I need some help in returning objects using JAX-WS on serverside. I could write simple JAX-WS programs returning basic data type. However, I am unable to return the objects. The problem is that the object elements are not shown on WSDL. Hence, the client is unable to understand the object. Simple Sample Program: public class X { private Integer i; public X() { this.i = 0; } public getI() { return this.i } } @WebService public class Main() throws RemoteException { @WebMethod public X api() { X m = new X(); return m; } } The problem is I am unable to use X.getI() at the client side (compiler error). If I replace X with String, I am able to read String. On checking the WSDL, any information related to Class X is not included. Any help is appreciated. Sophie
  2. try to implement java.io.Serializable and overwrite the hashCode() and equals() method in X. compiler error: it seems you have your stubs generated? try this: javax.xml.ws.Service aService = Service.create(new URL("url to ws wsdl"), new QName("http://wrapper.jaxws.service.v1.aad.xxx.xx/", "MyWebServiceName")); MyWSInterface serviceProxy = aService.getPort(MyWSInterface.class); ... you maybe have to split projects (one spi, one for client and one for the implementation on the appl server). this way, you can directly call the service proxy, without creating/generating any client stubs. slowfly