Android SOAP wsdl
I'm trying to connect to a Webservice from SOAP. I developed the SOAP
Webservice in PHP and it's working fine (tried in Visual Studio).
First of all, this is the error:
09-27 06:28:07.724: E/AndroidRuntime(2057): FATAL EXCEPTION: main 09-27
06:28:07.724: E/AndroidRuntime(2057): java.lang.RuntimeException: Unable
to start activity
ComponentInfo{com.example.FirstExample/com.example.inforlider.CategoriesActivity}:
android.os.NetworkOnMainThreadException 09-27 06:28:07.724:
The full error you can view here: http://pastebin.com/cRQ66vrj
And this is my code in Java:
private final String NAMESPACE = "http://10.0.0.20/soap/test_wsdl";
private final String URL = "http://10.0.0.20/info_send/encode.php?wsdl";
private final String SOAP_ACTION =
"http://10.0.0.20/info_send/encode.php/select_data";
private final String METHOD_NAME = "select_data";
private String Webresponse = "";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive response;
response = (SoapPrimitive)envelope.getResponse();
Webresponse = response.toString();
} catch (SoapFault e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
}
Log.e("VALUE: ", Webresponse);
I've been following several tutorials, but none of them adapt to my needs.
So I'm trying to create a method which does what I want. Also, I added to
Manifest:
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET"/>
What Am I doing wrong? Thanks.
No comments:
Post a Comment