Hi, I tried to call a .NET web service from a sample application using
KSOAP2. I could successfully call a web service method without any
parameter. But, even if I set a valid value to a string
parameter, .NET service takes it as null. Let me give the code sample.

private static final String SOAP_ACTION = "http://www.webservicex.net/
GetGeoIP";
private static final String METHOD_NAME = "GetGeoIPResult";
private static final String NAMESPACE = "http://www.webserviceX.NET/";;
private static final String URL = "http://www.webservicex.net/
geoipservice.asmx";
private Object resultRequestSOAP = null;

.....................



                    SoapObject request = new SoapObject(NAMESPACE,
METHOD_NAME);


                    String ipVal = "10.0.0.15";

                    PropertyInfo p = new PropertyInfo();
                    p.name = "IPAddress";
                    //p.setType(PropertyInfo.STRING_CLASS);
                    p.setValue(ipVal);


                   request.addProperty(p);

                   SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
                   envelope.encodingStyle = SoapEnvelope.ENC;
                   envelope.dotNet = true;
                   envelope.setOutputSoapObject(request);


                   //envelope.implicitTypes = true;
                  // envelope.setAddAdornments(false);



                   HttpTransportSE androidHttpTransport = new
HttpTransportSE(URL);
                   androidHttpTransport.setXmlVersionTag("<?xml version=
\"1.0\" encoding=\"UTF-8\"?>");
                   try
                   {

                            androidHttpTransport.call(SOAP_ACTION, envelope);
                            //tv.setText("The Start");
                       resultRequestSOAP =
(Object)envelope.getResponse();
                       result = resultRequestSOAP.toString();


                   }
                   catch (Exception aE)
                   {
                           //tv.setText(aE.toString());
                       aE.printStackTrace ();;
                       result = aE.toString();
                  }

I have searched a lot of blogs and none of them have give a proper
solution better than what I have done. Would you please give me a
better solution for this?


Thanks & Regards
Shabu Thomas

-- 
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

Reply via email to