thanks for your attention.
I have a problem on using ksoap2 to call a webservice via android.
I have some function to call a webservice.
public String CallWebServiceFunction()
{
String WSDL_TARGET_NAMESPACE = "http://MyWeb.com/";
String SOAP_ADDRESS = "http://MyWeb.com/pvws.asmx";
String SOAP_ACTION = "http://MyWeb.com/SoapAction";
String OPERATION_NAME = "SoapAction";
SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);
PropertyInfo prop1 = new PropertyInfo();
prop1.setName("prop1");
prop1.setValue("1");
request.addProperty(prop1);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
Object response=null;
try
{
httpTransport.call(SOAP_ACTION, envelope);
response = envelope.getResponse();
}
catch (Exception exception)
{
response=exception.toString();
}
return response.toString();
}
When I use emulator (or real device), which using API 16 or above (Android 4.x) - everything is OK, function gets correct response from webservice. But when I use emulator (or real device) with API 7 (Android 2.x) - then I get an exception
"java.net.UnknownHostException: Host is unresolved: MyWeb.com:80"
I use the same code in both cases, trying one after another - and I get different results
Did anybody has any ideas?
UPD1: Permission section from my manifest is
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
UPD2: Hypothesis. Initially I created my app for targetSdkVersion=16. Therefore I use multi-threaded code, when I call webservice via Internet. Maybe, when it works with API7, source code shouldn't be multi-threaded?
UPD3: Hypothesis was wrong. Calling webservice from main thread causes the same exception.
But I noticed, that when I run my project on another computer - it works correctly. Despite I use the same code.