java - Android : how to send array as parameter in wsdl request -


I want to send a data php web service from the Android application, the web service receives this argument: < Pre> type name description string session ID session ID array client customer data to create aer customer customer interval

I use the ksoap2 library, in this code I session Pass ID but I do not know the parameter wsdl request

  env = new sabu Oscillation Anaph (Sophonffe. Over 11); Env.dotNet = false; Env.xsd = Soap Certification Envelope.XSD; Env.enc = Soap Certification Envelope.NCC; SOAP object request = new SOAP object (NAMESPACE, "createCustomer"); Request.addProperty ("sessionId", "1234567890"); env.setOutputSoapObject (requested); AndroidHttpTransport = New HTTP TransportS (URL); androidHttpTransport.debug = True; // (new martial hashtable ()). Register (NV); AndroidHttpTransport.call ("", NV); Results = env.getResponse (); Log D. ("Result", result. To string ()); I found this php example to use a web service with php code:  
  $ client = new SOAP client ('http: // magentohost / api / v2_soap? / wsdl '); $ Session = $ client- & gt; Login ('APIUser', 'APKY'); $ Result = $ client- & gt; Customer Create Customer Custom ($ session, array ('email' = & gt; 'customer-mail@example.org', 'firstname' = & gt; 'dough', 'last name' = & gt; 'deck' 'Password' = & gt; 'password', 'website_id' => 1, 'store_id' = & gt; 1, 'group_id' => 1)); Var_dump ($ result);   

How can I do this with Java? Thanks

step 1 : no direct to send array in ksoap or ksoap2 Not supported. So you can create a soap object with the method name (which you need to create an array)

  SOAP object object = new SOAP object (NAMESPACE, "ShoppingCartProductEntity"); Object.addProperty ("product_id", "886"); Object.addProperty ("sku", "ABC 456-Black-10"); More parameters .....   

Step 2 : Then create the arrayType method (optional depending on your WSDL) and this soap object is assigned to that array object Add property as

  SOAP object EntityArray = new SOAP object (NAMESPACE, "ShoppingCartPrint Entry"); EntityArray.addProperty ("product", object);   

Step 3 : Finally add an array to your main soap call

  SOAP object request = new SOAP object (NAMESPACE, "ShoppingCartProductAdd"); Request.addProperty ("sessionId", session ID); Request.addProperty ("quotIId", Cart ID); Request.addProperty ("Products", EntityArray); / / //////////////////> androidHttpTransport.call (NAMESPACE + "/ ShoppingCartProductAd", NV); Results = env.getResponse ();  Note:  The phase depends on your WSDL, sometimes you can add 1 step object as a straight parameter, depending on the WSDL.   

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -