Android : object is not getting passed with ksoap2

on Wednesday, October 8, 2014


I am trying to send the custom object to soap web service using ksoap2 library with below code.



SoapObject request = new SoapObject("http://pointsystem.ws.xx.com/", "doAnalysis");
Log.d("soapws","After rrequest");



AnalysisRequest analysisRequest = new AnalysisRequest();
analysisRequest.setAnalysis_Type("facebook");
analysisRequest.setUser_Identity("kppp");
PropertyInfo pi = new PropertyInfo();
pi.setName("analysisRequest");
pi.setValue(analysisRequest);
pi.setType(AnalysisRequest.class);
request.addProperty(pi);
//request.addProperty("analysisRequest", analysisRequest);

Log.d("Zumbare","After add property");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);


Log.d("Zumbare","After envelope");
//envelope.dotNet=true;
Log.d("zumbare", " request string :"+analysisRequest.toString());
Log.d("zumbare", "request obj :"+request.toString());
envelope.setOutputSoapObject(request);
Log.d("Zumbare","After setOutput");
HttpTransportSE androidHttpTransport = new HttpTransportSE("http://10.0.2.2:8080/xxPointSystemService/ServiceAPI?wsdl",300000);
Log.d("Zumbare","After android");
try {
Log.d("Zumbare","In try");

androidHttpTransport.call("http://pointsystem.ws.xx.com/doAnalysis", envelope);
Log.d("Zumbare","After call");
//envelope.bodyIn;
SoapObject response = (SoapObject)envelope.getResponse();
//AnalysisResponse response = (AnalysisResponse) envelope.getResponse();
//SoapObject response = (SoapObject)envelope.bodyIn;
Log.d("Zumbare","After getres");
Log.d("Zumbare",response.toString());
result=response.toString();

//tv.setText(response.toString());
} catch (Exception e) {

Log.d("zumbare","in exception");
Log.d("Zumbare",e.toString());
}


But at the server side, I am getting the object values as null though the webparam annotation is set.


Below is my web service interface code:



@WebService(name = "doAnalysis", targetNamespace = "http://pointsystem.ws.xx.com/")
@SOAPBinding(style = Style.RPC)
public interface PointSystemService {

@WebMethod
AnalysisResponse doAnalysis(@WebParam(name = "analysisRequest")AnalysisRequest analysisRequest);

}


I am able to fire the request successfuly to the same soap web service from soap UI tool.


So can you please help me what is wrong with android code.


0 comments:

Post a Comment