That's simply because the code in JaxbRIDatabindingTemplate.xsl is incorrect. position() != last() checks if the current node is the last node, but the expression appears in an <xsl:if> block. So, if the last node doesn't satisfy the condition of the <xsl:if> block, then an extra comma is generated and the generated code won't compile.
Andreas On Wed, Mar 20, 2013 at 11:20 PM, Shah, Sumit (CGI Federal) <sumit.s...@cgifederal.com> wrote: > I did some research and it’s the code/XSL in JaxbRIDatabindingTemplate.xsl > that is writing out the portion of the stub that causing the compilation > issue. Unless a concurrency issue, I wonder why consistently in couple of > cases the ‘position() != last()’ seems to be ‘true’ when it should be false. > And hence the additional comma at the end of the last element in the array. > I would appreciate any pointers. > > > > ‘ > > private static final javax.xml.bind.JAXBContext wsContext; > > static { > > javax.xml.bind.JAXBContext jc; > > jc = null; > > try { > > jc = javax.xml.bind.JAXBContext.newInstance( > > <xsl:for-each select="param[not(@type = > preceding-sibling::param/@type)]"> > > <xsl:if test="@type!=''"> > > <xsl:value-of select="@type"/>.class<xsl:if > test="position() != last()">, > > </xsl:if> > > </xsl:if> > > </xsl:for-each> > > ); > > } > > catch ( javax.xml.bind.JAXBException ex ) { > > System.err.println("Unable to create JAXBContext: " + > ex.getMessage()); > > ex.printStackTrace(System.err); > > Runtime.getRuntime().exit(-1); > > } > > finally { > > wsContext = jc; > > } > > } > > ’ > > Thanks > > Sumit > > > > From: Shah, Sumit (CGI Federal) > Sent: Wednesday, March 20, 2013 3:27 PM > To: java-user@axis.apache.org > Subject: RE: WSImport w JDK 1.6.0_25 and Axis2 1.6.2: Generated stub fails > compilation - Update: Actually issue occurring in WSDL2Code > > > > I take the WSImport part back. It is actually happening with WSDL2Code. It > does not happen if I use the WSDL2Code with Axis2 1.6.0. > > > > The issue is happening with WSDL2Code in Axis2 1.6.2 and I am using Axiom > 1.2.14. Is anyone aware of the issue with 1.6.2? > > > > From: Shah, Sumit (CGI Federal) > Sent: Wednesday, March 20, 2013 11:22 AM > To: java-user@axis.apache.org > Subject: WSImport w JDK 1.6.0_25 and Axis2 1.6.2: Generated stub fails > compilation > > > > Hi, > > > > I am using WSImport to generate the client stubs for a bunch of wsdl files. > After the generation the code fails to compile. I am using this with Axis2 > 1.6.2. The following code block fails: > > > > If you notice: the line: > 'com.sample.test.webservices.impl.participant.Notify.class,' ends with a > comma that shouldn't be there. Ironically it only happens for 2 of the 10 or > so wsdl files I have. Any information would be appreciated. > > > > private static final javax.xml.bind.JAXBContext wsContext; > > static { > > javax.xml.bind.JAXBContext jc; > > jc = null; > > try { > > jc = > javax.xml.bind.JAXBContext.newInstance( > > com.sample.test.webservices.impl.participant.Add.class, > > > com.sample.test.webservices.impl.participant.AddResponse.class, > > > com.sample.test.webservices.exceptions.UnrecoverableFault.class, > > > com.sample.test.webservices.exceptions.RecoverableFault.class, > > > com.sample.test.webservices.impl.participant.Delete.class, > > > com.sample.test.webservices.impl.participant.DeleteResponse.class, > > > com.sample.test.webservices.impl.participant.Select.class, > > > com.sample.test.webservices.impl.participant.SelectResponse.class, > > > com.sample.test.webservices.impl.participant.AddChange.class, > > > com.sample.test.webservices.impl.participant.AddChangeResponse.class, > > > com.sample.test.webservices.impl.participant.Query.class, > > > com.sample.test.webservices.impl.participant.QueryResponse.class, > > > com.sample.test.webservices.impl.participant.Update.class, > > > com.sample.test.webservices.impl.participant.UpdateResponse.class, > > > com.sample.test.webservices.impl.participant.Change.class, > > > com.sample.test.webservices.impl.participant.ChangeResponse.class, > > > com.sample.test.webservices.impl.participant.Synchronize.class, > > > com.sample.test.webservices.impl.participant.SynchronizeResponse.class, > > > com.sample.test.webservices.impl.participant.Notify.class, > > > > ); > > } > > catch ( javax.xml.bind.JAXBException ex ) { > > System.err.println("Unable to create JAXBContext: " + > ex.getMessage()); > > ex.printStackTrace(System.err); > > Runtime.getRuntime().exit(-1); > > } > > finally { > > wsContext = jc; > > } > > } --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org For additional commands, e-mail: java-user-h...@axis.apache.org