Zdenek, thank you. My apologies for my general ignorance. But, if I have nothing but a wsdl, can I use that wsdl in place of the xsd? I'm thinking not since it doesn't appear to work. Other ideas? Do I need to create an xsd via schemagen?

Thanks,
kwade

On May 30, 2007, at 4:20 AM, Zdeněk Vráblík wrote:

Hi,

JAXBContext jc = JAXBContext.newInstance( "package with jaxb classes
for your schema" );

   Unmarshaller u = jc.createUnmarshaller();

   //set validation
   SchemaFactory sf = SchemaFactory.newInstance(
       javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
   Schema schema = sf.newSchema(new File("c:\\temp\\mySchema.xsd"));
   u.setSchema( schema );



   InputStream in = new FileInputStream( "c:\\temp\\myXML.xml" );
   JAXBElement<YourDocumentMainClass> unmarshaled =
(JAXBElement<YourDocumentMainClass>)u.unmarshal(in );

More about JAXB is on page https://jaxb.dev.java.net/ .

XFire uses JAXB 2.0.1.

Regards,
Zdenek

On 5/29/07, Kevin Wade <[EMAIL PROTECTED]> wrote:
I've searched high and low for ideas and answers to no avail.
Perhaps someone out there on the user mailing list has a suggestion.

After receiving a soap response via an xfire client (latest versions,
etc.), I need to store the soap message in a file or a database.  No
problems there.  I'm using an xfire client generated via wsgen using
a wsdl and jaxb bindings.

But... what if I want to later pull the soap message from the file/db
and then unmarshall the XML into the jaxb object representation?  In
other words, how do I utilize xfire's binding mechanism (in this case
jaxb) to parse an xml document retrieved via a file or database but
NOT via a web services call?  I looked over the "Parsing a SOAP
Message without Web Services" -- which seems to be about something
similar (getting at the soap body OR creating a SOAP body -- to no
avail. I can't seem to reverse engineer it so that I can "manually"
bind an xml document to the jaxb created objects.

Any ideas on using xfire's jaxb binding mechanism in this way?

Thanks,
kwade

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list please visit:

   http://xircles.codehaus.org/manage_email

Reply via email to