axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan" <...@mcenter.com>
Subject first Document Style client
Date Mon, 13 Jan 2003 21:03:54 GMT
I'm just getting started with XML, SOAP, and Axis.  I'm in the early
"figuring it out" stages.  For experience, I'd like to try writing a bare
bones client to get the service at:

	http://www.webservicex.net/uszip.asmx

using the GetInfoByZipCode function.  I've written an RPC client that can
communicate with the service, but I don't know how to handle the
<NewDataSet> and child elements, since this is a document type service.

I get a 

    [ERROR] Call - -Exception: <org.xml.sax.SAXException: SimpleDeserializer 
    encountered a child element, which is NOT expected, in something it 
    was trying to deserialize.>

because I'm expecting a string return type but get a NewDataSet with
children elements.


I'm aware of the WSDL2Java tool, but since I'm learning I prefer to "write
it myself" so I can get a better understanding of what's going on.  I'm
guessing that the "NewDataSet" element is defined somewhere on the site and
I'd use this to parse the XML portion of the return.

If someone could give a little insight as to what the steps would be to do
this, I'd be thankful.  Is the "XML-portion" (<NewDataSet>) of the return
available in my Call object (or someway to get it)?  Once I get the result
XML, what do I use to parse the XML elements "automatically" using the
<NewDataSet> definition?



The service returns this XML:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
  <GetInfoByZIPResponse xmlns="http://www.webserviceX.NET">
    <GetInfoByZIPResult>
      <NewDataSet xmlns="">
        <Table>
          <CITY>Forest Park</CITY>
          <STATE>GA</STATE>
          <ZIP>30297</ZIP>
          <AREA_CODE>404</AREA_CODE>
          <TIME_ZONE>E</TIME_ZONE>
        </Table>
      </NewDataSet>
    </GetInfoByZIPResult>
  </GetInfoByZIPResponse>
</soap:Body></soap:Envelope>



Mime
View raw message