I have created java activity.. like below... But my code doesn't work package com.web.ws; import java.io.IOException; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.PropertyInfo; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; import org.ksoap2.serialization.SoapPrimitive; import org.xmlpull.v1.XmlPullParserException; public class WSActivity extends Activity { /** Called when the activity is first created. */ private static final String SOAP_ACTION = "http://tempuri.org/GetDepCode"; private static final String METHOD_NAME = "GetDepCode"; private static final String NAMESPACE = "http://tempuri.org/"; private static final String URL = "http://localhost:100/Service.asmx"; TextView tv; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); tv=(TextView)findViewById(R.id.tv); SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); PropertyInfo pi = new PropertyInfo(); pi.setName("QCode"); pi.setValue("0473"); pi.setType(PropertyInfo.INTEGER_CLASS); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); //envelope.dotNet = true; envelope.setOutputSoapObject(request); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); androidHttpTransport.debug = true; try { androidHttpTransport.call(SOAP_ACTION, envelope); SoapPrimitive sp=SoapPrimitive)envelope.getResponse(); tv.setText("Value:"+sp); } catch (IOException e) {e.printStackTrace(); } catch (XmlPullParserException e) {e.printStackTrace();} } } and Manifest <manifest xmlns:android="http://schemas.android.com/apk/res/android"> package="com.web.ws" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minsdkversion="15" /> <uses-permission android:name="android.permission.INTERNET" /> <application> android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity> android:name=".WSActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
private static final String URL = "http://localhost:100/Service.asmx";
private static final String URL = "http://10.0.2.2:100/Service.asmx";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)