我有一个来自外部 WS 的 WSDL 文件,我正在连接。我正试图让它与 CXF 一起工作(与 JAX-WS 一起工作得很好)。但是我从其他系统收到错误。因此,我决定查看我们发送到该系统的数据,唯一不同的是 CXF 设置了空的 SOAPAction http header 。
我阅读了一些资料,看起来只有已知的解决方案直接指向 WSDL。但我已经这样做了。
有人知道这件事吗?
<bean id="object" class="xxx.XxxObject" factory-bean="objectFActory"
factory-method="create"/>
<bean id="objectFActory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass" value="xxx.XxxObject"/>
<property name="wsdlLocation" value="http://blebleble"/>
<property name="address" value="http://blebleble"/>
<property name="username" value="user"/>
<property name="password" value="password"/>
<property name="properties">
<map>
<entry key="javax.xml.ws.session.maintain" value-type="java.lang.Boolean" value="true"/>
</map>
</property>
</bean>
标题:
POST /somepath HTTP/1.1
Content-Type: text/xml; charset=UTF-8
Accept: */*
Authorization: Basic <randomhex>
SOAPAction: ""
User-Agent: Apache CXF 2.7.6
Cache-Control: no-cache
Pragma: no-cache
Host: somehost:8080
Connection: keep-alive
Content-Length: 2791
最佳答案
这些都不是特定于 CXF 的。这都是标准的 JAX-WS。
您可以使用 @WebMethod 的操作属性用于设置 SOAP 操作的注释。例如
@WebMethod(operationName = "TestOperation", action="http://example.org/TestOperation")
如果您使用 wsimport要从 WSDL 生成工件,您应该已经在您的 @WebService 中设置了这个集合带注释的界面。
关于java - 使用 CXF 时缺少 SoapAction header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17987443/