Android ksoap2 addProperty

2019-06-13 19:34发布

问题:

The complete code

try {

            SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

            request.addProperty("arg0", "admin");
            request.addProperty("arg1", "3");
            request.addProperty("arg2", "ABC");
            request.addProperty("generalItemId", "342");
            request.addProperty("sets", "1");

            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
            envelope.setOutputSoapObject(request);  

            HttpTransportSE httpTransport = new HttpTransportSE(URL);

            httpTransport.debug = true;  

            httpTransport.call(SOAP_ACTION, envelope);

            try {
                result = (SoapObject)envelope.getResponse();
            } catch (SoapFault e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } 
            Log.d("App",""+result.getProperty(1).toString());
            response = result.getProperty(1).toString();

The request

  <soapenv:Header/>
   <soapenv:Body>
      <ser:requestForSwatch>
         <!-- Login Name -->
         <arg0>admin</arg0>
         <arg1>3</arg1>
         <!-- Remarks -->
         <arg2>ABC</arg2>
         <!--Optional:-->
         <arg3>
           <item>
               <!--Optional:-->
               <generalItemId>342</generalItemId>
               <!--Optional:-->
               <sets>1</sets>
            </item>
         </arg3>
      </ser:requestForSwatch>
   </soapenv:Body>
</soapenv:Envelope>

I already know the first property is "arg0", and the second is "arg1" .

But i want to know what is the property of "generalItemId" and "sets". Because i input

request.addProperty("generalItemId", "342");

It is not work, does anyone know the solution?