Soap抛出java.io.IOException:HTTP请求失败,HTTP状态:500

时间:2013-04-04 11:05:30

标签: android soap ksoap2

实际上我使用此代码访问此网络服务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();
}

到此为止得到了正确答案。我发现并检查了正在发送身体的值是正确的,并且对我的反应是bodyin为空。

3 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

将VER10更改为VER11。 SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope。 VER11 )为我工作

答案 2 :(得分:0)

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