axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amila Chinthaka Suriarachchi (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (AXIS2-4191) Axis2 Generated Client: UnExpected SubElement error while processing Response.
Date Wed, 05 Jan 2011 11:31:49 GMT

     [ https://issues.apache.org/jira/browse/AXIS2-4191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Amila Chinthaka Suriarachchi resolved AXIS2-4191.
-------------------------------------------------

    Resolution: Fixed

I tested with this code segment with the generated code.

String xmlString = "<ContactNumbers xmlns=\"http://www.opentravel.org/OTA/2003/05\">\n"
+
                "<ContactNumber PhoneNumber=\"1-305-4469000\" PhoneTechType=\"1\" PhoneUseType=\"5\"/>\n"
+
                "<ContactNumber PhoneNumber=\"1-305-4471189\" PhoneTechType=\"3\" PhoneUseType=\"5\"/>\n"
+
                "</ContactNumbers>";

        try {
            XMLStreamReader xmlStreamReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(xmlString.getBytes()));
            ContactNumbers_type0 result = ContactNumbers_type0.Factory.parse(xmlStreamReader);
            System.out.println("Result ==> " + result.getContactNumber().length);
        } catch (XMLStreamException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }

issue should have already fixed.

> Axis2 Generated Client: UnExpected SubElement error while processing Response.
> ------------------------------------------------------------------------------
>
>                 Key: AXIS2-4191
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4191
>             Project: Axis2
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.4.1
>         Environment: Windows Vista
>            Reporter: Nateshan Soundarapandian
>            Assignee: Amila Chinthaka Suriarachchi
>            Priority: Critical
>         Attachments: FS_OTA_HotelAvailRQ.xsd, FS_OTA_HotelAvailRS.xsd, HotelAvailability.wsdl
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> Axis generated client is throwing an Unexpected subelement Exception while processing
the response from the Web Service. The Response Schema Seems to be well defined. Please advice.
>  
> Exception: 
> org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException:
> Unexpected subelement ContactNumber
> 	at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
> 	at org.opentravel.www.ota._2003._05.HotelAvailabilityStub.fromOM(HotelAvailabilityStub.java:363)
> 	at org.opentravel.www.ota._2003._05.HotelAvailabilityStub.HotelAvailabilityOperation(HotelAvailabilityStub.java:191)
> 	at com.ihg.ws.cxf.servlets.HotelAvailability.doGet(HotelAvailability.java:211)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:114)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:91)
> 	at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:103)
> 	at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:187)
> 	at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
> 	at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:270)
> 	at com.caucho.server.port.TcpConnection.run(TcpConnection.java:678)
> 	at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721)
> 	at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643)
> 	at java.lang.Thread.run(Thread.java:595)
> Generated Code (Where I believe the problem is): 
> 					while (!loopDone1) {
> 						// We should be at the end element, but make sure
> 						while (!reader.isEndElement())
> 							reader.next();
> 						// Step out of this element
> 						reader.next();
> 						// Step to next element event.
> 						while (!reader.isStartElement()
> 								&& !reader.isEndElement())
> 							reader.next();
> 						if (reader.isEndElement()) {
> 							// two continuous end elements means we are exiting
> 							// the xml structure
> 							loopDone1 = true;
> 						} else {
> 							if (new javax.xml.namespace.QName(
> 									"http://www.opentravel.org/OTA/2003/05",
> 									"ContactNumber").equals(reader.getName())) {
> 								list1
> 										.add(org.opentravel.www.ota._2003._05.TelephoneInfoType.Factory
> 												.parse(reader));
> 							} else {
> 								loopDone1 = true;
> 							}
> 						}
> 					}
> Response xml Schema Where the element ContactNumbers are defined (I will upload the complete
schemas as well):
> <xs:element name="ContactNumbers" minOccurs="0">
> 				<xs:complexType>
> 					<xs:sequence>
> 						<xs:element name="ContactNumber" type="TelephoneInfoType" minOccurs="0" maxOccurs="unbounded">
> 							<xs:annotation>
> 								<xs:documentation xml:lang="en">Contact numbers of the hotel property.
Examples are telephone and fax  numbers.            
>                                                                </xs:documentation>
> 							</xs:annotation>
> 						</xs:element>
> 					</xs:sequence>
> 				</xs:complexType>
> 			</xs:element>
> Response XML Segment:
> <ContactNumbers>
> <ContactNumber PhoneNumber="1-305-4469000" PhoneTechType="1" PhoneUseType="5"/>
> <ContactNumber PhoneNumber="1-305-4471189" PhoneTechType="3" PhoneUseType="5"/>
> </ContactNumbers>
> The first ContactNumber element is being processed fine, But the exception is thrown
in the second element.
> Please Note: I will only email the complete response xml if you need it. I cannot attach
it to the issue.
> Wsdl2Java Command used to generate the client:
> wsdl2java.bat -uri C:\HotelAvailability_.wsdl -o C:\AxisClient p com.ihg.ws -d adb -s
-t -u -sn HotelAvailability -pn HotelAvailabilitySOAP -Ew false -ns2p 
> Many Thanks for your time and attention,
> Nateshan

-- 
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: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Mime
View raw message