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 "Andreas Veithen (JIRA)" <ji...@apache.org> on 2011/08/12 12:58:28 UTC

[jira] [Commented] (AXIS2-4533) CodeGen Exception reusing messages for multiple faults.

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

Andreas Veithen commented on AXIS2-4533:
----------------------------------------

Here is a more detailed analysis of the issues caused by the change in r1053084:

1. An AxisMessage object is meant to represent a wsdl:message element. However, with this change the name property of the AxisMessage object is now set to the value of the name attribute of the wsdl:fault element instead of the name of the wsdl:message element (as for messages referenced by wsdl:input or wsdl:output). That is inconsistent and causes problems for JAX-WS, as explained by Ivan in AXIS2-5034. The name property of the AxisMessage should always be used for the name of the wsdl:message element. [Interestingly there is no place in the AxisDescription hierarchy where one could store the name of the wsdl:fault. The reason is that AxisOperation stores the faults as a simple list. WSD4J got this right and uses a map where the key is the fault name.]

2. As noted by Giovanni Zigliara in AXIS2-5034 and as evidenced by r1072510, the change in r1053084 implies that the code generated by Axis2 1.5.x and 1.6.0 is completely different with respect to faults. This causes issues when upgrading from 1.5.x to 1.6.0.

3. The fault name in the WSDL is only used to distinguish between multiple faults defined for a single operation. For operations defining a single fault, it is likely that a generic name (such as "fault") is used. With the change in r1053084 the name of the exception class is derived from the fault name instead of the message name. In these scenarios, this will result in a less meaningful naming convention.

4. The change doesn't take into account that the fault name is only unique within the scope of a single operation. In a given port type, it is perfectly legal to have multiple fault elements with the same name but referring to different messages, provided that these faults are declared for different operations. In such scenarios the generated code is incorrect because only a single exception class is generated. This is the problem that Giovanni Zigliara describes in AXIS2-5034.

> CodeGen Exception reusing messages for multiple faults.
> -------------------------------------------------------
>
>                 Key: AXIS2-4533
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4533
>             Project: Axis2
>          Issue Type: Bug
>          Components: codegen
>    Affects Versions: 1.5
>         Environment: Windows Vista Business 64bit
> Java 1.5
>            Reporter: Christoph Kreidler
>            Assignee: Andreas Veithen
>            Priority: Minor
>         Attachments: IdaresWS.wsdl, idares-model.xsd
>
>
> I have a WSDL file with multiple ports and operations. I declared two WSDL messages as fault messages and ran WSDL2Code:
> #########################
> -uri ${project_loc:IdaresEvalProcess}/IdaresWS.wsdl
> -p de.ahija.thesis.idares.skeleton
> -Emp de.ahija.thesis.idares.skeleton
> -d adb
> -ss
> -sd
> -ssi
> -g
> -S gen/skeleton
> -R gen/res
> -or
> --noBuildXML
> #########################
> Unexpectedly I got an Exception:
> #########################
> Retrieving document at 'C:\Users\Ahija\Documents\Studium\S10\Diplomarbeit\Java\code\Idares\IdaresEvalProcess/IdaresWS.wsdl'.
> Retrieving schema wsdl:imported from 'idares-model.xsd', relative to 'file:/C:/Users/Ahija/Documents/Studium/S10/Diplomarbeit/Java/code/Idares/IdaresEvalProcess/IdaresWS.wsdl'.
> Retrieving document at 'C:\Users\Ahija\Documents\Studium\S10\Diplomarbeit\Java\code\Idares\IdaresEvalProcess/IdaresWS.wsdl'.
> Retrieving schema wsdl:imported from 'idares-model.xsd', relative to 'file:/C:/Users/Ahija/Documents/Studium/S10/Diplomarbeit/Java/code/Idares/IdaresEvalProcess/IdaresWS.wsdl'.
> Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: Element QName is null for sqlErrorMessage!
> 	at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:271)
> 	at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
> Caused by: org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: Element QName is null for sqlErrorMessage!
> 	at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitSkeleton(AxisServiceBasedMultiLanguageEmitter.java:1432)
> 	at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:253)
> 	... 1 more
> Caused by: java.lang.RuntimeException: Element QName is null for sqlErrorMessage!
> 	at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.getFaultParamElements(AxisServiceBasedMultiLanguageEmitter.java:2908)
> 	at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.getFaultElement(AxisServiceBasedMultiLanguageEmitter.java:2827)
> 	at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.generateMethodElement(AxisServiceBasedMultiLanguageEmitter.java:2348)
> 	at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.loadOperations(AxisServiceBasedMultiLanguageEmitter.java:2224)
> 	at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.createDOMDocumentForSkeletonInterface(AxisServiceBasedMultiLanguageEmitter.java:2181)
> 	at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.writeSkeletonInterface(AxisServiceBasedMultiLanguageEmitter.java:2083)
> 	at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitSkeleton(AxisServiceBasedMultiLanguageEmitter.java:1378)
> 	... 2 more
> #########################
> Interestingly the bug does not appear, if I use a different message for each fault.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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