0

当我的网络服务是这样时,如何使用肥皂调用网络服务.. 我需要填写 cus 详细信息我该怎么做.. 任何人都可以指导我

<registerCustomer xmlns="http://webservices.foodtruck.zsl.com/">
  <cusDetails>
    <FirstName>string</FirstName>
    <LastName>string</LastName>
    <EmailID>string</EmailID>
    <AddLine1>string</AddLine1>
    <AddLine2>string</AddLine2>
    <ZipCode>string</ZipCode>
    <City>string</City>
    <StateCode>string</StateCode>
    <PhoneNumber>string</PhoneNumber>
    <Username>string</Username>
    <Password>string</Password>
    <BrandID>int</BrandID>
    <DiscAgree>int</DiscAgree>
    <Latitude>string</Latitude>
    <Longitude>string</Longitude>
  </cusDetails>
       </registerCustomer>
       </soap:Body>
     </soap:Envelope>

我用来调用服务的代码:final String METHOD_NAME = ServiceStrings.registerMethod; 最终字符串 SOAP_ACTION = ServiceStrings.registerSoapAction;尝试 {

        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
        PropertyInfo pi = new PropertyInfo();

        pi.setName("cusDetails");
        pi.setValue(new SoapObject(NAMESPACE, "cusDetails")
        .addProperty("FirstName", fname)
        .addProperty("LastName", lname)
        .addProperty("EmailID", email)
        .addProperty("AddLine1", add1)
        .addProperty("AddLine2", add2)
        .addProperty("ZipCode", zip)
        .addProperty("City", city)
        .addProperty("StateCode", state)
        .addProperty("PhoneNumber", phoneno)
        .addProperty("Username", email)
        .addProperty("Password", pwd)
        .addProperty("BrandID", 1)
        .addProperty("DiscAgree", 1)
        .addProperty("Latitude", "11.2")
        .addProperty("Longitude", "11.2"));

        request.addProperty(pi);

但我得到一个错误

Server was unable to read request. ---&gt; There is an error in XML document (1, 316). ---&gt; The specified type was not recognized: name='cusDetails', namespace='http://webservices.foodtruck.zsl.com/', at &lt;cusDetails xmlns='http://webservices.foodtruck.zsl.com/'&gt;
4

1 回答 1

0
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
        PropertyInfo pi = new PropertyInfo();
        pi.setName("cusDetails");
        pi.setValue(new SoapObject(NAMESPACE, "Customer")
                .addProperty("FirstName", fname)
                .addProperty("LastName", lname)
                .addProperty("EmailID", email)
                .addProperty("AddLine1", add1)
                .addProperty("AddLine2", add2).addProperty("ZipCode", zip)
                .addProperty("City", city).addProperty("StateCode", state)
                .addProperty("PhoneNumber", phoneno)
                .addProperty("Username", email)
                .addProperty("Password", pwd)
                .addProperty("BrandID", brandid)
                .addProperty("DiscAgree", flag)
                .addProperty("Latitude", "11.2")
                .addProperty("Longitude", "11.2"));

        request.addProperty(pi);
        Log.e("req", brandid);
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(request);
        AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(
                URL);
于 2012-06-06T10:57:18.763 回答