satellitemundo
Newbie
Hi friends,
I want to sent a SOAP request with some parameter. So basically it is a post request. I am able to fire simple get reuest with no reuest parameter. But now I want to pass some reuest parameter.
Following is some code which I have tried.
Above is taking parameter authorId. Now how to pass it in java call
Below is my java call
I am not sure I am doing right thing using hash table or not. I tried addProperty and addAttribute methods also. But they all did not gave me favorable results. Please help.
I want to sent a SOAP request with some parameter. So basically it is a post request. I am able to fire simple get reuest with no reuest parameter. But now I want to pass some reuest parameter.
Following is some code which I have tried.
Java:
private static String SOAP_ACTION = "http://tempuri.org/GetBookby_Author";
private static String NAMESPACE = "http://tempuri.org/";
private static String METHOD_NAME = "GetBookby_Author";
private static String URL = "http://xyzsite.xyzsite.com/webservice/mobilesync.asmx";
Above is taking parameter authorId. Now how to pass it in java call
Below is my java call
Java:
SoapObject request=new SoapObject(NAMESPACE, METHOD_NAME);
Hashtable<String, String> table=new Hashtable<String, String>();
table.put("AuthorID", ""+2);
SoapSerializationEnvelope envelop=new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelop.properties=table;
envelop.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport=new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelop);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (XmlPullParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
SoapObject result=null;
try {
result = (SoapObject)envelop.getResponse();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
I am not sure I am doing right thing using hash table or not. I tried addProperty and addAttribute methods also. But they all did not gave me favorable results. Please help.