3 Replies Latest reply on Jun 13, 2012 11:33 AM by Steffen Krause

    CXF services in a war

    spyhunter99 Novice

      Previously with the native stack, i would deploy my services in a war, referencing the service implementation classes from web.xml as servlets. I also had serious of soap handlers that were attached via standard-jaxws-endpoint config xml files.

       

      I'm now experimenting with the cxf stack. The service implementations as servlets in the web.xml work just fine. However, as I'm reading through the documentation here https://community.jboss.org/wiki/JBossWS-StackCXFUserGuide  there's a few things that aren't clear. If I use the jbossws-cxf.xml file to define the services AND define them in web.xml, will they be deployed twice?

       

      Is it possible to use a relative URL in jbossws-cxf.xml?

       

      If I'm using container based authentication mechanisms, will they still be applied to endpoints deployed using the cxf.xml file?

       

      Should I not be using the web.xml method?

        • 1. Re: CXF services in a war
          Steffen Krause Newbie

          Hi spyhunter99,

           

          I was in the exact same situation a few weeks back, that's what I have found out:

          • When you deploy your services in a war you configure them as usual in the web.xml however it is JBossWS' CXF implementation that is handling and registering your endpoints
          • The jbossws-cxf.xml gives you the possibility to refine these configured endpoints even more but your JBoss AS must have the Spring libraries installed
          • CXF creates an instance of your endpoints as configured in web.xml and places them as beans on the bus and names them {namespace}ServiceName and {namespace}PortName. So in order for your jbossws-cxf.xml to pick up the correct CXF beans your <jaxws:endpoint> configuration has to match your jax-ws information

           

          One thing I noticed (and I still have an unanswered post on here) is the fact that not every part of the jbossws-cxf.xml is being picked up. For example my <jaxws:client> configuration is completely ignored.

           

          Let me know if you have further questions and I'll try if I can answer them.

           

          --Steffen

           

          Message was edited by: Steffen Krause

          • 2. Re: CXF services in a war
            Alessio Soldano Master

            Thanks Steffen for summing this up.

            To be honest, the documentation at [1] applies to JBossWS-CXF 3.x and is now to be replaced by [2] (for current jbossws trunk) and [3] (for version in AS 7.1). The front page at https://community.jboss.org/wiki/JBossWS mentions the JBossWS 4.x doc is served at https://docs.jboss.org/author/display/JBWS . This said, I can probably see if this topic can be better explained.

             

            To give you a bit of history, the jbossws-cxf.xml is basically the leftover of the initial (jbossws-cxf-3.0.x) integration with Apache CXF, when Spring was strictly required. Thanks to the evolution of Apache CXF and due to the need of avoiding depending on Spring, we slowly moved to a new integration allowing cxf based endpoint deployment without the need of going through a spring DD nor a spring application context at all.

            Anyway, we kept the option of installing spring and using jbossws-cxf.xml for those needing specific configuration things provided throught spring bean declarations.

             

            So spyhunder99, unless you need to tune specific spring bean things, you can simply avoid bothering creating a jbossws-cxf.xml / cxf.xml descriptor and declare your endpoints in the web.xml (you might not even need that nowadays, with JSR 109 1.3 / Servlet 3).

             

            Regarding the <jaxws:client>, Steffen, I need to check some things first, then I'll reply you in the other thread.

             

            [1] https://community.jboss.org/wiki/JBossWS-StackCXFUserGuide

            [2] https://docs.jboss.org/author/display/JBWS/Apache+CXF+integration

            [3] https://docs.jboss.org/author/display/AS71/Apache+CXF+integration

            • 3. Re: CXF services in a war
              Steffen Krause Newbie

              Alession,

               

              Thanks for the additional information, guess I'll have to take a look at the new JBossWS documentation as well.

               

              In my specific case I had to add some additional JAXB classes to the JAXB Context of the endpoint as I'm using an extension mechanism and the XML fragments I send to the Endpoint are not referenced in the WSDL and are therefore not added to the JAXB Context automatically. In order to do that kind of CXF configuration jbossws-cxf.xml is still the right way to go?

               

              Thanks for looking into the <jaxws:client> issue I'm having. Let me know if there is additional information I can provide (in the other thread) as I have been talking to Daniel Kulp from the CXF team quite a bit and spent most of last weekend "debugging" my implementation.

               

              Thanks,

               

              Steffen