public static final String NAMESPACE = "http://tempuri.org/";
public static String GetColor(Context c) throws IOException,
XmlPullParserException {
String METHOD_NAME = "GetColor";
String SOAP_ACTION = "http://tempuri.org/youruri name/";
SOAP_ACTION = SOAP_ACTION + METHOD_NAME;
SoapObject request = new SoapObject(NAMESPACE,
METHOD_NAME);
// Use this to add parameters
// Declare the version of the SOAP request
return WebCalls.call(c, request, .NAMESPACE, METHOD_NAME,
SOAP_ACTION);
}
public static String call(Context c, SoapObject request, String NAMESPACE,
String METHOD_NAME, String SOAP_ACTION) throws IOException,
XmlPullParserException {
Log.i(WebCalls, "URL " + your URL);
Log.i(WebCalls, "Method Name " + METHOD_NAME);
Log.i(WebCalls, "request Name " + request);
String SoapResult = null;
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.dotNet = true;
HttpTransportSE androidHttpTransport = new HttpTransportSE(
CommonVariable.URL);
// this is the actual part that will call the webservice
androidHttpTransport.call(SOAP_ACTION, envelope);
// Get the SoapResult from the envelope body.
if (envelope.bodyIn instanceof SoapFault) {
SoapResult = ((SoapFault) envelope.bodyIn).faultstring;
} else {
SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
SoapResult = resultsRequestSOAP.getProperty(0).toString();
}
Log.i(WebCalls, "Response " + SoapResult);
return SoapResult;
}
i hope this is useful method too you...if any query then tell me..this code have implemented in my current project.now its working fine.