Hi
I want to call a wcf service (.net) via android.I could set up the
connection between my application and the service but i still have
this excpetion "Cannot set method after connection" i tried to debug
it but i have that message telling me nthat he KSOAP2 jar has no
source attachement. My application stops working every time i call the
methode Call of the class AndroidHttpTransport. I have no idea how to
resolve this problem could you please help me.
Here is the code of my activity (android)
private static final String SOAP_ACTION = "http://
tempuri.org/IServiceEval/sayHello";
private static final String METHOD_NAME = "sayHello";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL="http://172.20.0.35:8732/
Design_Time_Addresses/GettingStarted/Service1/?wsdl";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
unButton=(Button) findViewById(R.id.my_button);
unButton.setOnClickListener(this);
tv = (TextView)findViewById(R.id.my_Text);
log=(EditText)findViewById(R.id.EditText01);
pass=(EditText)findViewById(R.id.EditText02);
}
public void onClick(View v) {
int id=1;
if(v==unButton)
{
try{
callWebService();
}
catch(XmlPullParserException xml){
xml.printStackTrace();
}
catch(IOException ex){
ex.printStackTrace();
}
}
}
public void callWebService() throws IOException,
XmlPullParserException{
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
com.example.android.AndroidHttpTransport androidHttpTransport
= new com.example.android.AndroidHttpTransport(URL);
// AndroidHttpTransport androidHttpTransport = new
AndroidHttpTransport(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
// resultRequestSoap = envelope.getResponse();
//Parse Response
SoapObject resultsRequestSOAP = (SoapObject)
envelope.getResponse(); //envelope.bodyIn;
//Return a String for view
tv.append(resultsRequestSOAP.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
Thanks.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en