11 Replies Latest reply on Nov 20, 2009 10:23 AM by asoldano

    @WebServiceRef and

      Hello,

      I am using @WebServiceRef to inject a client in a servlet. It works fine, but I'd like to configure some extra things for the client (specifically, I'm trying to enable WS-RM persistence) using CXF's beans.xml.

      So far, I'm trying to do it using a <jaxws:client> declaration with the "createdFromAPI" attribute set to true (I assume the client is created by your integration layer using the CXF API), but it does not seem to have effect at runtime:

       <bean id="RMTxStore" class="org.apache.cxf.ws.rm.persistence.jdbc.RMTxStore">
       <property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" />
       <property name="url" value="jdbc:derby:/wsrmdb;create=true" />
       </bean>
      
       <jaxws:client id="AsyncMessagingClient"
       name="{http://my.wsdl.tns/}AsyncMessagingImplPort" createdFromAPI="true"
       serviceClass="my.wsconsume.generated.clientstub.AsyncMessagingService"
       address="http://localhost:8080/the-service-impl-war-on-my-machine/AsyncMessagingService?wsdl">
       <jaxws:features>
       <wsa:addressing />
       <wsrm-mgr:reliableMessaging>
       <wsrm-mgr:store>
       <property name="store" ref="RMTxStore" />
       </wsrm-mgr:store>
       </wsrm-mgr:reliableMessaging>
       </jaxws:features>
       </jaxws:client>
      


      I've been careful to have the "name" attribute match the {tns}/portname convention required by CXF when using "createdFromAPI".

      Now, I don't get any errors, everything works, but the configuration is ignored. So what are my options on this?

      Am I doing something that's unsupported and simply won't work (I noticed in the documentation only jaxws:endpoint is mentioned), or is there something I'm missing.

      Cheers,
      Alex


        • 1. Re: @WebServiceRef and create

          BTW, the name of the topic was supposed to be either:

          @WebServiceRef and "createdFromAPI"


          or

          @WebServiceRef and <jaxws:client>


          I don't remember which one I used but I seems to have caused a problem in the forum software . Sorry about that.


          • 2. Re: @WebServiceRef and
            jim.ma

            Modify to following set store configuration to see if it works :

            <wsrm-mgr:store>
            <ref="RMTxStore" />
            </wsrm-mgr:store>

            Jim

            • 3. Re: @WebServiceRef and

               

              "jim.ma" wrote:
              Modify to following set store configuration to see if it works :

              <wsrm-mgr:store>
              <ref="RMTxStore" />
              </wsrm-mgr:store>

              Jim


              It's not that. In fact, I introduced this error while copy-pasting the code from my source to the forum post. The store is specified correctly, as you indicate. It just doesn't get used. Any ideas why that could be?


              • 4. Re: @WebServiceRef and

                Let me put it this way: if I copy my jbossws-cxf.xml into my web-application's source folder and create a web service client manually, the RMStore works just fine. So this code works:

                public class DebugServlet extends HttpServlet {
                 private static final String WSDL_ADDRESS = "http://localhost:8180/jboss-Ecxf.wsrm.recipient/AsyncMessagingService?wsdl";
                
                 Bus bus;
                 AsyncMessaging am;
                 int counter;
                
                 @Override
                 public void init(ServletConfig config) throws ServletException {
                 super.init(config);
                
                 SpringBusFactory busFactory = new SpringBusFactory();
                // NOTE: the file is an identical copy of my WEB-INF/jbossws-cxf.xml
                 URL cxfConfig = getClass().getClassLoader().getResource("jbossws-cxf.xml");
                 bus = busFactory.createBus(cxfConfig);
                 BusFactory.setDefaultBus(bus);
                 AsyncMessagingService ams = new AsyncMessagingService();
                 am = ams.getAsyncMessagingImplPort();
                 // ... am.xxx() calls work fine, but the Derby database is NOT created
                


                Whereas this code works, but does NOT create a database:

                public class DebugServlet extends HttpServlet {
                 private static final String WSDL_ADDRESS = "http://localhost:8180/jboss-Ecxf.wsrm.recipient/AsyncMessagingService?wsdl";
                
                // Let JBoss inject the client stub
                 @WebServiceRef(value = cmr.messaging.AsyncMessagingService.class, wsdlLocation = WSDL_ADDRESS)
                 AsyncMessaging am;
                
                 @Override
                 public void init(ServletConfig config) throws ServletException {
                 super.init(config);
                
                 // ... am.xxx() calls work and Derby database is NOT created
                


                So, any ideas?

                • 5. Re: @WebServiceRef and

                  Copy-paste typo once again: the last comment in the first code fragment should read:

                  // ... am.xxx() calls work fine, AND the Derby database is created

                  • 6. Re: @WebServiceRef and
                    jim.ma

                    From the another look , the address value is not correct :
                    <jaxws:client id="AsyncMessagingClient"
                    name="{http://my.wsdl.tns/}AsyncMessagingImplPort" createdFromAPI="true"
                    serviceClass="my.wsconsume.generated.clientstub.AsyncMessagingService"
                    address="http://localhost:8080/the-service-impl-war-on-my-machine/AsyncMessagingService?wsdl">


                    Is it a copy paste error too ?

                    • 7. Re: @WebServiceRef and

                      Unfortunately yes. Look the XML file is fine, like I said if I load it manually and construct the CXF bus myself, everything works fine.

                      The problem is that when having JBoss inject the client stub, the configuration is ignored. The client works and I can call the service successfully, it's just that no "wsrmdb" is created (i.e. the configuration is ignored). There is no error thrown, nothing; JBoss simply ignores the configuration...

                      • 8. Re: @WebServiceRef and
                        jim.ma

                        Can you please fill a jira with a test case for it ? https://jira.jboss.org/jira/browse/JBWS. We will look at if we can reproduce your error.

                        • 9. Re: @WebServiceRef and

                          Hello Jim,

                          I've put as much information as I could along with a test project in https://jira.jboss.org/jira/browse/JBWS-2822

                          I am at your disposal for more information.

                          • 10. Re: @WebServiceRef and
                            jim.ma

                            Great thanks ! I will give you update when I find something .

                            Jim

                            • 11. Re: @WebServiceRef and
                              asoldano

                              For the records, I've fixed https://jira.jboss.org/jira/browse/JBWS-2822 .