Jboss的Web服务:错误:java.io.IOException异常:无法发送消息

问题描述:

你好我试图部署在JBoss中4.2.3GA Web服务客户端应用程序。我已经做到了这一点,它在glassfish v2.x中有效。我复制了jboss-saaj.jar,jboss-jaxws-ext.jar,jboss-jaxws.jar,jboss-jaxrpc.jar和jaxb-api.jar。有人可以摆脱一些信息吗?Jboss的Web服务:错误:java.io.IOException异常:无法发送消息

而且我在NetBeans 6.7部署此。

# Caused by: java.io.IOException: Could not transmit message 
# at org.jboss.ws.core.client.RemotingConnectionImpl.invoke(RemotingConnectionImpl.java:204) 
# at org.jboss.ws.core.client.SOAPRemotingConnection.invoke(SOAPRemotingConnection.java:77) 
# at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:337) 
# at org.jboss.ws.core.jaxrpc.client.CallImpl.invokeInternal(CallImpl.java:517) 
# ... 4 more 
# Caused by: org.jboss.remoting.CannotConnectException: Can not connect http client invoker. 
# at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:333) 
# at org.jboss.remoting.transport.http.HTTPClientInvoker.transport(HTTPClientInvoker.java:135) 
# at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122) 
# at org.jboss.remoting.Client.invoke(Client.java:1634) 
# at org.jboss.remoting.Client.invoke(Client.java:548) 
# at org.jboss.ws.core.client.RemotingConnectionImpl.invoke(RemotingConnectionImpl.java:183) 
# ... 7 more 
# Caused by: org.jboss.ws.WSException: Invalid HTTP server response [404] - Not Found 
# at org.jboss.ws.core.soap.SOAPMessageUnMarshaller.read(SOAPMessageUnMarshaller.java:77) 
# at org.jboss.remoting.transport.http.HTTPClientInvoker.readResponse(HTTPClientInvoker.java:473) 
# at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:305) 
# ... 12 more 

我与版本4.2.2 GA试图通过复制的jboss-没有saaj.jar和jboss-没有jaxrpc.jar到/ lib目录/背书和它的作品。但我也试过版本5.1.0GA,并没有在那里工作。

为方便起见,这里就是我想帮助。如果有人在JBoss中部署的Web服务,不得不罐子复制到特定的文件夹,你可以请让我知道你做了什么?我宁愿如果你使用4.3.3GA或5.1.0GA。谢谢阅读。

我也有在JBoss 5.0.1这个问题。我已经将jbossws - *。jars复制到lib中,并且我在运行junits时引用了它,它工作正常。但是,当我从一个运行的JBoss AS中使用我的客户端时,我得到这个:由于:org.jboss.ws.WSException:无效的HTTP服务器响应[404] - 未找到但我已经三重检查了我配置的服务端点是正确的,我可以在浏览器中访问它,soapUI可以打它,我的单元测试使用相同的客户端可以调用它。

经过一番研究,我发现,JBoss的(并且将JBossWS)可能在将JBossWS 3.0.x的版本(或其它)的一些错误。这可能是由于您正在使用的JAX-WS版本与您调用的服务器的组合造成的。在我的情况下,服务器不支持分块的HTTP请求,而JBoss WS在处理这些请求时存在一些缺陷。这是我所需要的实际请求之前添加代码:

// HACK: This is a hack for disabling chunked encoding. .NET server run by service host does nto seem to support chunked encoding. 
    //Jboss WS version 3.0.5 has multiple bugs disallowing the setting of either a new client type or disabling chunking. 
    //So, we are resporting to this hack here. 
    // This essentially sets the chunck size to 0 forcing the Webservice client to not chunk requests and not expect responses to be chunked (effectively HTTP 1.0 mode) 

    //  ((StubExt) port).setConfigName("HTTP 1.0 Client"); // does not work in Jboss WS 3.0.5 

    EndpointMetaData endpointMetaData = ((StubExt) serviceEndPoint).getEndpointMetaData(); 
    CommonConfig commonConfig = endpointMetaData.getConfig(); 
    boolean hacked = false; 
    try { 
     if (commonConfig.getProperties() != null){ 
      Iterator<EndpointProperty> iter = commonConfig.getProperties().iterator(); 
      while (iter.hasNext()){ 
       EndpointProperty p = iter.next(); 
       if (p.name.equals(new URI(EndpointProperty.CHUNKED_ENCODING_SIZE))){ 
        p.value = "0"; 
        hacked = true; 
        log.info("Chunking set to 0 since service host does not support chunked requests"); 
       } 

      } 
     } 
    } catch (URISyntaxException e) { 
     e.printStackTrace(); 
    } 

    if (!hacked)commonConfig.addProperty(EndpointProperty.CHUNKED_ENCODING_SIZE, "0"); 
    // END HACK 

您还可以在

SERVER_HOME/SERVER_PROFILE /部署者/ jbossws.deployer/META-配置CHUNKSIZE为您的实例INF /标准JAXWS客户端-config.xml中

变化

<property-value>2048</property-value> 

<property-value>0</property-value> 

财产

<client-config> 
     <config-name>Standard Client</config-name> 
     <feature>http://org.jboss.ws/dispatch/validate</feature> 
     <property> 
      <property-name>http://org.jboss.ws/http#chunksize</property-name> 
     </property> 
    </client-config> 

详情请参阅http://community.jboss.org/wiki/Workaroundwhenchunkedencodingisnotsupported