如何从android发送请求parmater到.net webservice?

时间:2016-01-27 12:42:55

标签: android soap

向image中给定结构发送请求参数返回null response.So如何根据image中给出的结构发送请求参数和接收响应参数。请允许任何人帮我解决这个问题吗?

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("extTransactionId", "-99999");
request.addProperty("password", "Apiuser@123");
AttributeInfo ai = new AttributeInfo();
ai.name = "UserName";
ai.type = AttributeInfo.STRING_CLASS;
ai.setValue("sarvoday507");
request.addAttribute(ai);
request.addProperty("requestDate", "2015-02-24T06:38:00");
request.addProperty("systemId", "Apiuser");
request.addProperty("UAN", "");

1 个答案:

答案 0 :(得分:0)

创建主要请求SoapObject并为此添加“UserName”属性。创建“请求”SoapObject,将其余属性添加到此处,并将此“请求”SoapObject添加到主请求SoapObject

会是这样的,

    SoapObject request = new SoapObject(NAMESPACE, "GetCustomerDetail");
    request.addProperty("UserName", username);

    SoapObject requestInner = new SoapObject(NAMESPACE, "Request");
    requestInner.addProperty("requestDate", "2015-02-24T06:38:00");
    requestInner.addProperty("extTransactionId", "-99999");
    requestInner.addProperty("systemId", "Apiuser");
    requestInner.addProperty("password", "Apiuser@123");
    requestInner.addProperty("UAN", "");

    request.addSoapObject(requestInner);