0

我正在尝试使用 Jetty Client (v9) 向 Microsoft IIS Webserver (5.1) 发出 POST 请求。但是,这将导致客户端出现 EOFException。经过对wireshark的一些调查,我发现客户端在发送请求后和响应到达之前立即关闭了TCP连接。

如果我向 Tomcat 服务器发出相同的请求,它会完美运行。

有人知道这个问题或可能导致它的原因吗?码头中的错误?

客户:

if (jettyClient != null) {
        if (jettyClient.isStarted()) {
            remoteHostname = httpAddress.getRemoteUrl().substring(7);
            serviceURI = httpAddress.getRemoteService();
            logger.debug("post an: " + httpAddress.getRemoteUrlPortService());
            Request request = jettyClient.POST(httpAddress.getRemoteUrlPortService());

            request.version(httpVersion);
            request.header(HttpHeader.CONTENT_TYPE, httpContentType);
            request.header(HttpHeader.CONTENT_LENGTH, Integer.toString(msg.length()));
            request.header(HttpHeader.HOST, remoteHostname + ":" + httpAddress.getRemotePort());
            request.timeout(httpTimeout, TimeUnit.MILLISECONDS); // 20000
            request.agent(ApplicationMeta.name + " " + ApplicationMeta.version);
            request.method(HttpMethod.POST);
            request.header("SOAPAction", soapAction);


            request.content(new StringContentProvider(msg));

            HTTPIncomingResponseSet set = null;

            try {
                ContentResponse response = request.send();
            } catch (ExecutionException e) {
              // ....
            }
}
4

0 回答 0