相关疑难解决方法(0)

如何在android中发送soap请求?

我是WSDL webservices的新手,使用KSoap2库在android中调用wsdl webservices.

这是我的soap请求转储

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:loy="http://loyalcard.com/LoyalCardWebService/">;
   <soapenv:Header/>
   <soapenv:Body>
      <loy:GetOffersByLocation>
         <!--Optional:-->
         <loy:Location>
            <!--Optional:-->
            <loy:Latitude>?</loy:Latitude>
            <!--Optional:-->
            <loy:Longitude>?</loy:Longitude>
         </loy:Location>
      </loy:GetOffersByLocation>
   </soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)

我正在传递这个SopaObject,如:

 PropertyInfo latitude = new PropertyInfo();
        latitude.name="Latitude";
        latitude.type=Double.class;
        latitude.setValue(32.806673);

   PropertyInfo longitude = new PropertyInfo();
        longitude.name="Longitude";
        longitude.type=Double.class;
        longitude.setValue(-86.791133);

        SoapObject results = null;
        String methodName = "OffersByLocation";
        String actionName = "http://loyalcard.com/LoyalCardWebService/GetOffersByLocation";
        SoapObject request = new SoapObject(NAMESPACE,methodName);

        request.addProperty(latitude);
        request.addProperty(longitude);
Run Code Online (Sandbox Code Playgroud)

这里将纬度和经度值直接传递给OffersByLocation,我应该通过元素Location.请任何人都可以帮助如何通过位置传递参数.

我已尝试过以上程序,但我得到错误说

06-17 11:52:55.934: WARN/System.err(350): SoapFault - faultcode: 'soapenv:Server' faultstring: 'org.apache.axis2.databinding.ADBException: Unexpected subelement Latitude' faultactor: 'null' detail: org.kxml2.kdom.Node@44f6ddc0
Run Code Online (Sandbox Code Playgroud)

请任何人告诉我如何在Soap对象中传递上面的SOAP Request转储?

此致,Srinivas

android android-ksoap2

5
推荐指数
1
解决办法
1万
查看次数

将ArrayList数据传递到android中的SOAP Web服务

您好,我需要将Array-list数据传递给soap Web服务.到目前为止,我有以下代码.

    public class ResultActivity extends Activity {
    public final String NAMESPACE = "";
    public final String URL = "";
    public final String SOAP_ACTION_1 = "";
    public final String METHOD_NAME_1 = "";

    ProgressDialog mProgressDialog;
    SoapObject mSoapObjectCompanyDetailResponse;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.result);

        System.out.println("Size In resxusr " + OnLineApplication.mParserResults.size());
        for (int i = 0; i < OnLineApplication.mParserResults.size(); i++) {

            System.out.println("ID " + OnLineApplication.mParserResults.get(i).getCompanyId());
            System.out.println("Q " + OnLineApplication.mParserResults.get(i).getQuestion());
            System.out.println("A " + OnLineApplication.mParserResults.get(i).getAnswer());
        }

        new insertResult().execute(); …
Run Code Online (Sandbox Code Playgroud)

android soap web-services

5
推荐指数
1
解决办法
5564
查看次数

标签 统计

android ×2

android-ksoap2 ×1

soap ×1

web-services ×1