Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 60109 invoked from network); 2 Jun 2006 10:44:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Jun 2006 10:44:29 -0000 Received: (qmail 28098 invoked by uid 500); 2 Jun 2006 10:44:26 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 27996 invoked by uid 500); 2 Jun 2006 10:44:26 -0000 Mailing-List: contact axis-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-dev@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-dev@ws.apache.org Received: (qmail 27985 invoked by uid 99); 2 Jun 2006 10:44:25 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Jun 2006 03:44:25 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Jun 2006 03:44:25 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 0A6267141E8 for ; Fri, 2 Jun 2006 10:43:31 +0000 (GMT) Message-ID: <18084210.1149245011039.JavaMail.jira@brutus> Date: Fri, 2 Jun 2006 10:43:31 +0000 (GMT+00:00) From: "Ajith Harshana Ranabahu (JIRA)" To: axis-dev@ws.apache.org Subject: [jira] Resolved: (AXIS2-768) WSDL2Java (via Eclipse plugin) generates code with a bug In-Reply-To: <29475191.1148606875759.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/AXIS2-768?page=all ] Ajith Harshana Ranabahu resolved AXIS2-768: ------------------------------------------- Resolution: Fixed Peter has verified that this issue is solved and hence I'm marking this issue as solved. As for replacing the template, you did the right thing :) > WSDL2Java (via Eclipse plugin) generates code with a bug > -------------------------------------------------------- > > Key: AXIS2-768 > URL: http://issues.apache.org/jira/browse/AXIS2-768 > Project: Apache Axis 2.0 (Axis2) > Type: Bug > Environment: Windows XP Pro, SP2 > Axis2 (version 1.0), Eclipse plugin version 1.0 > Eclipse 3.1.2 > Reporter: Peter Smith > Assignee: Ajith Harshana Ranabahu > Attachments: ADBBeanTemplate.xsl.patch > > [Still new to web services.] > I generated some client code, sync style only, with adb binding. > Error occurs when running client (service-consuming) code generated by the Eclipse plugin: > "java.lang.RuntimeException: java.lang.RuntimeException: Unexpected subelement StadiumInfo" > WSDL location here ( http://www.xmethods.com/ve2/ViewListing.po;jsessionid=WKLq4DIo6x-jHNRE5dafpPhj(QHyMHiRM)?key=uuid:2ED51A61-68E6-90ED-45B7-E318C299C8C5 ), or here ( http://tinyurl.com/ltook ). > The xml being consumed looks like this (snippet): > ========================================== > > > > > Round 1 > 2006-06-09 > 18:00:00 > > FIFA World Cup Stadium Munich > 59416 > Munich > > > Germany > http://www.dataaccess.nl/wk2006/flags/GERMANY_.jpg > > > Costa Rica > http://www.dataaccess.nl/wk2006/flags/COSTA___.jpg > > U > > 0 > ... > ========================================== > Things go well until 'Team1' (the second complextype) is about to be processed, at which point the 'unexpected subelement' runtime exception occurs. > I'll dive in and take a gander at what's going on - please forgive. It seems the generated code is unaware of the nested/complex nature of the 'StadiumInfo' element as relates to advancing to the next starting element, so when it tries to 'climb out/up' the tree to find the next sibling, it doesn't make it. So, instead of being positioned at the closing 'StadiumInfo' tag upon returning from parsing the 'StadiumInfo' element, it is somewhere a bit deeper - maybe at the whitespace just before the closing 'StadiumInfo' tag. The pre-ordained sequential processing means that the next element sought, in our case 'Team1', will not be found and the RuntimeException occurs. > I was able to get past this error in a couple of ways: > 1) Adding a couple more 'reader.next();' statements just above the test looking for the start of the next element. These statements must be inserted after processing all complex types. > 2) Changing the 'reader.next()' paradigm into one that doesn't pay any attention to depth level or complex types, but just looks at every 'next()' element until it satisfies the conditions we're looking for - that is, that the next starting element we find has the name we want. > Here is the generated code for a typical (simple/not-complex) element. > // do certain number of 'reader.next()' calls to skip whitespace/comments/etc., then hope you're in the right place in the tree (my comment) > if (reader.isStartElement() && > new javax.xml.namespace.QName( > "http://www.dataaccess.nl/wk2006", "sDescription").equals( > reader.getName())) { > // process the current element (my comment) > java.lang.String content = getElementTextProperly(reader); > object.setSDescription(org.apache.axis2.databinding.utils.ConverterUtil.convertTostring( > content)); > And here is another way that I hacked the generated code to get it going: > // what is the qualified name of the next element we're looking for? (my comment) > javax.xml.namespace.QName qname = new javax.xml.namespace.QName("http://www.dataaccess.nl/wk2006", "sDescription"); > // keep moving ahead until you find the element you're looking for (my comment) > while ( ! ( reader.isStartElement() && qname.equals(reader.getName())) ){ > reader.next(); > } > // process the current element (my comment) > java.lang.String content = getElementTextProperly(reader); > object.setSDescription(org.apache.axis2.databinding.utils.ConverterUtil.convertTostring( > content)); > That's it. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org For additional commands, e-mail: axis-dev-help@ws.apache.org