Axis2 Generated Client: UnExpected SubElement error while processing Response.
------------------------------------------------------------------------------
Key: AXIS2-4191
URL: https://issues.apache.org/jira/browse/AXIS2-4191
Project: Axis 2.0 (Axis2)
Issue Type: Bug
Components: adb
Affects Versions: 1.4.1
Environment: Windows Vista
Reporter: Nateshan Soundarapandian
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.