我尝试使用 CXF 生成 WS 客户端,但是生成的类有错误,特别是我收到以下错误:
The nested type Item cannot hide an enclosing type
有没有人 CXF 设置来处理这种情况?
我正在使用的 wsdl 是:
<?xml version ='1.0' encoding='UTF-8' ?>
<wsdl:types>
<xsd:schema targetNamespace="http://example.org/AppGateway">
<xsd:element name="ErrorResult">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="item" maxOccurs="unbounded"
minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="key">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="isSuccess" />
<xsd:enumeration value="errorCode" />
<xsd:enumeration value="errorMessage" />
<xsd:enumeration value="method" />
<xsd:enumeration value="msg" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="value">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element name="item" maxOccurs="unbounded"
minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element type="xsd:string" name="key" />
<xsd:element type="xsd:string" name="value" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<message name="TestApiRequest">
<part name="username" type="xsd:anyType" />
<part name="password" type="xsd:anyType" />
</message>
<message name="TestApiResponse">
<part name="Result" type="xsd:anyType" />
</message>
<message name="GetApiErrorListRequest">
<part name="username" type="xsd:string" />
<part name="password" type="xsd:string" />
</message>
<message name="GetApiErrorListResponse">
<wsdl:part name="Result" element="tns:ErrorResult"></wsdl:part>
</message>
<message name="AddTraderRecordRequest">
<part name="username" type="xsd:anyType" />
<part name="password" type="xsd:anyType" />
<part name="traderRecord" type="xsd:anyType" />
</message>
<message name="AddTraderRecordResponse">
<part name="Result" type="xsd:anyType" />
</message>
<portType name="AppGatewayPortType">
<operation name="TestApi">
<input message="tns:TestApiRequest" />
<output message="tns:TestApiResponse" />
</operation>
<operation name="GetApiErrorList">
<input message="tns:GetApiErrorListRequest" />
<output message="tns:GetApiErrorListResponse" />
</operation>
<operation name="AddTraderRecord">
<input message="tns:AddTraderRecordRequest" />
<output message="tns:AddTraderRecordResponse" />
</operation>
</portType>
<!-- Service definition -->
<wsdl:binding name="AppGatewayBinding" type="tns:AppGatewayPortType">
<soap:binding style="document"
required="true" />
<wsdl:operation name="TestApi">
<soap:operation soapAction="http://example.org/AppGateway/TestApi" style="document"/>
<wsdl:input>
<soap:body use="literal" type="soap:tBody"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" type="soap:tBody" required="true" parts="Result "/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetApiErrorList">
<soap:operation soapAction="http://example.org/AppGateway/GetApiErrorList" style="document"/>
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="AddTraderRecord">
<soap:operation soapAction="http://example.org/AppGateway/AddTraderRecord" style="document"/>
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AppGatewayEndpointService">
<wsdl:port name="AppGatewayService" binding="tns:AppGatewayBinding">
<http:address
location="https://myserviceprovider.com/v1.1/SoapServer.php?className=AppGateway" />
</wsdl:port>
</wsdl:service>