我从java函数调用soap服务,当我调用该服务时,它会出错:
HTTP/1.1 404 Not Found [Content-Type: text/html;charset=UTF-8, $WSEP: , Content-Language: en-US, Content-Length: 97, Connection: Close, Date: Tue, 12 May 2015 05:21:40 GMT, Server: WebSphere Application Server/7.0]
这是我的代码:
public String callWebService(String serviceURL, String Request) {
String strresponse = "";
try {
HttpPost httppost = new HttpPost(serviceURL);
StringEntity stringentity = new StringEntity(Request);
stringentity.setChunked(true);
httppost.setEntity(stringentity);
httppost.setEntity((HttpEntity) stringentity);
httppost.addHeader("Accept", "text/xml");
httppost.addHeader("SOAPAction", "");
httppost.setHeader("Content-Type", "text/xml;charset=UTF-8");
httppost.setHeader("METHOD", "POST");
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
strresponse = null;
if (entity != null) {
strresponse = EntityUtils.toString(entity);
}
} catch (Exception e) {
}
return strresponse;
}
原始响应如上所述。
来自strresponse = EntityUtils.toString(entity);
的回复是:Error 404: javax.servlet.ServletException: Filter [CRMInboundWSDLFilter]: filter is unavailable.
我做错了什么?
我正在调用的请求正在使用webservice Studio客户端处理相同的URL。
答案 0 :(得分:0)
我使用WSDL端点作为URL,这就是为什么它没有调用该服务。我通过输入工作室生成的URL来检查它,然后我调用它。它很成功。