axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anne Thomas Manes" <atma...@gmail.com>
Subject Re: How to parse xml document return type
Date Mon, 02 Oct 2006 12:33:42 GMT
Axis doesn't provide an capabilities to help you parse dynamic
schemas, therefore you will have to do the parsing yourself using
JAXP.

You must package the schema and the instance document within a single
wrapping return element, becuase SOAP requires that the SOAP Body
contains only one child element.

You should use the messaging interface, which converts the body
contents into DOM, which you can then process using JAXP.

Anne

On 10/1/06, Adil Aijaz <adilaijaz@gmail.com> wrote:
> Hello everyone,
>
> I haven't yet come across a similar problem on the user's list so, I thought
> I'll ask.
>
> I am using Axis 1.4 client stubs to invoke a database encapsulating web
> service. Since the response depends upon the query passed as argument to the
> web service operation, therefore, WSDL2Java cannot generate java beans (
> e.g. Phone class from Axis User's Guide) to capture the dynamic return type.
> Instead it generates a response class that captures the response as an array
> of MessageElement objects. One of the  array elements corresponds to an xml
> document containing the query result and the other corresponds to a schema
> document that describes the format of the xml document.  An example of these
> two documents follows. Given these two documents, how can I use Axis or some
> other 3rd party code to extract say the archivetime in the following example
> as a java.util.Calendar object or the UrlID as a byte[][] array?
>
> Schema Example:
> <code>
> <xs:schema id="NewDataSet" // namespace info>
>     <xs:element name="NewDataSet" //namespace info>
>         <xs:complexType>
>             <xs:choice minOccurs="0" maxOccurs="unbounded">
>                 <xs:element name="Table">
>                     <xs:complexType>
>                         <xs:sequence>
>                             <xs:element name="UrlID" type="xs:base64Binary"
> minOccurs="0"/>
>                             <xs:element name="archivetime"
> type="xs:dateTime" minOccurs="0"/>
>                         </xs:sequence>
>                     </xs:complexType>
>                 </xs:element>
>             </xs:choice>
>         </xs:complexType>
>     </xs:element>
> </xs:schema>
> </code>
>
> And a corresponding xml document would be:
>
>  <code>
> <diffgr:diffgram  //namespace info>
>     <NewDataSet xmlns="">
>         <Table diffgr:id="Table1" msdata:rowOrder="0">
>             <UrlID>zrBE/Yw3aTXmwdW/Rk3f/Q==</UrlID>
>
> <archivetime>2005-02-14T06:30:28-05:00</archivetime>
>         </Table>
>     </NewDataSet>
> </diffgr:diffgram>
> </code>
>
> Will appreciate any pointers,
>
>  Adil

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message