android-Soap Throws java.io.IOException:HTTP请求失败,HTTP状态:500
作者:互联网
实际上,我使用此代码访问了此Web服务FahrenheitToCelsius方法,得到了正确的响应,但是当我尝试访问Web服务时却得到了
java.io.IOException: HTTP request failed, HTTP status: 500
错误,它指向transport.call(SOAP_ACTION,信封);
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为null.
解决方法:
HTTP状态:500是服务器内部错误,它可能与.NET服务器端编码有关.
标签:ksoap2,android,soap 来源: https://codeday.me/bug/20191011/1890142.html