【问题标题】:Removing WSDL differences while migrating from Axis2 to CXF从 Axis2 迁移到 CXF 时删除 WSDL 差异
【发布时间】:2012-05-11 14:36:30
【问题描述】:

我正在将我的 Web 服务发布 API 从 AXIS2 迁移到 CXF。 CXF 自动生成的 WSDL 与 Axis2 WSDL 不同。下面给出不同之处。由于客户端位于其他地方,因此我无法测试这些差异是否会影响 Axis2 生成的客户端。如何使用 CXF 消除这些 WSDL 差异?
CXF WSDL

<xs:element name="test" type="tns:test"/> 
<xs:element name="testResponse" type="tns:testResponse"/> 
    <xs:complexType name="test"> 
        <xs:sequence> <xs:element name="doc" type="xs:string" minOccurs="0"/> </xs:sequence> 
    </xs:complexType> 
    <xs:complexType name="testResponse"> 
        <xs:sequence> <xs:element name="return" type="xs:string" minOccurs="0"/> </xs:sequence> 
</xs:complexType>

<wsdl:portType name="TESTService">

Axis2 WSDL

<xsd:element name="test" nillable="true" type="xsd:string" />
<xsd:element name="testResponse" nillable="true" type="xsd:string" />
<wsdl:portType name="TEST">

【问题讨论】:

    标签: web-services soap wsdl cxf axis2


    【解决方案1】:

    很可能,添加以下注释:

    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)

    会的。您可能还需要更新 @WebParam 和 @WebReturn 参数的“名称”属性。

    【讨论】:

    • 对不起,我没有完全理解你。哪个注解可以解决什么问题?能不能说的具体点?
    • 您指的是“WebResult”而不是“WebReturn”吗?
    【解决方案2】:

    要消除 xs:elemntName 的差异,请从 Web 服务输入中删除“@WebParams”,因为它只接受一个字符串而不是任何复杂对象。

    要删除 wsdl:portType 名称差异,只需添加 '@WebService(name) 属性。 '@WebService' 应该按照规范顺序,否则 cxf 不会在 WSDL 中考虑它们。

    【讨论】:

      猜你喜欢
      • 2011-10-30
      • 1970-01-01
      • 1970-01-01
      • 2014-05-21
      • 2019-09-10
      • 1970-01-01
      • 2023-03-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多