实际上我使用此代码访问此网络服务FahrenheitToCelsius方法,得到了正确的响应,但是当我尝试访问我的网络服务时得到
java.io.IOException:HTTP 请求失败,HTTP 状态:500
错误,它指向
transport.call(SOAP_ACTION, envelope);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
//Use this to add parameters
request.addProperty("username",usr);
request.addProperty("password",pass);
request.addProperty("backOfficePartnerId",id);
//Declare the version of the SOAP request
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER10);
envelope.setOutputSoapObject(request);
envelope.dotNet = true;
try {
HttpTransportSE transport = new HttpTransportSE(URL);
Log.i("bodyout", "" + envelope.bodyOut.toString());
transport.call(SOAP_ACTION, envelope);
// Get the SoapResult from the envelope body.
SoapObject result = (SoapObject)envelope.bodyIn;
System.out.println("result IN F TO C::"+result);
}catch(Exception e){
e.printStackTrace();
}
直到这里我才得到正确的答复。我调试并检查了发送正文的值是否正确,并且对我来说,正文为空。
HTTP Status: 500 是一个内部服务器错误,它可能与您的 .NET 服务器端编码有关。
将 VER10 更改为 VER11。 SoapSerializationEnvelope 信封 = new SoapSerializationEnvelope(SoapEnvelope.VER11) 为我工作
我搜索了很多,但找不到任何具体的解决方案。 我通过下载新的服务器包(相同版本)并用新的服务器包替换了以前的服务器包解决了我的问题。(关于 Apache tomcat 7)