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);
uj5u.com熱心網友回復:
把詳細日志也輸出出來看轉載請註明出處,本文鏈接:https://www.uj5u.com/net/114927.html
標籤:Web Services
上一篇:求推薦
