实际上,我使用此代码访问此 Web 服务FahrenheitToCelsius 方法,得到了正确的响应,但是当我尝试访问我的 Web 服务时得到
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();
}
直到这里得到正确的回应。我调试并检查了正在发送正确的正文的值,作为对我的响应,bodyin 为空。