问题
I am using Apache CXF for develop webservice from WSDL but its give an error.
org.apache.cxf.tools.common.ToolException: Non unique body parts, operation [ getStation ] and operation [ getStationStatus ] in binding {urn:schemas.nema.org:evse:dir:xsd}StationDirectoryPort have the same body block: {urn:schemas.nema.org:evse:dir:xsd}StationSearchParameter
WSI-BP-1.0 R2716 violation: Operation 'getStation' soapBody MUST NOT have namespace attribute
at org.apache.cxf.tools.validator.internal.WSDL11Validator.isValid(WSDL11Validator.java:139)
at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.validate(JAXWSDefinitionBuilder.java:204)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:204)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:164)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:412)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
Please help me to identify issue its in CXF or in WSDL.if error in WSDL then how can I resolve this issue.
回答1:
Based in this http://cxf.547215.n5.nabble.com/WSDLToJava-Error-Non-unique-body-parts-In-a-port-operations-must-have-unique-operation-signaure-td556498.html
element name for each operation must be unique.
<xsd:element name="StationSearchParameter" type="tns:StationSearchParameterType"/>
declare one more element with same type
<xsd:element name="StationSearchStatusParameter" type="tns:StationSearchParameterType"/>
and use this element in your wsdl
like
<wsdl:message name="getStationStatusRequestMsg">
<wsdl:part name="input" element="tnsx:StationSearchStatusParameter"/>
</wsdl:message>
It must work without any issues.
来源:https://stackoverflow.com/questions/23105706/cxf-2-7-give-common-toolexception-non-unique-body-parts-error