简体   繁体   English

使用SoapUI和Java代码有什么区别?

[英]What's the difference between using SoapUI and java code?

I'm using soap to request some information from server. 我正在使用肥皂从服务器请求一些信息。 so, In order to test whether my soap way is the correct way or not, I tested soapUI Pro 4.6.3 program and java code. 因此,为了测试我的soap方式是否正确,我测试了soapUI Pro 4.6.3程序和Java代码。

when I use soapUI program , I got the response of my request from server. 当我使用soapUI程序时,我从服务器获得了请求的响应。 But, when I use java code I couldn't get response of my request from server.. I can see the error code 500. As I know, 500 Error code is Internal Error. 但是,当我使用Java代码时,无法从服务器获得请求的响应。我可以看到错误代码500。据我所知,500错误代码是Internal Error。 so Isn't this problem of server? 那么这不是服务器问题吗?

I want to know what's the difference between them. 我想知道它们之间有什么区别。

My java code is below.. and The XML code is the same what I use by SoapUI Program and what I use java code. 我的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();
    }

and I already did URLConnection Class, and HttpClient Class.. but The result was the same.. 并且我已经做了URLConnection类和HttpClient类。但是结果是一样的。

If you know the way to solve this problem or have the same experience as me. 如果您知道解决此问题的方法或与我有相同的经验。 please let me know how to solve this problem.. thank you for reading ^_^ 请让我知道如何解决此问题。.感谢您阅读^ _ ^

Soap - UI will parse poorly defined webservices(for eg. Not Well Defined WSDL). 肥皂-用户界面将解析定义不明确的Web服务(例如,定义欠佳的WSDL)。 From my experience working with SoapUI is not a proof that your webservice is well-defined. 根据我与SoapUI的合作经验,不能证明您的Web服务定义明确。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM