Android ksoap2 addProperty

时间:2015-08-10 10:45:30

标签: android ksoap2

完整的代码

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();

请求

  <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>

我已经知道第一个属性是&#34; arg0&#34;,第二个属性是&#34; arg1&#34;

但我想知道&#34; generalItemId&#34;的属性是什么?和&#34;设置&#34;。 因为我输入

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

这不行,有人知道解决方案吗?

0 个答案:

没有答案