[ 
https://issues.apache.org/jira/browse/AXIS2-3841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12974178#action_12974178
 ] 

Tharindu Mathew commented on AXIS2-3841:
----------------------------------------

Hi Christophe,

I have been able to reproduce the issue (WSDL attached). But IMO, this bug 
should be close because,

1) Even though target name space is an optional element the WS-I basic profile 
requires you to have it [1].

2) This is not an Axis2 bug but a WSDL4J bug. 

Also to answer your questions on -sp, I hope the following helps:
-s, --server-side
  emit server-side bindings for web service
-p, --package <argument>
  override all namespace to package mappings, use this package
  name instead

Best,

Tharindu

[1] - http://lists.w3.org/Archives/Public/www-ws/2004Feb/0014.html


> wsdl2java fails with NullPointException due to WSDL4J.Defintion returning 
> null targetNamespace
> ----------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-3841
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3841
>             Project: 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to