Hi, I'm trying to build an Android application which consumes an ASP.NET Webservice. In the future I plan to send audio files between the two.
So far I've been experimenting with a simple application which sends a parameter to a simple webservice which is supposed to store the value in a database, but with no success. When debugging the webservice I saw that it received the following soap request: --------------------------------------------------------------------------------------------- <v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http:// schemas.xmlsoap.org/soap/encoding/" xmlns:v="http:// schemas.xmlsoap.org/soap/envelope/"> <v:Header /> <v:Body> <UpdateTest2 xmlns="http:///WebWithWcf/" id="o0" c:root="1"> <id i:type="d:int">19</id> </UpdateTest2> </v:Body> </v:Envelope> --------------------------------------------------------------------------------------------- When continuing to debug I noticed that the webservice successfully recognized the Webmethod ("UpdateTest2") but failed to pass on the parameter ("19"). The Android application uses the ksoap2 library. Here is the code: --------------------------------------------------------------------------------------------- package test.Client1; import android.app.Activity; import android.os.Bundle; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapPrimitive; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.AndroidHttpTransport; public class Client1 extends Activity { private static final String NAMESPACE = "http:///WebWithWcf/" ; private static final String URL = "http://192.168.2.100/WebWithWcf/ WebService1.asmx"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); String soapAction = "http://localhost/WebWithWcf/ UpdateTest2"; String methodName = "UpdateTest2"; Object soapIn = new Object(); SoapObject request = new SoapObject(NAMESPACE, methodName); request.addProperty("id",19 ); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(request); AndroidHttpTransport aht = new AndroidHttpTransport(URL); try { aht.call(soapAction, envelope); SoapPrimitive resultString = (SoapPrimitive)envelope.getResponse(); } catch(Exception e) { e.printStackTrace(); } } } --------------------------------------------------------------------------------------------- Any ideas? Thanx -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en