2 Replies Latest reply on Jul 2, 2008 2:42 AM by jayasreeb

    Urgent Step Required-converting XML to JavaObjects using Castor in FUSEESB

    jayasreeb

      Hi

       

      I need to convert XML to Java Objects(UnMarshalling) Using Castor in Fuse ESB.I have executed this successfully in Normal Java Platform.I need to know do the same in FUSE ESB platform.COuld you please provide me the steps to perform unmarshalling usign Castor in Fuse ESB?

       

      1.In castor We need to place few jar files like castor-1.2.jar etc..In Java platform I will be adding it to classpath.In case of Fuse ESB where do I need to place these jar files?

       

      2.I will be using Castor source Code generator to generate a set of classes which represent an object-model for the XML Schema.In normal java platform i will be giving path where it need to generate the Java Class in build.xml file and on running Ant script i will be getting Java Classes as per the path mentioned.In case of FUSE ESB how will I be generating Java classes and where will I place these generated Java Classes?

       

      3.During Unmarshalling I need to mention the xml file location.In case of Fuse ESB where do i need to place xml file and how do I need to mention the path in pom file/xbean file?

       

      4.I need to place an XSD for given XML so that duing ant build for source code generation i can generate java classes.How can I perform this in Fuse ESB.

       

      It would be of great help if you provide me solution for this

       

      Thanks in Advance

      Jayasree.B

        • 1. Re: Urgent Step Required-converting XML to JavaObjects using Castor in FUSEESB
          gertv

          Jayasree.B,

           

          The best way to do this is by using a servicemix-bean SU and adding the necessary code there.

           

          jayasreeb wrote:

           

          1.In castor We need to place few jar files like castor-1.2.jar etc..In Java platform I will be adding it to classpath.In case of Fuse ESB where do I need to place these jar files?

           

          If you are using Maven to build your SU, you add those dependencies to the pom.xml (<dependency/>).  This way, the jar files will be packaged with the SU for you automatically.

           

          jayasreeb wrote:

           

          2.I will be using Castor source Code generator to generate a set of classes which represent an object-model for the XML Schema.In normal java platform i will be giving path where it need to generate the Java Class in build.xml file and on running Ant script i will be getting Java Classes as per the path mentioned.In case of FUSE ESB how will I be generating Java classes and where will I place these generated Java Classes?

           

          Well, you can actually use the same technique.  As long as you make sure you add the resulting classes to the SU, the way you generate them would be the same.  Maven allows you to run Ant scripts as part of the build process.  I would use that to automate source code generation.

           

          jayasreeb wrote:

           

          3.During Unmarshalling I need to mention the xml file location.In case of Fuse ESB where do i need to place xml file and how do I need to mention the path in pom file/xbean file?

           

          Again, just put it on the classpath and load it from there (e.g. src/main/resouces).  There shouldn't be too much of a difference with how you do these things in a standalone environment -- Maven can take of JBI packaging specifics for you.

           

          jayasreeb wrote:

           

          4.I need to place an XSD for given XML so that duing ant build for source code generation i can generate java classes.How can I perform this in Fuse ESB.

           

          I would also add this to src/main/resources as any ordinary resource in your project.  As long as the Caster code generator can access the location, any location should do fine.

           

          Regards,

           

          Gert

          • 2. Re: Urgent Step Required-converting XML to JavaObjects using Castor in FUSEESB
            jayasreeb

            Hi

             

            You mentioned to use servicemix bean su.Can you tell me how can I use this in Fuse ESB?I need to expose the castor generated classes as JMS web service and I need to call it from Java Program. How Can I do this?Could you please explain me with steps?