Just put the Soap.jar file in the lib folder of your application..........
public static String getResponse(String namespace, String url, String soapAction, String methodName, String requestString,Context context) {
String response = null;
SoapObject request = new SoapObject(namespace, methodName);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
//you can add multiple parameters with the help of addProperty
request.addProperty("xmlString", requestString);
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(url);
androidHttpTransport.debug = true;
try {
Log.e("Sending Request", requestString);
androidHttpTransport.call(soapAction, envelope);
Object soapResponse = envelope.getResponse();
if(soapResponse!=null){
response = soapResponse.toString();}
else{
response="";}
Log.e("Getting Response", response);
} catch (IOException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
return response;
}
public static String getResponse(String namespace, String url, String soapAction, String methodName, String requestString,Context context) {
String response = null;
SoapObject request = new SoapObject(namespace, methodName);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
//you can add multiple parameters with the help of addProperty
request.addProperty("xmlString", requestString);
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(url);
androidHttpTransport.debug = true;
try {
Log.e("Sending Request", requestString);
androidHttpTransport.call(soapAction, envelope);
Object soapResponse = envelope.getResponse();
if(soapResponse!=null){
response = soapResponse.toString();}
else{
response="";}
Log.e("Getting Response", response);
} catch (IOException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
return response;
}
No comments:
Post a Comment