【问题标题】:Complex SOAP Request复杂的 SOAP 请求
【发布时间】:2011-03-08 06:21:52
【问题描述】:

我的要求如下...

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

谢谢。

【问题讨论】:

  • 在 ksoap2 中使用 SoapObject.addProperty.("name of object",value (may be string or array of String))
  • 尝试了同样的方法.. 不工作!!!

标签: android soap ksoap2 ksoap android-ksoap2


【解决方案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);

【讨论】:

    【解决方案2】:

    我将完整的 xml 作为字节数组传递给输出流,而不是转换 SOAP 信封,它起作用了!!!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-30
      • 1970-01-01
      • 2015-09-16
      • 2023-04-06
      • 2019-02-08
      相关资源
      最近更新 更多