1 Reply Latest reply on Mar 28, 2007 3:25 PM by jason.greene

    Marshalling

    vitor_b

      Hello

      Since there is no user forum dedicated for unmarshalling and marshalling problems i think this is the best place where i can ask question related to these topics.

      Ususally our Webservice get xml document, unmarshall it, do some business logic, then marshall result and send it to caller. Marshalling and unmarshalling are done automatically.

      Now i would like to marshall my output object manually. I have my object and xml schema. It looks like i have everything i need. But i really don't know how to do it. There should be very simple API enables that funcionality. But i found two things: JbossXB and JAXB.

      1. JbossXB
      There is a big problem. For every class we want to marshall we need class which implements interface ObjectModelProvider. I've taken a look at example: http://wiki.jboss.org/wiki/Wiki.jsp?page=ObjectModelProvider
      Provider classes are not very simple. And my output is much more complex that that one used in this example. I have no time to write so many Providers for my classes. Besides of lack of time there is one more importnat reason. This object can be changed.
      Unfortunately there is no other way to marshall with JbossXb using my xml schema.

      2. JAXB
      This is the second way i know. But examples i saw need so many generated classes and interfaces. This is not a problem. But where generating all this stuff interfaces and business classes are also generated. These classes are used for marshalling. But i have my own business classes, and these ones don't implements so many interfaces like:
      com.sun.xml.bind.RIElement, com.sun.xml.bind.JAXBObject, primer.po.impl.runtime.UnmarshallableObject, primer.po.impl.runtime.XMLSerializable, primer.po.impl.runtime.ValidatableObject


      So my one question is; how to mashall my business doc using my xml schema? Is there way to do that?

      Any sugestions are really welcome, becouse i'm really lost.
      Thank you in advance.

      vitor_b

        • 1. Re: Marshalling
          jason.greene

          JAXB is the way to go, make sure you are using the latest version though. The generated classes should only be referring to standard apis.

          -Jason