SOAP客户机/代理警告和错误在JBOSS服务器内部而不是外部

rxztt3cl  于 2022-11-08  发布在  其他
关注(0)|答案(1)|浏览(150)

我正在实现一个来自特定供应商的SOAP服务客户端。我已经遇到了大约7个这样的客户端,每个客户端都有自己的挑战。但是,在这个特定的示例中,我遇到了一个新的问题。
在我的jboss服务器之外,我可以让客户端实现运行得很好,完全没有问题。但是在jboss/wildfly 8中,当进行SOAP调用时,我会收到一个警告,后面直接跟着一个错误(见下文)。
我有几个问题,我很难追查下来,列出最重要的第一。
1.我如何才能找出是什么操作导致PhaseInterceptorChain内部出现此错误,以及它是否是我出现错误的原因?
1.错误字符串,我可以很容易地添加内容类型等等,但是为什么我必须这样做呢?客户端不是应该已经在做了吗?
1.我们特别地尽可能避免使用apache cxf。我没有看到它在我的源代码或用ws-import生成的源代码中被显式地调用。我们甚至在我们的构建路径中也没有它。为什么apache cxf会到处弹出这些错误?
启动警告:

2016-11-30 12:46:21,213 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] Interceptor for {http:<removed url>/}<removed class>/<removed class>#{http://<removed url>/}<removed method> has thrown exception, unwinding now: java.lang.UnsupportedOperationException
    at java.util.AbstractMap.put(AbstractMap.java:209) [rt.jar:1.8.0_65]
    at org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor.setSoapAction(SoapPreProtocolOutInterceptor.java:122)
    at org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor.handleMessage(SoapPreProtocolOutInterceptor.java:63)
    at org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor.handleMessage(SoapPreProtocolOutInterceptor.java:47)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:570)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:479)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
    at com.sun.proxy.$Proxy154.<removed metho>(Unknown Source)

启动错误:

2016-11-30 12:46:21,257 ERROR [com.<removed class>] Fault string, and possibly fault code, not set: javax.xml.ws.soap.SOAPFaultException: Fault string, and possibly fault code, not set
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:157)
    at com.sun.proxy.$Proxy154.<removed metho>(Unknown Source)
    removed misc lines
Caused by: java.lang.UnsupportedOperationException
        at java.util.AbstractMap.put(AbstractMap.java:209) [rt.jar:1.8.0_65]
        at org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor.setSoapAction(SoapPreProtocolOutInterceptor.java:122)
        at org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor.handleMessage(SoapPreProtocolOutInterceptor.java:63)
        at org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor.handleMessage(SoapPreProtocolOutInterceptor.java:47)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
        at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:570)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:479)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335)
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
        at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
        ... 10 more

任何帮助都非常感谢。我确实在发帖前试着搜索了互联网(stackoverflow,jboss开发人员等)。

gojuced7

gojuced71#

我找到了关于此问题的文章http://mariemjabloun.blogspot.com/2013/10/javalangunsupportedoperationexception.html
实际上,这个拦截器试图向您的请求添加新的头,如果您有这样的代码

bp.getRequestContext().put(
    MessageContext.HTTP_REQUEST_HEADERS,
    Collections.singletonMap("Cookie", Collections.singletonList(yourCookieString)
);

您应该将不可变的单例Map更改为可变的单例Map(例如HashMap)

相关问题