java - Problems making a soap request -


i'm trying make request soap api, using ksoap2 library version 3.6.2.

the problem i'm getting error message:

"soapfault - faultcode: 'soap:server' faultstring: 'server unable process request. ---> object reference not set instance of object.' faultactor: 'null' detail: org.kxml2.kdom.node@338a49b".

my code looks this:

string namespace = "x"; string method_name = "x"; string soap_action = "x"; string url = "x";  soapobject request = new soapobject(namespace, method_name);  request.addproperty("username", "x"); request.addproperty("password", "x");  //request.addproperty("token","token","?");  log.i("soap: ", request.tostring());  soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11); envelope.dotnet = true; envelope.implicittypes = false; envelope.setoutputsoapobject(request);   httpstransportse aht = new httpstransportse("x", 8900, "x", 50000); aht.debug = true;  // make call try {      aht.call(soap_action, envelope);     soapobject result = (soapobject) envelope.getresponse();      log.i("resp:", aht.responsedump.tostring());     log.i("response: ", result.tostring());  } catch (ioexception e) {     e.printstacktrace(); } catch (xmlpullparserexception e) {     e.printstacktrace(); } 

i think problem takes 1 more property, 1 commented out in code.

how can add property attribute? this: <token token="">, because think i'm missing response back.

i tested postman, works great, when have these 3 properties (username, password , token).

you can use addattribute method add attributes properties.

try code,

request.addproperty("username", "x"); request.addproperty("password", "x");  soapobject token = new soapobject(namespace, "token"); token.addattribute("token", "your_token"); request.addsoapobject(token); 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -