I've got a problem with calling a webservice from Android with KSOAP.
I've got a webmethod with following signature:
Using java Syntax Highlighting
- @WebMethod(operationName = "doSomething")
- public boolean doSomething(@WebParam(name = "objMyClass")
- MyClass objMyClass)
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
The class MyClass implementation looks that way:
Using java Syntax Highlighting
- @XmlRootElement(name = "myClass")
- public class MyClass {
- private String myData;
- @XmlAttribute
- public String getMyData() {
- return myData;
- }
- public void setMyData(String myData) {
- this.myData = myData;
- }
- }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
In my Androidapplication I'm calling the webmethod that way:
Using java Syntax Highlighting
- public boolean callDoData(MyClass myClass) throws IOException,
- XmlPullParserException
- {
- SoapObject request = new SoapObject(WSConstants.NAMESPACE,
- WSConstants.DOSOMETHINGMETHOD);
- SoapObject createMProfile = new SoapObject(WSConstants.NAMESPACE,
- WSConstants.DOSOMETHINGSOAP);
- createMProfile.addProperty("objMyClass", myClass);
- request.addProperty(WSConstants.DOSOMETHINGMETHOD, createMProfile);
- SoapSerializationEnvelope envelope = new
- SoapSerializationEnvelope(SoapEnvelope.VER11);
- envelope.setOutputSoapObject(request);
- AndroidHttpTransport androidHttpTransport = new
- AndroidHttpTransport(WSConstants.URL);
- androidHttpTransport.call(WSConstants.DOSOMETHINGSOAP,
- envelope);
- Object result = envelope.getResponse();
- return Boolean.valueOf(result.toString());
- }
Parsed in 0.036 seconds, using GeSHi 1.0.8.4
If I call that function i've got an exception which say "Cannot
serialize MyClass".
What have I make wrong? Any hints?
Thanks
Markus

