webservice soap发送请求报错问题
一直报 Server returned HTTP response code: 500 for URL: 错误
网页输入链接可以访问
网上找的 设置客户端的User Agent 也都设置了 就是 访问不了
请问下问题到底出来哪里。
下面是拼接部分的代码
String urlString = "http://10.72.0.173:9901/PubCaseForJJXT.asmx";
//方法
String soapActionString = "http://tempuri.org/ListCases";
URL url = new URL(urlString);
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
//拼接请求体
String soap = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
" <soap:Body>\n" +
" <ListCases xmlns=\"http://tempuri.org/\">\n" +
" <deptcode>String</deptcode>\n" +
" <starttime>String</starttime>\n" +
" <endtime>String</endtime>\n" +
" <type>int</type>\n" +
" </ListCases>\n" +
" </soap:Body>\n" +
"</soap:Envelope>";
byte[] buf = soap.getBytes();
//设置一些头参数
httpConn.setRequestProperty("Content-Length", String.valueOf(buf.length));
httpConn.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
httpConn.setRequestProperty("soapActionString", soapActionString);
httpConn.setRequestMethod("POST");
//输入参数和输出结果
httpConn.setDoOutput(true);
httpConn.setDoInput(true);
OutputStream out = httpConn.getOutputStream();
out.write(buf);
out.close();
报错为: java.io.IOException: Server returned HTTP response code: 500 for URL: http://10.72.0.173:9901/PubCaseForJJXT.asmx