Results 1 to 2 of 2

Thread: sample for messageconverter using e.g. jaxb, xstream

  1. #1
    Join Date
    Jun 2007
    Posts
    15

    Default sample for messageconverter using e.g. jaxb, xstream

    Hello,

    I wanted to have some sample code for custom MessageConverter for marshalling/unmarshalling to/from XML using jaxb or xstream. Does anyone have a sample that you can share?

  2. #2
    Join Date
    May 2006
    Location
    Paris France
    Posts
    19

    Default JaxbMessageConverter implementation

    Here is an implementation of JaxbMessageConverter that rely on Spring WS Jaxb2Marshaller.
    We decided to rely on Jaxb2Marshaller to to leverage all the customization available in this marshaller, in particular all the schema based validation mechanism.

    Code

    Code is available on Xebia's demo subversion repository : http://xebia-france.googlecode.com/s...essaging-demo/ Spring Configuration Sample
    Code:
       <bean id="jaxbMessageConverter" class="fr.xebia.springframework.jms.support.converter.JaxbMessageConverter">
          <property name="classesToBeBound">
             <list>
                <value>fr.xebia.sample.messaging.Employee</value>
                <value>fr.xebia.sample.messaging.Gender</value>
             </list>
          </property>
       </bean>
    Maven2 pom.xml

    Add following dependencies :

    Code:
    <project ...>
       <dependencies>
          ...
          <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-jms</artifactId>
             <version>${spring.version}</version>
          </dependency>
          <dependency>
             <groupId>org.springframework.ws</groupId>
             <artifactId>spring-oxm-tiger</artifactId>
             <version>1.0.3</version>
          </dependency>
          ...
       </dependencies>
    </project>
    Hope this helps,

    Cyrille

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •