Android调用带有多个对象参数的SOAP服务返回SocketTimeoutException

时间:2017-06-07 06:38:00

标签: android web-services android-ksoap2

我需要在根目录中调用一个包含2个对象的soap Web服务 xml是

<FirstMethodName xmlns="http://blabla/">
  <Ticket>
    <ObjectTwo>
      <FirstName>string</FirstName>
      <MiddleName>string</MiddleName>
      <LastName>string</LastName>
      <EmailAddress>string</EmailAddress>
      <ContactNumber>string</ContactNumber>
      <CustomerType>Individual or Corporate</CustomerType>
      <CustomerIdType>QID or Passport</CustomerIdType>
      <CustomerId>string</CustomerId>
      <IsSpecialNeedsCustomer>boolean</IsSpecialNeedsCustomer>
      <SpecialNeedsRegistrationNumber>string</SpecialNeedsRegistrationNumber>
    </ObjectTwo>
    <TicketType>Inquiry or Complaint</TicketType>
 </Ticket>

以下是我的称呼方式,

    final String METHOD_NAME = "CreateTicket";
    final String NAMESPACE = "http://blabla/";
    final String SOAP_ACTION = NAMESPACE + METHOD_NAME;
    final String URL = MyApplication.link;
    SoapObject request1 = new SoapObject(NAMESPACE, METHOD_NAME);


    SoapObject customer = new SoapObject(NAMESPACE, "ObjectTwo");
    customer.addProperty("FirstName", "test");
    customer.addProperty("MiddleName", "test");
    customer.addProperty("LastName", "test");
    customer.addProperty("EmailAddress", "test");
    customer.addProperty("ContactNumber", "test");
    customer.addProperty("CustomerType", "Individual");
    customer.addProperty("CustomerIdType", "Passport");
    customer.addProperty("CustomerId", "98765456781");
    customer.addProperty("IsSpecialNeedsCustomer", false);
    customer.addProperty("SpecialNeedsRegistrationNumber", "");

    SoapObject request = new SoapObject(NAMESPACE, "Ticket");
    request.addProperty("Customer", customer);
    request.addProperty("TicketType", tickettype);

问题是它返回SocketTimeoutException,我认为问题出在ObjectTwo标记的命名空间中。

0 个答案:

没有答案