[英]What's the difference between using SoapUI and java code?
我正在使用肥皂从服务器请求一些信息。 因此,为了测试我的soap方式是否正确,我测试了soapUI Pro 4.6.3程序和Java代码。
当我使用soapUI程序时,我从服务器获得了请求的响应。 但是,当我使用Java代码时,无法从服务器获得请求的响应。我可以看到错误代码500。据我所知,500错误代码是Internal Error。 那么这不是服务器问题吗?
我想知道它们之间有什么区别。
我的Java代码在下面..并且XML代码与SoapUI程序使用的Java代码相同。
HttpClient client = new HttpClient();
PostMethod method = new PostMethod("My URL");
int status = 0;
String result = "";
try {
method.setRequestBody(MySoapXML);
method.getParams().setParameter("http.socket.timeout", new Integer(5000));
method.getParams().setParameter("http.protocol.content-charset", "UTF-8");
method.getParams().setParameter("SOAPAction", "My Soap Action URL");
method.getParams().setParameter("Content-Type", MySoapXML.length());
status = client.executeMethod(method);
BufferedReader br = new BufferedReader(new InputStreamReader(method.getResponseBodyAsStream()));
String readLine;
while ((readLine=br.readLine())!=null) {
System.out.println(readLine);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
method.releaseConnection();
}
并且我已经做了URLConnection类和HttpClient类。但是结果是一样的。
如果您知道解决此问题的方法或与我有相同的经验。 请让我知道如何解决此问题。.感谢您阅读^ _ ^
肥皂-用户界面将解析定义不明确的Web服务(例如,定义欠佳的WSDL)。 根据我与SoapUI的合作经验,不能证明您的Web服务定义明确。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.