1

我发现了很多关于这个例外的讨论,但没有一个可以帮助我。

我在 .NET 中有一个简单的 Web 服务,它返回一个没有任何参数的字符串。我已经用另一个 .NET 应用程序尝试过它,它工作正常。

我正在尝试使用 ksoap2 拨打电话但没有成功。这是我调用 Web 服务的类:

private final String NAMESPACE = "http://tempuri.org/";
private final String URL = "http://192.168.0.106:80/WebService1.asmx?wsdl";
private final String SOAP_ACTION = "http://tempuri.org/HelloWorld";
private final String METHOD_NAME = "HelloWorld";

public String Call()
{
    SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);

          MarshalBase64 mbase = new MarshalBase64();
  SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER10);
  envelope.bodyOut = request;
  envelope.encodingStyle = SoapSerializationEnvelope.ENC;
  envelope.dotNet = true;
  envelope.implicitTypes = false;
  envelope.setOutputSoapObject(request);
  HttpTransportSE httpTransport = new HttpTransportSE(URL);
  mbase.register(envelope);
  Object response=null;

  try
  {
  httpTransport.debug=true;
  httpTransport.call(SOAP_ACTION, envelope);


  response = envelope.getResponse();
  }

异常被抛出httpTransport.call(SOAP_ACTION, envelope);

任何建议我做错了什么?

4

1 回答 1

-1

尝试:

private final String NAMESPACE = "http://www.tempuri.org/";
private final String SOAP_ACTION = "http://www.tempuri.org/HelloWorld";

代替:

private final String NAMESPACE = "http://tempuri.org/";
private final String SOAP_ACTION = "http://tempuri.org/HelloWorld";
于 2013-11-26T04:40:29.310 回答