gpt4 book ai didi

java - 使用 Axis 2/JBoss Ws 调用 Web 服务超时

转载 作者:太空宇宙 更新时间:2023-11-04 12:13:49 25 4
gpt4 key购买 nike

我在使用 Axis2 调用 Web 服务时遇到问题。我已经在 cxf 中完成了,没有任何问题,所以我知道该服务正在响应。但是,由于 Jboss 6 和 CXF 之间的兼容性问题,我需要采用另一种技术。 (我正在尝试迁移到Jboss 7,那里没有任何问题,但老板现在不想要)。

所以,cxf 中的请求很完美。当我在 Axis2 中尝试时不起作用。我想我没有做一些好事,cxf 自己做了一些配置,没有 Axis2。

我在 axis2 中遇到此错误:

Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:170)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.InputRecord.read(InputRecord.java:503)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:930)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)
at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)
at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1413)
at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973)
at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:621)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)

在用 cxf 制作的有效项目中,如果我更改调用,使用 Jboss6 运行时并删除 cxf 库(2.7.18),使用相同的代码,我会收到此错误:

Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at com.sun.net.ssl.internal.ssl.InputRecord.readFully(InputRecord.java:422)
at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:460)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:863)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:820)
at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:698)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:641)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1218)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:379)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:318)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2223)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2192)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:2036)
... 12 more

非常相似。

在轴 2 中,我尝试将协议(protocol)更改为 1.0,但错误仍然存​​在。

org.tempuri.RldServiceStub stub = new org.tempuri.RldServiceStub();
org.tempuri.RldServiceStub.InsertarDocumento insertarDocumento40 = (org.tempuri.RldServiceStub.InsertarDocumento) getTestObject(org.tempuri.RldServiceStub.InsertarDocumento.class);

stub._getServiceClient().getOptions().setUserName("b3e4af71-ff47-4451-88d5-1afcf9fb0412");
stub._getServiceClient().getOptions().setPassword("CcVAx5yxL5fC80bw7SAQBMTfXWvEp1YI/sO2YYyJQm4=");
stub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_PROTOCOL_VERSION, org.apache.axis2.transport.http.HTTPConstants.HEADER_PROTOCOL_10);

我对这个问题太迷茫了。

最佳答案

您必须知道 JBoss EAP 上不支持 Apache Axis 作为 Web 服务堆栈。建议使用与当前 JBoss EAP 捆绑在一起的 WS 实现。具体来说,JBoss EAP 6 是 JBossWS Apache CXF。

关于java - 使用 Axis 2/JBoss Ws 调用 Web 服务超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39613519/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com