CXF生成带有错误参数的java代码

时间:2014-07-04 15:21:01

标签: java web-services wsdl cxf

我遇到的问题是,当我使用cxf从wsdl和xsds生成代码时,PortType最终将input-type和output-type的内容作为参数。在旧的Axis2实现中不会发生这种情况。 Cxf也使它成为一个void方法,而不是返回响应类型。使用cxf 2.5.3

来自WSDL:

<portType name="PortType">
    <operation name="getResponse">
        <input message="ns:Request"/>
        <output message="ns:Response"/>
        <fault name="Error" message="ns:Error"/>
    </operation>
</portType>

来自PortType.java

@RequestWrapper(localName="Request", targetNamespace="http://ws.site.no/path/to/service.xsd", className="path.to.request")
@WebMethod
@ResponseWrapper(localName="Response", targetNamespace="http://ws.site.no/path/to/service.xsd", className="path.to.request")
public void getResponse(
// Stuff from the request-class:
    @WebParam(name = "reference", targetNamespace = "")
    java.lang.String reference,
    @WebParam(name = "database", targetNamespace = "")
    path.to.Database database,
    @WebParam(name = "organizationNumber", targetNamespace = "")
    java.lang.String organizationNumber,

// Stuff from the response-class
    @WebParam(mode = WebParam.Mode.OUT, name = "Status", targetNamespace = "")
    javax.xml.ws.Holder<path.to.request.Status> status,
    @WebParam(mode = WebParam.Mode.OUT, name = "Information", targetNamespace = "")
    javax.xml.ws.Holder<path.to.request.Information> information,
    @WebParam(mode = WebParam.Mode.OUT, name = "Signature", targetNamespace = "")
    javax.xml.ws.Holder<path.to.request.Signature> signature,
   // (...) Everything else from the response class
) throws Error;

0 个答案:

没有答案