Been at this problem the whole day, so hope someone can help.
For a project I am working on, I need to invoke a .NET based web
service. Several operations of this web service return complex types
or arrays of complex types. In some cases the complex objects contain
arrays of other complex objects until sometimes 3 levels deep.
To make the handling of the objects easier by the Android developers,
I would prefer them to have the actual object structure available upon
the return of the result so they can easily parse through it. So far
I've attempted to accomplish this using kSoap
I've tried all sorts of things to make this possible.
1. Generate the Web Service Client classes in Netbeans
- The generated stub requires J2ME libraries
- The kSoap SoapEnvelope Response Object can't cast to the generated
classes by Netbeans.
2. Tried using AXIS2 generated classes and stubs.
- AXIS2 invocation code won't execute properly
Need a solution to handle these complex data structures without having
to write elaborate conversion code. Anybody got any suggestion or
solution?
Here is some of the code I tried:
AXIS2:
try {
WSStub stub = new WSStub();
WSStub.GetZonesWithLocations req = new
WSStub.GetZonesWithLocations(); GetZonesWithLocationsResponse
resp = stub.getZonesWithLocations(req);
ZonesWithLocations[] zones =
resp.getGetZonesWithLocationsResult();
System.out.println("Zone Name " + zones[0].getZoneName());
}
catch(Exception e) {
e.printStackTrace();
}
Using the Netbeans generated classes:
// Formulate Soap Request
SoapObject request = new SoapObject(NAMESPACE2, METHOD_NAME2);
// Create Soap Envelope
SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
AndroidHttpTransport androidHttpTransport = new
AndroidHttpTransport(URL2);
try {
androidHttpTransport.call(SOAP_ACTION2, envelope);
ZonesWithLocations[] response = ( ZonesWithLocations[])
envelope.bodyIn;
System.out.println("Response: " +
response[0]..getZoneName());
} catch (Exception ex) {
ex.printStackTrace();
}
Hope anybody can help, a lot depends on getting this to work.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en