什么';使用SoapUI和java代码有什么区别?

什么';使用SoapUI和java代码有什么区别?,java,web-services,soap,Java,Web Services,Soap,我正在使用soap从服务器请求一些信息。 因此,为了测试我的soap方式是否正确,我测试了soapUIPro 4.6.3程序和java代码 HttpClient client = new HttpClient(); PostMethod method = new PostMethod("My URL"); int status = 0; String result = ""; try { method.setRequestBody(MySoapXML); m

我正在使用soap从服务器请求一些信息。 因此,为了测试我的soap方式是否正确,我测试了soapUIPro 4.6.3程序和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();
    }
当我使用soapUI程序时,我从服务器得到了请求的响应。但是,当我使用java代码时,我无法从服务器获得请求的响应。。 我可以看到错误代码500。据我所知,500错误代码是内部错误。那么,这不是服务器的问题吗

我想知道他们之间有什么不同

下面是我的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类。。但是结果是一样的


如果你知道解决这个问题的方法或者和我有相同的经验。请告诉我如何解决这个问题。。感谢您阅读^ ^ ^

Soap-UI将解析定义不好的Web服务(例如,定义不好的WSDL)。根据我使用SoapUI的经验,这并不能证明您的Web服务定义良好。

请发布您使用SoapUI发送的请求,以查看与您的代码请求之间的差异。很抱歉,我无法发布我的请求。。因为请求是秘密..但我可以说XML请求在SOAPUI和java代码之间完全相同..T.TNo它也会解析不正确的web服务(structure)。意味着它没有那么严格。。真正地因此,我将寻找另一种方式。。谢谢你的回答^_^