1 Reply Latest reply on Sep 23, 2011 4:09 AM by andre-s-2010

    ESB - Webservice - Smooks Mapping

    andre-s-2010

      Hey guys,

      actually i am playing around with jboss esb and smooks.

       

       

      I've created an ESB service that is exposed as a webservice.

      Inside the ESB Service the request should be mapped via Smooks to the response

      and send back to the webservice caller. Problem now is that i dont get the smooks mapping

      running. :-(

       

      Here is my esb config which is working fine.

       

      <?xml version="1.0"?>

      <jbossesb parameterReloadSecs="5"

      xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.3.0.xsd"

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.3.0.xsd http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.3.0.xsd">

      <services>

        <service category="ChaabpServices"

         description="EsbService with operations for DemandProcess"

         invmScope="GLOBAL" name="EsbDemandProcess">

         <actions inXsd="/request.xsd" mep="RequestResponse"

          outXsd="/response.xsd" requestLocation="DemandProcessRequest"

          responseLocation="DemandProcessResponse" validate="true" webservice="true">

          <action class="de.tigerbytes.esb.demandprocess.DemandProcessActions"

           name="GetTasksForAmbulancePartner" process="getTasks4AmbulancePartner"/>

          <action class="org.jboss.soa.esb.smooks.SmooksAction" name="TransformInput">

           <property name="smooksConfig" value="/META-INF/smooks-config.xml"/>

           <property name="get-payload-location" value="DemandProcessRequest"/>

           <property name="set-payload-location" value="DemandProcessResponse"/>

           <property name="resultType" value="JAVA"/>

          </action>

          <action class="de.tigerbytes.esb.demandprocess.DemandProcessActions"

           name="PrintMessageBody" process="checkTransformation"/>

         </actions>

        </service>

      </services>

      </jbossesb>

       

       

      Here is my Smooks Config

       

      <?xml version="1.0" encoding="UTF-8"?><smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd" xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.2.xsd">

        <params>

          <param name="inputType">input.java</param>

          <param name="default.serialization.on">true</param>

          <param name="stream.filter.type">SAX</param>

          <param name="input.java" type="input.type.actived">de.tigerbytes.esb.demandprocess.DemandProcessRequest</param>

        </params>

        <jb:bean beanId="DemandProcessResponse" class="de.tigerbytes.esb.demandprocess.DemandProcessResponse" createOnElement="de.tigerbytes.esb.demandprocess.DemandProcessRequest">

          <jb:value data="/de.tigerbytes.esb.demandprocess.DemandProcessRequest/processName" property="success"/>

        </jb:bean>

      </smooks-resource-list>

       

       

      As you can see i tryed to use an object mapping, because the request could be found as an object in the Message object.

      Is that correct?

      I also tryed XML 2 Object and XML 2 XML Mappings, but nothing works.

       

      May be somebody could help.

      THX

        • 1. Re: ESB - Webservice - Smooks Mapping
          andre-s-2010

          log from the console

           

          10:05:39,202 INFO  [STDOUT] Message Body before Transformation: body: [ objects: {DemandProcessRequest=<req:DemandProcessRequest xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://www.tigerbytes.de/esb/requdemandprocess">

                   <!--type: int-->

                   <req:ProcessId>3</req:ProcessId>

                   <!--type: string-->

                   <req:ProcessName>test</req:ProcessName>

                   <!--type: ProcessOperation - enumeration: [START,STOP,SUSPEND,RESUME]-->

                   <req:Operation>STOP</req:Operation>

                </req:DemandProcessRequest>} ]

          10:05:39,203 INFO  [STDOUT] got jbpm context: JbpmContext(jbpm.cfg.xml)

          10:05:39,211 INFO  [STDOUT] 27

          10:05:39,211 INFO  [STDOUT] chaabpdemandprocess

          10:05:39,211 INFO  [STDOUT] found 2 jbpm tasks...

          10:05:39,213 INFO  [STDOUT] body name: DemandProcessRequest

          10:05:39,213 INFO  [STDOUT] body: [ objects: {DemandProcessRequest=<req:DemandProcessRequest xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://www.tigerbytes.de/esb/requdemandprocess">

                   <!--type: int-->

                   <req:ProcessId>3</req:ProcessId>

                   <!--type: string-->

                   <req:ProcessName>test</req:ProcessName>

                   <!--type: ProcessOperation - enumeration: [START,STOP,SUSPEND,RESUME]-->

                   <req:Operation>STOP</req:Operation>

                </req:DemandProcessRequest>} ]

          10:05:39,611 INFO  [STDOUT] Message Body after Transformation: body: [ objects: {DemandProcessResponse={}, DemandProcessRequest=<req:DemandProcessRequest xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://www.tigerbytes.de/esb/requdemandprocess">

                   <!--type: int-->

                   <req:ProcessId>3</req:ProcessId>

                   <!--type: string-->

                   <req:ProcessName>test</req:ProcessName>

                   <!--type: ProcessOperation - enumeration: [START,STOP,SUSPEND,RESUME]-->

                   <req:Operation>STOP</req:Operation>

                </req:DemandProcessRequest>, SmooksExecutionContext={}} ]

           

           

          As you can see the webservice has been called and the request is logged to the console.

          Then there is an Action Task dealing with JBPM and after that there comes the Smooks Action.

          After transformation / mapping the DemandProcessResponse was added to the Message but it is null.