Android ksoap2-始终缺少请求参数

Android ksoap2-始终缺少请求参数,android,ksoap2,Android,Ksoap2,我有一个ASP.Net Web服务,它可以从iPhone SOAP代码或另一个.Net客户端完美地调用。但是,当我尝试使用Ksoap2时,没有设置传递给服务的参数。在服务中,参数AuthenticationID不能输入,因为WebMethod要做的第一件事是检查字符串是否为null或空,并返回AuthenticationFailure响应。我确实得到了响应,所以我知道SOAP的东西很好,只是没有传递参数 public SoapObject soap(String METHOD_NAME, Str

我有一个ASP.Net Web服务,它可以从iPhone SOAP代码或另一个.Net客户端完美地调用。但是,当我尝试使用Ksoap2时,没有设置传递给服务的参数。在服务中,参数AuthenticationID不能输入,因为WebMethod要做的第一件事是检查字符串是否为null或空,并返回AuthenticationFailure响应。我确实得到了响应,所以我知道SOAP的东西很好,只是没有传递参数

public SoapObject soap(String METHOD_NAME, String SOAP_ACTION, String NAMESPACE, String URL) throws IOException, XmlPullParserException {
      SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 
      request.addProperty("AuthenticationID", "5");       
      SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
      envelope.dotNet = true;
      envelope.setOutputSoapObject(request);  
      HttpTransportSE httpTransport = new HttpTransportSE(URL);  
      httpTransport.debug = true;  
      httpTransport.call(SOAP_ACTION, envelope); 
      SoapObject result=(SoapObject)envelope.getResponse(); 
      return result;
  }
WSDL如下所示:

<?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>
        <LookupStores xmlns="http://blah.com/Services/">
          <AuthenticationID>string</AuthenticationID>
          <NameMatch>string</NameMatch>
        </LookupStores>
      </soap:Body>
    </soap:Envelope>
请给我一些东西来尝试这只是一个简单的服务,我想使用KSoap2会很容易。
谢谢

我遇到了类似的问题,并通过使用PropertyInfo成功地传递了我的参数。试试下面的代码,没有花花公子它会工作,但值得一试

public SoapObject soap(String METHOD_NAME, String SOAP_ACTION, String NAMESPACE, String URL) throws IOException, XmlPullParserException 
{
    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 
    PropertyInfo pi = new PropertyInfo();
    pi.setName("int"); //change to appropriate type e.g. String
    pi.setValue(5); // if sString add the speech marks e.g. "5"
    pi.setType("AuthenticationID".getClass());                  
    request.addProperty(pi);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);  
    HttpTransportSE httpTransport = new HttpTransportSE(URL);  
    httpTransport.debug = true;  
    httpTransport.call(SOAP_ACTION, envelope); 
    SoapObject result=(SoapObject)envelope.getResponse(); 
    return result;
}  

希望这能有所帮助。

您需要检查的第一件事是Web服务和Android应用程序中的名称空间字符串是否完全相同