You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Christophe Dumont (JIRA)" <ji...@apache.org> on 2008/06/06 10:10:45 UTC

[jira] Created: (AXIS2-3841) wsdl2java fails with NullPointException due to WSDL4J.Defintion returning null targetNamespace

wsdl2java fails with NullPointException due to WSDL4J.Defintion returning null targetNamespace
----------------------------------------------------------------------------------------------

                 Key: AXIS2-3841
                 URL: https://issues.apache.org/jira/browse/AXIS2-3841
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: codegen
    Affects Versions: 1.4
         Environment: Windows XP, Java 1.5
            Reporter: Christophe Dumont


wsdl2java is failing with the stack trace that you can find at the end of this note.
It appears this is linked with the fact the wsdl I received from a service provider doesn't have any targetNamespace defined.
If I modify the wsdl myself to add a targetNamespace all is ok, except when AXIS2 handles the response as it throws an exception about the namespace not being the one expected; the response message having no namespace... I do also wonder what is the use of the "-sp" option in the wsdl2java as it doesn't seem doing anything.

Anyway I looked into the source code and found out that the WSDL4J library has a Defintion class that you are using, and that the method getTargetNamespace() is returning null. I "patched" the WSDL4J DefintionImpl to guarantee in case of null that a "" (empty string) is returned. This is because you are making a lot of calls on this class. The java package can then be generated and the WebService is working fine.

It may be good to secure this null variable as you are doing a lot of string manipulation. I don't know if you could make sure that you always load an empty string in the Definition class in place of null, or if an issue should be raised to the WSDL4J team.
Thank you for looking at this.

[ERROR]
java.lang.NullPointerException
        at org.apache.axis2.addressing.wsdl.WSDL11DefaultActionPatternHelper.generateActionFromInputElement(WSDL11DefaultActionPatternHelper.java:71)
        at org.apache.axis2.addressing.wsdl.WSDL11ActionHelper.getActionFromInputElement(WSDL11ActionHelper.java:67)
        at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateOperations(WSDL11ToAxisServiceBuilder.java:1312)
        at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populatePortType(WSDL11ToAxisServiceBuilder.java:590)
        at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateEndpoints(WSDL11ToAxisServiceBuilder.java:469)
        at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:363)
        at org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.populateAllServices(WSDL11ToAllAxisServicesBuilder.java:107)
        at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:147)
        at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
        at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException
: Error parsing WSDL
        at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:153)
        at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
        at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: org.apache.axis2.AxisFault
        at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
        at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:397)
        at org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.populateAllServices(WSDL11ToAllAxisServicesBuilder.java:107)
        at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:147)
        ... 2 more
Caused by: java.lang.NullPointerException
        at org.apache.axis2.addressing.wsdl.WSDL11DefaultActionPatternHelper.generateActionFromInputElement(WSDL11DefaultActionPatternHelper.java:71)
        at org.apache.axis2.addressing.wsdl.WSDL11ActionHelper.getActionFromInputElement(WSDL11ActionHelper.java:67)
        at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateOperations(WSDL11ToAxisServiceBuilder.java:1312)
        at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populatePortType(WSDL11ToAxisServiceBuilder.java:590)
        at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateEndpoints(WSDL11ToAxisServiceBuilder.java:469)
        at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:363)
        ... 4 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org