views:

537

answers:

3

Hi, I'm having a problem in calling .net web services from android using ksoap2. The call is executed just fine without parameters, but when I pass paramters of any type, the web service just recieves a null value. I tried everything possible but no luck so far. I hope someone can help, The client side code is:

public static boolean temp(){ try { SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME_TEMP);

           PopertyInfo p = new PropertyInfo();
           p.type = PropertyInfo.INTEGER_CLASS;
           p.setName("num");
           p.setValue(5);
           p.setNamespace(NAMESPACE);


           request.addProperty(p)  ;
   SoapSerializationEnvelope envelope = new SoapSerializationEnvelope

(SoapEnvelope.VER11 ); envelope.dotNet = true; envelope.encodingStyle = SoapSerializationEnvelope.ENC; envelope.setOutputSoapObject(request); AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport (URL); androidHttpTransport.call(SOAP_ACTION_TEMP, envelope); ....

A: 

I'm experiencing the same problem for the BlackBerry (j2ME + kSOAP2). Any luck solving this?

DAquilina
A: 

Just work fine for me in this way...

SoapObject requete = new SoapObject(NAMESPACE, METHOD_NAME);

PropertyInfo propertyInfo = new PropertyInfo();
propertyInfo.type = PropertyInfo.INTEGER_CLASS;
propertyInfo.name = "value";
requete.addProperty(propertyInfo, 2);

SoapSerializationEnvelope enveloppe = new SoapSerializationEnvelope(SoapEnvelope.VER11);
enveloppe.dotNet = true;
enveloppe.setOutputSoapObject(requete);

My Soap server is a WCF Service. Client is an android emulator using Ksoap..

tuxy42
A: 

If you have control over the webservice, try removing http:// from your namespace name in the webservice (and updating all your references in your java code). It's not a solution if it's not your own webservice that you're consuming (for that, you could try this workaround) but otherwise it seems to work fine.

Ryan