Java WstxEOFException:仅在JBoss上的Prolog中出现意外的EOF

Java WstxEOFException:仅在JBoss上的Prolog中出现意外的EOF,java,web-services,soap,jboss,basic-authentication,Java,Web Services,Soap,Jboss,Basic Authentication,我得到的错误是在一些论坛帖子中,但所有的场景似乎与我的略有不同 我正在编写一个JAX-WSWeb服务客户端,以便与使用基本身份验证(仅限http级别)的基于soap的web服务通信。我使用wsdl上的wsimport生成了客户机 我可以使用两个版本的web服务进行测试: Service service = Service.create(url, qname); ImportLoan port = service.getPort(ImportLoan.clas

我得到的错误是在一些论坛帖子中,但所有的场景似乎与我的略有不同

我正在编写一个JAX-WSWeb服务客户端,以便与使用基本身份验证(仅限http级别)的基于soap的web服务通信。我使用wsdl上的wsimport生成了客户机

我可以使用两个版本的web服务进行测试:

        Service service = Service.create(url, qname);   
        ImportLoan port = service.getPort(ImportLoan.class);
        BindingProvider bp = (BindingProvider) port;
        bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,  properties.getProperty("username"));
        bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,  properties.getProperty("password"));
        ImportLoanRequestType requestType = new ImportLoanRequestType();
        requestType.setData(strEncodedPayload);
        ImportLoanResponseType responseType = port.importLoanApp(requestType);
  • 端口8080-无身份验证
  • 端口80-需要基本的http级别身份验证
web服务的功能:

        Service service = Service.create(url, qname);   
        ImportLoan port = service.getPort(ImportLoan.class);
        BindingProvider bp = (BindingProvider) port;
        bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,  properties.getProperty("username"));
        bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,  properties.getProperty("password"));
        ImportLoanRequestType requestType = new ImportLoanRequestType();
        requestType.setData(strEncodedPayload);
        ImportLoanResponseType responseType = port.importLoanApp(requestType);
  • 这只是一个简单的web服务,它允许我向其中发送base64编码的xml负载
我验证了以下内容:

        Service service = Service.create(url, qname);   
        ImportLoan port = service.getPort(ImportLoan.class);
        BindingProvider bp = (BindingProvider) port;
        bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,  properties.getProperty("username"));
        bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,  properties.getProperty("password"));
        ImportLoanRequestType requestType = new ImportLoanRequestType();
        requestType.setData(strEncodedPayload);
        ImportLoanResponseType responseType = port.importLoanApp(requestType);
  • 我可以从本地主机使用SOAPUI正确地发送这两个web服务(80/8080)
  • 我可以使用本地主机上的测试JAVA应用程序正确地发送这两个web服务
失败的地方:

        Service service = Service.create(url, qname);   
        ImportLoan port = service.getPort(ImportLoan.class);
        BindingProvider bp = (BindingProvider) port;
        bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,  properties.getProperty("username"));
        bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,  properties.getProperty("password"));
        ImportLoanRequestType requestType = new ImportLoanRequestType();
        requestType.setData(strEncodedPayload);
        ImportLoanResponseType responseType = port.importLoanApp(requestType);
  • 一旦我尝试在jboss5.1上将我的web服务客户端部署为.war。。。只有端口8080Web服务工作。当我在端口80上尝试web服务时,我得到了这个错误
10:36:51467执行调用(准备)时捕获错误[CommonClient]异常: javax.xml.ws.soap.SOAPFaultException:com.ctc.wstx.exc.WstxEOFException:prolog中意外的EOF 在[row,col{unknown source}]:[1,0] 位于org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.getSOAPFaultException(SOAPFaultHelperJAXWS.java:84) 位于org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.throwFaultException(SOAP11BindingJAXWS.java:107)

我的测试客户端的核心代码:

        Service service = Service.create(url, qname);   
        ImportLoan port = service.getPort(ImportLoan.class);
        BindingProvider bp = (BindingProvider) port;
        bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,  properties.getProperty("username"));
        bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,  properties.getProperty("password"));
        ImportLoanRequestType requestType = new ImportLoanRequestType();
        requestType.setData(strEncodedPayload);
        ImportLoanResponseType responseType = port.importLoanApp(requestType);
我所希望的

我只是需要一些想法在这里进行分类。我假设我得到了一些无法正确解析的无效SOAP响应。我只是觉得奇怪,它只发生在从JBoss(我的应用服务器)发送服务时,所以它一定是我这边的东西。SOAPUI工作得很好。在独立test.java文件中编写的完全相同的代码也可以正常工作

更新。。。晚上晚些时候 当然,我会在发布问题的当天找到答案。我观察了http流量,并意识到在发送了一半数据后,HTTP500错误响应(带有soap eof prolog错误)返回。显然JBoss会将数据分块。这在8080服务中运行良好,但由于某些原因,端口80服务不支持分块。我假设这是一个身份验证错误,但似乎是web服务不支持分块。我修改了服务器上的标准-jaxws-client-config.xml(jbossws.deployer/META-INF文件夹)。将chunksize从2048设置为0,瞧。。。问题解决了。希望有一天这能帮助其他人