lundi 17 novembre 2014

Exception multiple task in one line.Error calling soap service


Vote count:

0




While calling this webservice class i am getting excepton while invoking it like java ip exception kindly help me with this code or send me link for correct webservice code for android. public class WebserviceCall {



/**
* Variable Decleration................
*
*/
String namespace = "http://tempuri.org/";
private String url = "http://ift.tt/1EQzv1F";
private final String METHOD_NAME = "getSum";

String SOAP_ACTION;
SoapObject request = null, objMessages = null;
SoapSerializationEnvelope envelope;
AndroidHttpTransport androidHttpTransport;

WebserviceCall() {
}


/**
* Set Envelope
*/
protected void SetEnvelope() {

try {

// Creating SOAP envelope
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

//You can comment that line if your web service is not .NET one.
envelope.dotNet = true;

envelope.setOutputSoapObject(request);
androidHttpTransport = new AndroidHttpTransport(url);
androidHttpTransport.debug = true;

} catch (Exception e) {
System.out.println("Soap Exception---->>>" + e.toString());
}
}

// MethodName variable is define for which webservice function will call
public String getSum(String MethodName, int first, int second)
{
// first=5;
// second=5;

try {
SOAP_ACTION = namespace + MethodName;

//Adding values to request object
request = new SoapObject(namespace, MethodName);

//Adding Double value to request object
// PropertyInfo weightProp =new PropertyInfo();
// weightProp.setName("Weight");
// weightProp.setValue(weight);
// weightProp.setType(double.class);
// request.addProperty(weightProp);

//Adding String value to request object
request.addProperty("i", "" + first);
request.addProperty("j", "" + second);

SetEnvelope();

try {

//SOAP calling webservice
androidHttpTransport.call(SOAP_ACTION, envelope);

//Got Webservice response
String result = envelope.getResponse().toString();

return result;

} catch (Exception e) {
Log.d("server", "error");
// TODO: handle exception
return e.toString();
}
} catch (Exception e) {
// TODO: handle exception

Log.d("client", "error");
return e.toString();
}

}


/************************************/
}


asked 30 secs ago







Exception multiple task in one line.Error calling soap service

Aucun commentaire:

Enregistrer un commentaire