android Soap引发java.io. IO异常:HTTP请求失败,HTTP状态:500

btxsgosb  于 2023-02-14  发布在  Android
关注(0)|答案(3)|浏览(194)

实际上,我使用此代码来访问此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为空。

oxcyiej7

oxcyiej71#

HTTP状态:500是一个内部服务器错误,它可能与您的.NET服务器端编码有关。

plicqrtu

plicqrtu2#

将VER10更改为VER11。SoapSerializationEnvelope信封=新的SoapSerializationEnvelope(SoapEnvelope.VER11)对我有效

lf3rwulv

lf3rwulv3#

我搜索了很多,但没有找到任何具体的解决方案。我解决了我的问题,下载新的服务器包(相同版本),并取代了以前的服务器包用新的。(关于Apache tomcat 7)

相关问题