WebService服务 Windows 下 java httpPost调用正常,linux 下调用失败
WebService服务 Windows 下 java httpPost调用正常,linux 下调用失败 报500错
java.lang.RuntimeException: java.lang.RuntimeException: 500:Internal Server Error
StringBuffer sb = new StringBuffer();
sb.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">");
sb.append("<soapenv:Header/>");
sb.append("<soapenv:Body>");
sb.append("<tem:"+action+">");
sb.append("<tem:carrCd>JD</tem:carrCd>");
sb.append("<tem:isEncrypt>false</tem:isEncrypt>");
sb.append("<tem:guid>").append(guid).append("</tem:guid>");
sb.append("<tem:requestData>").append(msg).append("</tem:requestData>");
sb.append("</tem:"+action+">");
sb.append("</soapenv:Body>");
sb.append("</soapenv:Envelope>");
HttpClient client=new HttpClient();
PostMethod postMethod=new PostMethod(soapBindingAddress);
//3.设置请求参数
postMethod.setRequestBody(sb.toString());
// postMethod.setParameter("mobileCode", mobileCode);
// postMethod.setParameter("userID", userID);
//修改请求的头部
postMethod.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
//4.执行请求 ,结果码
int code=client.executeMethod(postMethod);
//5. 获取结果
String result ="";
if(code==200) {
result=postMethod.getResponseBodyAsString();
result=parseXml(new ByteArrayInputStream(result.getBytes()));
}
logger.info("httpPost code="+code+", "+result);