实际上,我用这段代码访问这个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();
}
我得到了正确的答复。我调试并检查了发送正确的body的值,作为响应,body in为空。
最佳答案
http status:500是一个内部服务器错误,它可能与您的.net服务器端编码有关。