[ https://issues.apache.org/jira/browse/CXF-9102?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17921204#comment-17921204 ]
Andriy Redko commented on CXF-9102: ----------------------------------- [~dsylaiev] your binding files does not seem right, your are generating JAX-WS services, not JAXB classes: {noformat} <?xml version="1.0" encoding="UTF-8"?> <jaxws:bindings xmlns:jaxws="https://jakarta.ee/xml/ns/jaxws" wsdlLocation="HelloWorld.wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <jaxws:bindings node="wsdl:definitions/wsdl:portType[@name='HelloWorld']"> <jaxws:class name="CustomHelloWorld"/> </jaxws:bindings> </jaxws:bindings> {noformat} > cxf-codegen-plugin fails to generate code from wsdl and binding file after > update to 4.x: XPath evaluation results in empty target node > --------------------------------------------------------------------------------------------------------------------------------------- > > Key: CXF-9102 > URL: https://issues.apache.org/jira/browse/CXF-9102 > Project: CXF > Issue Type: Bug > Affects Versions: 4.1.0, 4.0.6 > Reporter: Dmytro Sylaiev > Priority: Major > > I have created a small sample project with pom.xml including > cxf-codegen-plugin in it, bindings.xml file, and HelloWorld.wsdl > > pom.xml: > > {code:java} > ... > <build> > <plugins> > <plugin> > <groupId>org.apache.cxf</groupId> > <artifactId>cxf-codegen-plugin</artifactId> > <version>${cxf.version}</version> > <executions> > <execution> > <id>generate-sources</id> > <phase>generate-sources</phase> > <goals> > <goal>wsdl2java</goal> > </goals> > <configuration> > > <sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot> > <wsdlOptions> > <wsdlOption> > <bindingFiles> > <bindingFile>${basedir}/src/main/resources/bindings.xml</bindingFile> > </bindingFiles> > <wsdl>${basedir}/src/main/resources/HelloWorld.wsdl</wsdl> > </wsdlOption> > </wsdlOptions> > </configuration> > </execution> > </executions> > </plugin> > </plugins> > </build> > ...{code} > HelloWorld.wsdl: > > {noformat} > <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" > xmlns:tns="http://example.org/helloworld" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > targetNamespace="http://example.org/helloworld" > name="HelloWorldService"> > <types> > <xsd:schema targetNamespace="http://example.org/helloworld"> > <xsd:element name="sayHello"> > <xsd:complexType> > <xsd:sequence> > <xsd:element name="name" type="xsd:string"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > <xsd:element name="sayHelloResponse"> > <xsd:complexType> > <xsd:sequence> > <xsd:element name="greeting" type="xsd:string"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > </xsd:schema> > </types> > <message name="sayHelloRequest"> > <part name="parameters" element="tns:sayHello"/> > </message> > <message name="sayHelloResponse"> > <part name="parameters" element="tns:sayHelloResponse"/> > </message> > <portType name="HelloWorld"> > <operation name="sayHello"> > <input message="tns:sayHelloRequest"/> > <output message="tns:sayHelloResponse"/> > </operation> > </portType> > <binding name="HelloWorldSOAPBinding" type="tns:HelloWorld"> > <soap:binding style="document" > transport="http://schemas.xmlsoap.org/soap/http"/> > <operation name="sayHello"> > <soap:operation soapAction="sayHello"/> > <input> > <soap:body use="literal"/> > </input> > <output> > <soap:body use="literal"/> > </output> > </operation> > </binding> > <service name="HelloWorldService"> > <port name="HelloWorldPort" binding="tns:HelloWorldSOAPBinding"> > <soap:address location="http://localhost:8080/helloWorld"/> > </port> > </service> > </definitions> > {noformat} > bindings.xml: > > {noformat} > <?xml version="1.0" encoding="UTF-8"?> > <jaxb:bindings > xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb" > xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" > jaxb:version="3.0"> > <jaxb:bindings node="wsdl:definitions/wsdl:portType[@name='HelloWorld']"> > <jaxb:class name="CustomHelloWorld"/> > </jaxb:bindings> > </jaxb:bindings>{noformat} > > {{The execute mvn clean generate-code build succeeded when cxf.version is > 3.6.5 but when update to 4.x it fails with}} > > > {noformat} > [WARNING] Exception in thread "main" > org.apache.cxf.tools.common.ToolException: > file:/C:/projects/testProject/cxfGenTest/src/main/resources/bindings.xml > [6,78]: XPath evaluation of > "wsdl:definitions/wsdl:portType[@name='HelloWorld']" results in empty target > node > [WARNING] > [WARNING] at > org.apache.cxf.tools.common.ToolErrorListener.throwToolException(ToolErrorListener.java:87) > [WARNING] at > org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:158) > [WARNING] at > org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:402) > [WARNING] at > org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:105) > [WARNING] at > org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113) > [WARNING] at > org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86) > [WARNING] at > org.apache.cxf.maven_plugin.wsdl2java.ForkOnceWSDL2Java.main(ForkOnceWSDL2Java.java:51) > [WARNING] Caused by: com.sun.istack.SAXParseException2; systemId: > file:/C:/projects/testProject/cxfGenTest/src/main/resources/bindings.xml; > lineNumber: 6; columnNumber: 78; XPath evaluation of > "wsdl:definitions/wsdl:portType[@name='HelloWorld']" results in empty target > node > [WARNING] at > com.sun.tools.xjc.reader.internalizer.Internalizer.reportError(Internalizer.java:564) > [WARNING] at > com.sun.tools.xjc.reader.internalizer.Internalizer.reportError(Internalizer.java:557) > [WARNING] at > com.sun.tools.xjc.reader.internalizer.Internalizer.buildTargetNodeMap(Internalizer.java:235) > [WARNING] at > com.sun.tools.xjc.reader.internalizer.Internalizer.buildTargetNodeMap(Internalizer.java:329) > [WARNING] at > com.sun.tools.xjc.reader.internalizer.Internalizer.transform(Internalizer.java:115) > [WARNING] at > com.sun.tools.xjc.reader.internalizer.Internalizer.transform(Internalizer.java:76) > [WARNING] at > com.sun.tools.xjc.reader.internalizer.DOMForest.transform(DOMForest.java:414) > [WARNING] at > com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:214) > [WARNING] at > com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:65) > [WARNING] at > org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:445) > [WARNING] at > org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:711) > [WARNING] at > org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:259) > [WARNING] at > org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:156) > [WARNING] ... 5 more > {noformat} > > > > despite all configuration remains the same and corresponds the examples in > the docs: > [https://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html] > It also works with cxf 4.x when I comment the > {noformat} > <bindingFiles> > <bindingFile>${basedir}/src/main/resources/bindings.xml</bindingFile> > </bindingFiles>{noformat} > part in the plugin configuration. > > > I've debugged a bit and it seems that the XPath lookup for node > `wsdl:definitions/wsdl:portType[@name='HelloWorld']` is evaluated not through > HelloWorld.wsdl file, but through the bindings.xml itself. > -- This message was sent by Atlassian Jira (v8.20.10#820010)