[
https://issues.apache.org/jira/browse/AXIS2-5919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andreas Veithen resolved AXIS2-5919.
------------------------------------
Resolution: Fixed
Assignee: Andreas Veithen
Fix Version/s: 1.8.0
> WSDL2Java not working properly when using jaxbri and WSDL with faults
> ---------------------------------------------------------------------
>
> Key: AXIS2-5919
> URL: https://issues.apache.org/jira/browse/AXIS2-5919
> Project: Axis2
> Issue Type: Bug
> Components: codegen, databinding
> Affects Versions: 1.7.7, 1.7.8
> Reporter: Edi Obradovic
> Assignee: Andreas Veithen
> Priority: Major
> Labels: codegen, jaxbri, wsdl2java
> Fix For: 1.8.0
>
>
> We are currently unable to use newer version of Axis2 (1.7.7) because the
> Java classes generated by axis2-codegen and axis2-jaxbri have missing
> parameter errors.
> When you generate Java classes from WSDL that contains faults you get errors
> in the newly generated classes: "The method toOM(TestFaultStruct, boolean,
> QName) in the type <class> is not applicable for the arguments
> (TestFaultStruct, boolean)". The reason you get that is because the QName
> parameter is missing when calling toOM in faults.
> *The error happens because:*
> - all toOM methods code is generated using JaxbRIDatabindingTemplate.xsl
> (axis2-jaxbri) and they all have QName parameter defined
> - all custom faults code is generated using MessageReceiverTemplate.xsl
> (axis2-codegen) and if you look at the xsl code you can see that QName
> parameter is not there:
> {code:xml}
> <xsl:for-each select="fault-list/fault">
> <xsl:if test="position()=1">}</xsl:if> catch (<xsl:value-of
> select="@name"/> e) {
>
> msgContext.setProperty(org.apache.axis2.Constants.FAULT_NAME,"<xsl:value-of
> select="@localname"/>");
> org.apache.axis2.AxisFault f = createAxisFault(e);
> if (e.getFaultMessage() != null){
> f.setDetail(toOM(e.getFaultMessage(),false));
> }
> throw f;
> }
> </xsl:for-each>
> {code}
>
> *How to reproduce:*
> - Download and extract axis2-1.7.7
> - Execute WSDL2Java:
> {code:java}
> java -Dfile.encoding=UTF-8 -Djavax.xml.accessExternalSchema=all -classpath
> "c:\DevStudio\axis2-1.7.7\lib\*;" org.apache.axis2.wsdl.WSDL2Java -uri
> "c:\DevStudio\axis2-1.7.7\samples\faulthandling\bank.wsdl" -o "%CD%\GEN" -d
> jaxbri -ss -g -or -p com.company.generated
> {code}
> - Compile code (eclipse/ant ...)
> {code:java}
> Buildfile: C:\TEMP\Test\GEN\build.xml
> init:
> [mkdir] Created dir: C:\TEMP\Test\GEN\build
> [mkdir] Created dir: C:\TEMP\Test\GEN\build\classes
> [mkdir] Created dir: C:\TEMP\Test\GEN\build\lib
> pre.compile.test:
> [echo] JAX-B RI Availability = true
> [echo] Stax Availability= true
> [echo] Axis2 Availability= true
> compile.src:
> [javac] C:\TEMP\Test\GEN\build.xml:47: warning: 'includeantruntime' was
> not set, defaulting to build.sysclasspat
> h=last; set to false for repeatable builds
> [javac] Compiling 12 source files to C:\TEMP\Test\GEN\build\classes
> [javac]
> C:\TEMP\Test\GEN\src\com\company\generated\BankServiceMessageReceiverInOut.java:89:
> error: no suitable m
> ethod found for toOM(AccountNotExistFault,boolean)
> [javac] f.setDetail(toOM(e.getFaultMessage(), false));
> [javac] ^
> [javac] method
> BankServiceMessageReceiverInOut.toOM(InsufficientFundFault,boolean,QName) is
> not applicable
> [javac] (actual and formal argument lists differ in length)
> [javac] method
> BankServiceMessageReceiverInOut.toOM(AccountNotExistFault,boolean,QName) is
> not applicable
> [javac] (actual and formal argument lists differ in length)
> [javac] method
> BankServiceMessageReceiverInOut.toOM(WithdrawResponse,boolean,QName) is not
> applicable
> [javac] (actual and formal argument lists differ in length)
> [javac] method
> BankServiceMessageReceiverInOut.toOM(Withdraw,boolean,QName) is not applicable
> [javac] (actual and formal argument lists differ in length)
> [javac]
> C:\TEMP\Test\GEN\src\com\company\generated\BankServiceMessageReceiverInOut.java:100:
> error: no suitable
> method found for toOM(InsufficientFundFault,boolean)
> [javac] f.setDetail(toOM(e.getFaultMessage(), false));
> [javac] ^
> [javac] method
> BankServiceMessageReceiverInOut.toOM(InsufficientFundFault,boolean,QName) is
> not applicable
> [javac] (actual and formal argument lists differ in length)
> [javac] method
> BankServiceMessageReceiverInOut.toOM(AccountNotExistFault,boolean,QName) is
> not applicable
> [javac] (actual and formal argument lists differ in length)
> [javac] method
> BankServiceMessageReceiverInOut.toOM(WithdrawResponse,boolean,QName) is not
> applicable
> [javac] (actual and formal argument lists differ in length)
> [javac] method
> BankServiceMessageReceiverInOut.toOM(Withdraw,boolean,QName) is not applicable
> [javac] (actual and formal argument lists differ in length)
> [javac] Note: Some input files use unchecked or unsafe operations.
> [javac] Note: Recompile with -Xlint:unchecked for details.
> [javac] 2 errors
> BUILD FAILED
> C:\TEMP\Test\GEN\build.xml:47: Compile failed; see the compiler error output
> for details.
> Total time: 2 seconds
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]