Hi Opengl , Initially I was working on android sdk_0.5 and ksoap2 build and my application was running fine.but now in SDk 1.0 i am unable to consume web service using the same library.
I know its due to the change in the apache library, but i am unable to get a latest ksoap2 jar lib to work with new SDK. It will be very much helpful,if you can give me some tips how to work around this. Thanks Quest. On Nov 7, 12:55 am, opengl es <[EMAIL PROTECTED]> wrote: > Hi, > > I use KSOAP2 (you'll find more about KSOAP2 in forums/groups etc..) > It works great once you know how to deal with XSD and namespaces and > KvmSerializable > > here is what i do: > > private static final String SOAP_ACTION = "MyMethod"; > private static final String METHOD_NAME = "MyMethod"; > private static final String NAMESPACE = "http://x.y.z/foo1/foo2"; > private static final String NAMESPACE_SDO = "http://x.y.z/foo1/ > foo2Sdo"; > > /* > * note that within the emulated system, 127.0.0.1 refers to the > emulated > * device's own loopback interface. if you want to connect to your > host > * machine's "localhost", use the 10.0.2.2 alias instead. maybe > this > * explains your problems ? > */ > private static final String URL = "http://10.0.2.2:<myPort>/abc/ > services/MyService"; > > public void mymethodKSOAP(MyObject myObject) { > > SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); > > request.addProperty("MyObject", myObject); > > SoapSerializationEnvelope envelope = new > SoapSerializationEnvelope(SoapEnvelope.VER11); > envelope.dotNet = false; > envelope.addMapping(NAMESPACE_SDO, "MyObject", (new > MyObject()).getClass()); > envelope.addMapping(NAMESPACE_SDO, "MyObjectId", (new > MyObjectId()).getClass()); > envelope.addMapping(NAMESPACE_SDO, "TheObjectResponse", (new > TheObjectResponse()) > .getClass()); > //etc.... > // implements all your client java object (and responses > object) with 'implements KvmSerializable' > // inside your client java object define the specific object > namespace sdo like > // private static final String NAMESPACE = "http://x.y.z/foo1/ > foo2Sdo"; > > envelope.setOutputSoapObject(request); > > AndroidHttpTransport androidHttpTransport = new > AndroidHttpTransport(URL); > > try { > androidHttpTransport.call(SOAP_ACTION, envelope); > resultsRequestSOAP = envelope.getResponse(); > > } catch (Exception e) { > e.printStackTrace(); > } > } > > // and you're done > > Note: > for KvmSerializable implementation > if you use simple type do > > public void getPropertyInfo(int i, Hashtable hashtable, PropertyInfo > propertyinfo) { > propertyinfo.namespace = NAMESPACE; > switch (i) { > case 0: > propertyinfo.type = (new MyObjectId()).getClass(); > propertyinfo.name = "myObjectId"; > break; > case 1: > propertyinfo.type = PropertyInfo.STRING_CLASS; > propertyinfo.name = "aStringField"; > break; > case 2: > propertyinfo.type = PropertyInfo.INTEGER_CLASS; > propertyinfo.name = "aNumberField"; > break; > // etc.... > > } > > Hope this will help you > > Regards, > Franck > > On Nov 6, 4:05 pm, "Avinash Patil" <[EMAIL PROTECTED]> wrote: > > > I have simple WSDL web service file and added into project. > > Now I am trying to use WSDL web service through android class code, > > but not able to use it. > > Can anybody suggest how to import WSDL file in ANdroid, so that it can > > create auto classes for > > WSDL file and same can be used ion android main class, where we can > > send and receive any request/response. > > > Please suggest any simple WSDL use. > > Thanks a lot!! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---