7 Replies Latest reply on Aug 30, 2011 11:02 AM by mannuyi

    Smooks to transform incoming SOAP msg

      How to use Smooks (which action/s) to transform and validate an incoming SOAP message?

        • 1. Re: Smooks to transform incoming SOAP msg

          Trying to use SmooksAction with a smooks-resource file having the transformation logic.
          Getting the following exception while building the project:
          Caused by: java.lang.reflect.InvocationTargetException
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
          orAccessorImpl.java:39)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
          onstructorAccessorImpl.java:27)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
          at org.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.getActi
          onClassInstance(ActionProcessorMethodInfo.java:355)
          ... 52 more
          Caused by: org.jboss.soa.esb.ConfigurationException: Failed to create Smooks ins
          tance for config '/smooks-res.xml'.
          at org.jboss.soa.esb.smooks.SmooksAction.(SmooksAction.java:145)
          ... 57 more
          Caused by: java.io.IOException: Failed to access data stream for resource [/smoo
          ks-res.xml]. Tried filesystem, classpath and URL.

          What cud be wrong? The file is present in the same folder as the jboss-esb.xml

          • 2. Re: Smooks to transform incoming SOAP msg
            beve

            Try puttting it in the root of the .esb archive.

            • 3. Re: Smooks to transform incoming SOAP msg

              Thanks a bunch. That resolved it.

              A side question, how to validate an incoming soap message on the esb?

              • 4. Re: Smooks to transform incoming SOAP msg
                beve

                You can specify a schema for request, response and faults like this:

                <actions inXsd="/request.xsd" outXsd="/response.xsd" faultXsd="/fault.xsd" validate="true">
                 <action name="action" class="org.jboss.soa.esb.samples.quickstart.publishAsWebservice.ESBWSListenerAction" process="displayMessage"/>
                </actions>
                

                Settting validate to true will validate the data. The example above is from the publish_as_webservice quickstart. Take a look at it and see if this would work for you use case.

                Regards,

                /Daniel

                • 5. Re: Smooks to transform incoming SOAP msg

                  Thanks, Daniel.
                  Will try that out.
                  Do MessageFilter or Drools offer any benefit for validations?

                  • 6. Re: Smooks to transform incoming SOAP msg
                    clsimone

                    Hello Casper,

                     

                    I know the post is old... but could you please post an example on how to transform a SOAP message? Or do you know where I could find an example. I'm looking for solutions to transform namespaces, operation names and parameter values.

                     

                    Thank you.

                    Laura

                    • 7. Re: Smooks to transform incoming SOAP msg
                      mannuyi

                      Please refer to jbossesb-4.10\samples\quickstarts\transform_XML2POJO