2011-03-08 139 views
1

我的要求如下...复杂的SOAP请求

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <Search> 
     <specialties> 
      <!--Zero or more repetitions:--> 
      <arr:int>1</arr:int> 
      <arr:int>2</arr:int> 
      <arr:int>3</arr:int> 
     </specialties>      
     <gender> 
      <!--Zero or more repetitions:--> 
      <arr:string>male</arr:string> 
      <arr:string>female</arr:string> 
     </gender>    
     </Search> 
    </soapenv:Body> 
</soapenv:Envelope> 

如何通过与Android的SOAP请求一样的...

感谢。

+0

使用'SoapObject.addProperty。(“对象名称”,值(可能是字符串的字符串或数组))'在ksoap2。 – 2011-03-08 06:26:33

+0

尝试相同..不工作! – 2011-03-08 06:32:12

回答

0

我将完整的xml作为字节数组传递给输出流,而不是转换SOAP信封并且它工作正常!

1

尝试这种方式将帮助ü

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 
     SoapObject Search= new SoapObject(NAMESPACE, "Search"); 
     for(int i=0;i<mID.length & i<qty.length;i++){ 
      SoapObject Specialities= new SoapObject("http://www.FoodTruck.zsl.com/", "Specialities"); 
      Specialities.addProperty("MenuItemID", mID[i]); 
      Specialities.addProperty("Quantity",1); 
      Specialities.addProperty("CartItems", CartItems); 
     } 
     request.addProperty("Search", Search);