Unable to call SOAP webservice using KSOAP2

by Saravanan.K » Tue, 28 Apr 2009 16:47:49 GMT


Sponsored Links
 i All,


Please help me. Am trying to call a .net webservice from android.... I
have done the emualtor proxy settings and am able to access the
internet on the emulator .... but when i try to access the wsdl file
from my android program am unable to do it... please help me....

Here is the code which am using to call the webservice....


The wsdl just returns HelloWorld string with out accepting any input
parameters.



class WebServiceClient implements Runnable
{
private static final String SOAP_ACTION = "http://tempuri.org/
HelloWorld";
private static final String METHOD_NAME = "HelloWorld";
private static final String NAMESPACE = "http://microsoft.com/
webservices/";
private static final String URL = "http://xxxxxxxxxxxxxxx.com/
WebService/Service.asmx";

public void run() {
// TODO Auto-generated method stub

Log.i("RUN METHOD","Inside the run method");
connect();

Log.i("RUN METHOD","End of run method");

}

public void connect()
{
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

Log.i("CONNECT METHOD","Inside the connect method");

SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;

Log.i("CONNECT METHOD","Inside the connect method 2");


envelope.setOutputSoapObject(request);

Log.i("CONNECT METHOD","Inside the connect method 3");

HttpTransportSE androidHttpTransport = new HttpTransportSE
(URL);


Log.i("CONNECT METHOD","Inside the connect method 4");

try {

Log.i("CONNECT METHOD","Inside the connect method 5");

androidHttpTransport.call(SOAP_ACTION, envelope);
Log.i("CONNECT METHOD","Inside the connect method
55");
SoapObject resultsRequestSOAP = (SoapObject)
envelope.bodyIn;
Log.i("CONNECT METHOD","Inside the connect method
56");
// Vector XXXX = (Vector)
resultsRequestSOAP.getProperty("[Data element name]");



Log.i("CONNECT METHOD","Inside the connect method
6");

Object result = envelope.getResponse();
} catch(Exception E) {
Log.i("ERROR IS",E.toString());
}




}

}



I get an error in this line

androidHttpTransport.call(SOAP_ACTION, envelope);

I have also added the following attributes to the AndroidManifest.xml
file

<uses-permission android:name="android.permission.INTERNET"></uses-
permission>



I always get the following error.....

request time failed: java.net.SocketTimeoutException: The operation
timed out


While trying to access the wsdl file with the xml rpc client i was
able to connect to the wsdl file using the following lines

client = new DefaultHtt



Other Threads

1. Mirdak Yogya @ Starbucks

Wah mas, saya belum didaftar :(




-- 
"Indonesian Android Community [id-android]" 

2. Instantiating activities into a new task and process

I have an application with a multi-instance activity. I would like each
instance of the activity to appear in a *new* task and process.

Does anyone know how to do this? By manipulating the manifest I can
cause *all* instances of the activity to appear in a specific task and
process, but I haven't found any way to cause each instance to appear in
a *different* task and process.

(The requirement to have different tasks is that we want each instance
of the activity to appear separately in the task list; the requirement
for different processes is that each instance of the activity is backed
by a chunk of native code with global state. We can't change either of
these.)

-- 
€€  €€€€€ http://www.cowlark.com €€€€€
life  .^3 4=+/,1 0 1 0 1}
--- Conway's Game Of Life, in one line of APL

3. Issue: Hit EOS reading message length followed by Disconnected from 'rild' socket

4. How to use shared pref in different application.

5. IconPreferenceScreen that extends PreferenceScreen

6. AppBrain: Programmatic download & install of Market apps

7. Unable to find instrumentation info for...