GlobaLevel
asked on
android to consume a .net web service
I am using a few links to create a web service in my android....they make it sound like copy and paste code..but when I did that..I am getting all these errors...like:
1)Soap object cannot be resolved
2)envelope.setOutputSoapOb ject(reque st); >>>>UNDEFINED
3) Object result = (Object)envelope.getRespon se(); >>>>GETRESPONSE IS UNDEFINED
4) SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelo pe.VER11); >>>>CANNOT BE RESOLVED TO A VARAIBLE....
also how can I consume this into a dataset?
1)Soap object cannot be resolved
2)envelope.setOutputSoapOb
3) Object result = (Object)envelope.getRespon
4) SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
also how can I consume this into a dataset?
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.app.*;
import android.os.*;
import android.widget.TextView;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
public class COG_APP_12_10_2011Activity extends Activity {
/** Called when the activity is first created. */
private static final String SOAP_ACTION = "http://tempuri.org/HelloWorld";
private static final String METHOD_NAME = "HelloWorld";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://webxxxxx.com/COG_WS_AxxxxxxxxV3D9KLL.asmx";
TextView tv;
// ------------------------------------------------------------------
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tv=(TextView)findViewById(R.id.text1);
// CONSUME .NET WEB SERVICE
call();
// SETUP SPLASH PAGE....
setupSplash();
}
//--------------------------------------------------------------------
public void call()
{
try {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
// request.addProperty("passonString", "Rajapandian");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
Object result = (Object)envelope.getResponse();
tv.setText(result.toString());
} catch (Exception e) {
tv.setText(e.getMessage());
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Curious if there is any existing code...
ASKER