erkandoner
Lurker
Hi!
I'we written a simple Android java application consuming an ASP.NET web service. But it throws the error message "java.net.ConnectException: localhost/127.0.0.1:8080 - Connection refused" when doing
androidHttpTransport.call(SOAP_ACTION, envelope). Can this error be related to the Network Connections configuration in Eclipse, or any IIS configuration? Here's the code:
(By the way, IIS is runnig, I can reach http://localhost:8080/erkService.asmx and make request, get response wtih internet browser. Get message returns ony a string without taking any input parameter)
package
I'we written a simple Android java application consuming an ASP.NET web service. But it throws the error message "java.net.ConnectException: localhost/127.0.0.1:8080 - Connection refused" when doing
androidHttpTransport.call(SOAP_ACTION, envelope). Can this error be related to the Network Connections configuration in Eclipse, or any IIS configuration? Here's the code:
(By the way, IIS is runnig, I can reach http://localhost:8080/erkService.asmx and make request, get response wtih internet browser. Get message returns ony a string without taking any input parameter)
package
com.wsImpl;
import
org.ksoap2.SoapEnvelope;
import
org.ksoap2.serialization.SoapObject;
import
org.ksoap2.serialization.SoapSerializationEnvelope;
import
org.ksoap2.transport.HttpTransportSE;
import
android.app.Activity;
import
android.os.Bundle;
import
android.widget.ArrayAdapter;
import
android.widget.AutoCompleteTextView;
public
class ErkActivity extends Activity {
privatestaticfinal String NAMESPACE = "http://artisinerji.com/";
privatestaticfinal String URL = "http://localhost:8080/erkService.asmx?wsdl";
privatestaticfinal String URL = "http://localhost:8080/erkService.asmx?wsdl";
privatestaticfinal String SOAP_ACTION = "http://artisinerji.com/GetMessage";
privatestaticfinal String METHOD_NAME = "GetMessage";
@Override
publicvoid onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
publicvoid onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
envelope.setAddAdornments(false);
HttpTransportSE androidHttpTransport =
new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject response = (SoapObject) envelope.
bodyIn;
String result = response.toString();
} catch (Exception e) {
e.printStackTrace();
}
e.printStackTrace();
}
}
}
