C
carmelo
Hi everybody,
I'm developing a client which sends data to a WebService. I'm trying
to do that without success.
Using the following code the WebService receives a "null" value, and
as response I get "Result = null".
- WebService
package dbws;
public class DBWS {
public String insert(MyClass myclass)
{
return myclass.getField();
}
}
- Client
package dbws_client;
public class Main {
public static void main(String[] args) {
try { // Call Web Service Operation
dbws.DBWS service = new dbws.DBWS();
dbws.DBWSPortType port =
service.getDBWSHttpSoap12Endpoint();
// initialize WS operation arguments here
dbws.xsd.MyClass myclass = new dbws.xsd.MyClass();
dbws.xsd.ObjectFactory of = new dbws.xsd.ObjectFactory();
myclass.setField(of.createMyClassField("my_value"));
//myclass.setField(new JAXBElement(null, String.class, new
String("my_value")));
// process result here
java.lang.String result = port.insertData(myclass);
System.out.println("Result = " + result);
} catch (Exception ex) {
// handle custom exceptions here
}
}
}
How can I do to pass a class correctly to the WebService?
Thank you very much for your help
I'm developing a client which sends data to a WebService. I'm trying
to do that without success.
Using the following code the WebService receives a "null" value, and
as response I get "Result = null".
- WebService
package dbws;
public class DBWS {
public String insert(MyClass myclass)
{
return myclass.getField();
}
}
- Client
package dbws_client;
public class Main {
public static void main(String[] args) {
try { // Call Web Service Operation
dbws.DBWS service = new dbws.DBWS();
dbws.DBWSPortType port =
service.getDBWSHttpSoap12Endpoint();
// initialize WS operation arguments here
dbws.xsd.MyClass myclass = new dbws.xsd.MyClass();
dbws.xsd.ObjectFactory of = new dbws.xsd.ObjectFactory();
myclass.setField(of.createMyClassField("my_value"));
//myclass.setField(new JAXBElement(null, String.class, new
String("my_value")));
// process result here
java.lang.String result = port.insertData(myclass);
System.out.println("Result = " + result);
} catch (Exception ex) {
// handle custom exceptions here
}
}
}
How can I do to pass a class correctly to the WebService?
Thank you very much for your help