使用CXF时,SoapAction标头丢失 [英] SoapAction header missing when using CXF

查看:181
本文介绍了使用CXF时,SoapAction标头丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个来自外部WS的WSDL文件,我正在连接到该文件。我正在尝试使用CXF(适用于JAX-WS)。但我从其他系统得到错误。所以我决定看一下我们发送到该系统的数据,唯一不同的是CXF设置了空的SOAPAction http标头。

I have a WSDL file from outside WS that i'm connecting to. And I'm trying to get it working with CXF (works fine with JAX-WS). But I'm getting error from other system. So I decided to take a look at data we're sending to that system and only diffrence is that CXF sets empty SOAPAction http header.

我读了一些看起来像只有已知的解决方案直接指向WSDL。但我已经这样做了。

I took some reading and looks like only known solutions is pointing to WSDL directly. But I already did that.

任何人都有这方面的线索?

Anyone has a clue about this?

<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。

None of this is CXF specific. It is all standard JAX-WS.

您可以使用 @ WebMethod 注释。例如

@WebMethod(operationName = "TestOperation", action="http://example.org/TestOperation")

如果您使用wsimport 从WSDL生成工件,你应该已经在@WebService 带注释的界面。

If you are using wsimport to generate artifacts from the WSDL, you should already have this set in your @WebService annotated interface.

这篇关于使用CXF时,SoapAction标头丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆