CXF中定义方法时返回值的类名跟方法名不能一样

来源:互联网 发布:手机预装软件不显示 编辑:程序博客网 时间:2024/06/10 14:10

比如:

ListVirtualServerStatuses listVirtualServerStatuses(
            @WebParam(name = "req") ListVirtualServerStatusesRequest request);

其实上面的返回值还不是完全一样的,首字母不同,但框架会统一把首字母变成小写。

除此之外,返回值去掉结尾的"Response"后与方法名一致也不行:

ListNodeStatusesResponse listNodeStatuses(
            @WebParam(name = "req") ListNodeStatusesRequest request);


否则会报下面的错误:

Two classes have the same XML type name "{http://web.88.**.****.com/}listNodeStatusesResponse". Use @XmlType.name and @XmlType.namespace to assign different names to them.
    this problem is related to the following location:
        at com.****.**.88.web.datamodel.response.ListNodeStatusesResponse
        at private com.****.**.88.web.datamodel.response.ListNodeStatusesResponse com.****.**.88.web.jaxws_asm.ListNodeStatusesResponse.listNodeStatusesRsp
        at com.****.**.88.web.jaxws_asm.ListNodeStatusesResponse
    this problem is related to the following location:
        at com.****.**.88.web.jaxws_asm.ListNodeStatusesResponse
Two classes have the same XML type name "{http://web.88.**.****.com/}listVirtualServerStatuses". Use @XmlType.name and @XmlType.namespace to assign different names to them.
    this problem is related to the following location:
        at com.****.**.88.web.jaxws_asm.ListVirtualServerStatuses
    this problem is related to the following location:
        at com.****.**.88.web.datamodel.response.ListVirtualServerStatuses
        at private com.****.**.88.web.datamodel.response.ListVirtualServerStatuses com.****.**.88.web.jaxws_asm.ListVirtualServerStatusesResponse.listVirtualServerStatusesRsp
        at com.****.**.88.web.jaxws_asm.ListVirtualServerStatusesResponse


应该是有方法可以设置的,只是没找到。试过WebResult重置名字不行。错误信息里说的重置命名空间名字,没试过。