我发现了很多这种例外情况,但没有一个可以帮助我。
我在.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);
任何建议我做错了什么?
答案 0 :(得分:-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";