1

这是服务方法

SOAPAction:“ http://tempuri.org/LogInUser

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <LogInUser xmlns="http://tempuri.org/">
      <us>
        <UserName>string</UserName>
        <Password>string</Password>
        <CityName>string</CityName>
        <DistrictOneName>string</DistrictOneName>
        <DistrictTwoName>string</DistrictTwoName>
        <DistrictThreeName>string</DistrictThreeName>
        <BloodType>string</BloodType>
        <Phone>string</Phone>
        <Name>string</Name>
        <Surname>string</Surname>
      </us>
    </LogInUser>
  </soap:Body>
</soap:Envelope>

这就是我在 android 中调用它的方式,但由于 IOException 和 HTTP 500 错误而失败,

        SoapObject request = new SoapObject(NAMESPACE, METHOD);
        SoapObject user = new SoapObject(NAMESPACE, "us");                         
        user.addProperty("UserName", us.UserName);
        user.addProperty("Password", us.Password);
        user.addProperty("CityName", "?");
        user.addProperty("DistrictOneName","?");
        user.addProperty("DistrictTwoName","?");
        user.addProperty("DistrictThreeName", "?");
        user.addProperty("BloodType", "?");
        user.addProperty("Phone", "?");
        user.addProperty("Name", "?");
        user.addProperty("Surname", "?");
        request.addSoapObject(user);

        Log.d(TAG, request.toString());

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(request);


        HttpTransportSE transport = new HttpTransportSE(URL);
        transport.call(SOAP_ACTION, envelope);

我在肥皂 ui 通话中做得很好。

4

1 回答 1

0

对象us应该是LogInUser类的实例,需要实现KVMSerializable

查看文档以获取详细说明。

于 2013-09-27T17:51:47.403 回答