2011-03-08 137 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);