Details
Description
Hello
When I try to use jax-ws customization to customize the package name without customizing the class name, for example using the following XML code
<bindings wsdlLocation="myService.wsdl" xmlns="http://java.sun.com/xml/ns/jaxws" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<bindings node="wsdl:definitions/wsdl:service[@name='MyService_V1']">
<package name="com.acme.myservice.v1.wsdl"/>
</bindings>
</bindings>
I get the following exception:
[WARNING] WSDLToJava Error: java.lang.NullPointerException
[WARNING]
[WARNING] org.apache.cxf.tools.common.ToolException: java.lang.NullPointerException
[WARNING] at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:294)
[WARNING] at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
[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.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
[WARNING] Caused by: java.lang.NullPointerException
[WARNING] at org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ServiceProcessor.processService(ServiceProcessor.java:207)
[WARNING] at org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ServiceProcessor.process(ServiceProcessor.java:100)
[WARNING] at org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.WSDLToJavaProcessor.wsdlDefinitionToJavaModel(WSDLToJavaProcessor.java:91)
[WARNING] at org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.WSDLToJavaProcessor.process(WSDLToJavaProcessor.java:60)
[WARNING] at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:253)
[WARNING] at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:139)
[WARNING] at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:286)
[WARNING] ... 4 more
The problem is in the class named ‘org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal. ServiceProcessor’ in line 207:
if (serviceBinding2.getJaxwsClass().getComments() != null) {
…
}
If you don’t customize the class name, serviceBinding2.getJaxwsClass() will returns null so calling getComments() results in a NullPointerException .
A possible quick solution could be to change the condition as follows:
if (serviceBinding2.getJaxwsClass() != null && serviceBinding2.getJaxwsClass().getComments() != null) {
…
}
On the other hand, a possible workaround is to customize the class name. For example, the following XML code will work fine.
<bindings wsdlLocation="myService.wsdl" xmlns="http://java.sun.com/xml/ns/jaxws" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<bindings node="wsdl:definitions/wsdl:service[@name='MyService_V1']">
<package name="com.acme.myservice.v1.wsdl"/>
<class name="MyServiceV1" />
</bindings>
</bindings>
Best regards,
Sandy Pérez González
Indaba Consultores S.L.
http://www.indaba.es/