1 2 Previous Next 28 Replies Latest reply on Aug 26, 2010 1:59 AM by sukhdev singh

    Wise based soap client for esb

    Stefano Maestri Expert

      Hi all,

      I wrote an alternative soap client action for esb.

      The client is based on my open LGPL software wise:
      http://sourceforge.net/projects/jax-wise
      http://www.javalinuxlabs.org/wise/index.html

      It uses wsconsume API to dynamically generate client object and invoke web service, delagating to JBossWS JAX-WS implementation the dirty job.
      It use smooks under the hood to transform user defined object into JAX-WS generated ones.

      It support also standard JAX-WS handler and a generic smooks transformation handler to apply transformation to generated soap messages.

      You can find it in my workspace under product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/
      I also wrote javadoc for the action class explaining how to use it and e example demonstrating 3 common use case:

      * Direct call of a simple service without any mapping is needed
      * Call of a service using a smooks mapper java-to-java
      * Call a simple webservices without mapping, but with an handler
      modifying header with smooks and an handler logging on System.out
      request and response
      In this 3 examples don't forget to have a look to wise-core.properties for some important configs. Of course they could be integrated in action's config in jboss-esb.xml in next future, but this first implementation leave them there.

      On wise roadmap I have the implementation of webservices' call receiving different resources (CSV, XML and so on) using smooks to map it on JAX-WS generated client objects, giving another interesting opportunity in ESB environment.

      It is an initial implementation, and I need to integrate wise objects generation with new smooks configgenerator ( http://milyn.codehaus.org/Smooks+User+Guide#SmooksUserGuide-GeneratingtheSmooksBindingConfiguration) to make user experience easier. I already had a look, but I'm very very busy in these days and hopefully I can put my mind on in 2 weeks or so.
      In the mean time, it would be very good if someone could take a look to current initial implementation and to 3 examples and give his feedback.

      thanks in advance

        • 1. Re: Wise based soap client for esb
          Stefano Maestri Expert

           

          "maeste" wrote:

          I also wrote javadoc for the action class explaining how to use it and e example demonstrating 3 common use case:


          product/samples/quickstarts/webservice_consumer_wise
          product/samples/quickstarts/webservice_consumer_wise2
          product/samples/quickstarts/webservice_consumer_wise3

          • 2. Re: Wise based soap client for esb
            Jeff DeLong Master

            I checked out your workspace, and ran ant dist. Got the following error:

            [java] compile:
            [java] [javac] Compiling 6 source files to /shared/workspace/ws-wise/product/services/soap/build/classes
            [java] [javac] /shared/workspace/ws-wise/product/services/soap/src/main/java/org/jboss/soa/esb/actions/soap/wise/SOAPClient.java:25: cannot access it.javalinux.wise.core.client.InvocationResult
            [java] [javac] bad class file: /shared/workspace/ws-wise/product/services/soap/lib/ext/Wise-core.jar(it/javalinux/wise/core/client/InvocationResult.class)
            [java] [javac] class file has wrong version 50.0, should be 49.0
            [java] [javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
            [java] [javac] import it.javalinux.wise.core.client.InvocationResult;
            [java] [javac] ^
            [java] [javac] 1 error

            [java] BUILD FAILED
            [java] /shared/workspace/ws-wise/product/build.xml:210: The following error occurred while executing this line:
            [java] /shared/workspace/ws-wise/product/services/build.xml:11: The following error occurred while executing this line:
            [java] /shared/workspace/ws-wise/product/services/soap/base-project-build.xml:56: Compile failed; see the compiler error output for details.

            [java] Total time: 51 seconds

            BUILD FAILED
            /shared/workspace/ws-wise/product/build.xml:474: The following error occurred while executing this line:
            /shared/workspace/ws-wise/product/build.xml:96: Java returned: 1


            Any thoughts?

            Thanks,

            Jeff

            • 3. Re: Wise based soap client for esb
              Kevin Conner Master

               

              "jeffdelong" wrote:
              class file has wrong version 50.0, should be 49.0

              Looks like that library is compiled with JDK6. Can we have a JDK5 version?

              • 4. Re: Wise based soap client for esb
                Stefano Maestri Expert

                yep,
                my fault. Sorry for that...I'm playing with openjdk these days.

                I've just committed right library.

                • 5. Re: Wise based soap client for esb
                  Jeff DeLong Master

                  That worked, thanks.

                  I have a question about how you would recommend handling ws-security and ws-transaction information. How would you recommend this be added to the SOAP Header?

                  I have been working with JBoss Transaction XTS component, and have created a quickstart showing ws transactions business activity. But I had to add the transaction context to the SOAPHeader and invoke the web service through my own custom action. I would rather use SOAPClient.

                  • 6. Re: Wise based soap client for esb
                    Stefano Maestri Expert

                     

                    "jeffdelong" wrote:

                    I have a question about how you would recommend handling ws-security and ws-transaction information. How would you recommend this be added to the SOAP Header?
                    I have been working with JBoss Transaction XTS component, and have created a quickstart showing ws transactions business activity. But I had to add the transaction context to the SOAPHeader and invoke the web service through my own custom action. I would rather use SOAPClient.


                    well, wise natively support JAX-WS handler to modify SOAP Header. Wise-core support 3 kind of handler: a simple logging handler (to log request and response message), Smooks handler (to transfor header, supporting freemarker too), and custom handler to add any kind of JAX-WS compliant handler. The current implementation of ESB action just support Logging and Smooks ones, but it would be easy to add custom handler too.
                    Anyway Smooks handler have always done the job for me, being very powerful and flexible modifying headers.
                    The third quikstart sample I wrote demostrate a simple use of Smooks handler. It is a very simple use case, but keep in mind you have there all the Smooks' powers ;)

                    Does this answer your question? Do you need something more?


                    • 7. Re: Wise based soap client for esb
                      Jeff DeLong Master

                      Thanks for your reply. Do you plan to add support for custom handlers to the ESB Action? I think this would be easier that using Smooks to transform the header.

                      • 8. Re: Wise based soap client for esb
                        Jeff DeLong Master

                        Also, it is very strange. I am sure I ran all three successfully yesterday, but today I continue to get the exception:

                        11:13:36,793 ERROR [STDERR] it.javalinux.wise.core.exceptions.WiseConnectionException: Wsdl download failed!
                        11:13:36,793 ERROR [STDERR] at it.javalinux.wise.core.client.WSDynamicClientFactory.transferWSDL(WSDynamicClientFactory.java:205)
                        11:13:36,793 ERROR [STDERR] at it.javalinux.wise.core.client.WSDynamicClientFactory.getUsableWSDL(WSDynamicClientFactory.java:149)
                        11:13:36,793 ERROR [STDERR] at it.javalinux.wise.core.client.WSDynamicClientFactory.getClient(WSDynamicClientFactory.java:109)
                        11:13:36,793 ERROR [STDERR] at org.jboss.soa.esb.actions.soap.wise.SOAPClient.process(SOAPClient.java:250)
                        11:13:36,793 ERROR [STDERR] at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:316)
                        11:13:36,793 ERROR [STDERR] at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:530)
                        11:13:36,793 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
                        11:13:36,793 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
                        11:13:36,793 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
                        11:13:36,793 ERROR [STDERR] Caused by: java.io.FileNotFoundException: /home/oracle/wise/Wise7.xml (No such file or directory)
                        11:13:36,793 ERROR [STDERR] at java.io.FileOutputStream.open(Native Method)
                        11:13:36,793 ERROR [STDERR] at java.io.FileOutputStream.(FileOutputStream.java:179)
                        11:13:36,793 ERROR [STDERR] at java.io.FileOutputStream.(FileOutputStream.java:131)
                        11:13:36,793 ERROR [STDERR] at it.javalinux.wise.core.client.WSDynamicClientFactory.transferWSDL(WSDynamicClientFactory.java:197)
                        11:13:36,793 ERROR [STDERR] ... 8 more


                        even though I have changed the wise.properties and re-deployed (many times!)

                        • 9. Re: Wise based soap client for esb
                          Jeff DeLong Master

                          I ran ant clean dist to rebuild the server, changed the wise.properties, and got the same error (but with the correct directory).

                          12:39:58,012 INFO [STDOUT] &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
                          12:39:58,014 INFO [STDOUT] Request map is: {toWhom=Jimbo}
                          12:39:58,014 INFO [STDOUT] &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
                          12:39:58,196 ERROR [STDERR] it.javalinux.wise.core.exceptions.WiseConnectionException: Wsdl download failed!
                          12:39:58,196 ERROR [STDERR] at it.javalinux.wise.core.client.WSDynamicClientFactory.transferWSDL(WSDynamicClientFactory.java:205)
                          12:39:58,196 ERROR [STDERR] at it.javalinux.wise.core.client.WSDynamicClientFactory.getUsableWSDL(WSDynamicClientFactory.java:149)
                          12:39:58,196 ERROR [STDERR] at it.javalinux.wise.core.client.WSDynamicClientFactory.getClient(WSDynamicClientFactory.java:109)
                          12:39:58,196 ERROR [STDERR] at org.jboss.soa.esb.actions.soap.wise.SOAPClient.process(SOAPClient.java:250)
                          12:39:58,196 ERROR [STDERR] at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:316)
                          12:39:58,196 ERROR [STDERR] at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:530)
                          12:39:58,196 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
                          12:39:58,196 ERROR [STDERR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
                          12:39:58,196 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
                          12:39:58,196 ERROR [STDERR] Caused by: java.io.FileNotFoundException: /shared/software/wise/Wise0.xml (No such file or directory)
                          12:39:58,196 ERROR [STDERR] at java.io.FileOutputStream.open(Native Method)
                          12:39:58,196 ERROR [STDERR] at java.io.FileOutputStream.(FileOutputStream.java:179)
                          12:39:58,196 ERROR [STDERR] at java.io.FileOutputStream.(FileOutputStream.java:131)
                          12:39:58,197 ERROR [STDERR] at it.javalinux.wise.core.client.WSDynamicClientFactory.transferWSDL(WSDynamicClientFactory.java:197)
                          12:39:58,197 ERROR [STDERR] ... 8 more
                          12:39

                          • 10. Re: Wise based soap client for esb
                            Jeff DeLong Master

                            I should add, the file Wise0.xml is in the specified directory.

                            • 11. Re: Wise based soap client for esb
                              Jeff DeLong Master

                              Sorry for the many replies. The previous values of wise.tmpDir in wise.properties was still incorrect. I ran ant clean dist, specified the correct directory, and the examples worked.

                              • 12. Re: Wise based soap client for esb
                                Stefano Maestri Expert

                                 

                                "jeffdelong" wrote:
                                Sorry for the many replies. The previous values of wise.tmpDir in wise.properties was still incorrect. I ran ant clean dist, specified the correct directory, and the examples worked.


                                sorry...I loose you...are there a problem or it was just a config problem?
                                Sorry for the question, but I'm a bit confused...ant clean dist from where? Just example right?


                                • 13. Re: Wise based soap client for esb
                                  Stefano Maestri Expert

                                   

                                  "jeffdelong" wrote:
                                  Thanks for your reply. Do you plan to add support for custom handlers to the ESB Action? I think this would be easier that using Smooks to transform the header.

                                  Yep I'll add this support in next future, a soon I find an hour to implement and test it...it's really easy, but I'm really busy in these weeks..sorry.

                                  Anyway, I'm little curious what is the difficult you have with smooks handler. Do you really thing is easier to write a JAX-WS handler?
                                  Even if in some case I can see the usefulness of custom handler (and the ability to add chain of handler mixing custom, smooks, and eventually predefined handler), I'd like to know your, and others opinion about.
                                  Writing wise and esb-wise action I always keep in mind the ability to write complex webservice task rapidly and easily (BTW wise means Wise Invoke Services Easily), and smooks handler seems to me perfectly fitting in this approach. If they aren't I'd like to understand where I'm wrong in my thought.
                                  Thanks for feedbacks


                                  • 14. Re: Wise based soap client for esb
                                    Jeff DeLong Master

                                    As for the problems with the wise.properties, the issues seems to be with re-deployment. If I change wise.properties, or in another case, I changed smooks-handler.xml, ant then do ant undeploy, ant deploy, ant runtest, I still see the same results,

                                    1 2 Previous Next