5 Replies Latest reply on Nov 27, 2006 12:53 PM by John Gilbert

    Ejb3 JMSTransportSupport

    John Gilbert Apprentice

      Has anyone tried using JMSTransportSupport with an Ejb3 MDB?

      The error I get is:
      Cannot find serviceID for: queue/AuthorizationCallbackQueue

        • 1. Re: Ejb3 JMSTransportSupport
          John Gilbert Apprentice

          I extended JMSTransportSupport and overrode processSOAPMessage() to get something to work with Ejb3 MDBs.

          For starters the the WebService is implements per usual as a SLSB. I am just using the MDB as an alternate path in the WebService.

          The MDB just defines the ObjectName for the real web service.

          @MessageDriven(activationConfig = {...})
          public class AuthorizationCallbackMDB extends MyJmsTransportSupport implements
           MessageListener {
           ObjectName getObjectName() {
           try {
           return new ObjectName(
           "jboss.ws:context=payment-authorizer-0,endpoint=AuthorizationCallbackServiceMockBean");
           } catch (Exception e) {
           throw new RuntimeException(e);
           }
           }
          }
          

          public abstract class MyJmsTransportSupport extends JMSTransportSupport {
          
           private static final long serialVersionUID = 1L;
          
           abstract ObjectName getObjectName();
          
           protected SOAPMessage processSOAPMessage(String fromName,
           InputStream reqMessage) throws SOAPException, IOException,
           RemoteException {
           try {
           ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory
           .getInstance();
           ServiceEndpointManager epManager = factory
           .getServiceEndpointManager();
           ServiceEndpoint sep = epManager
           .getServiceEndpointByID(getObjectName());
           return sep.handleRequest(null, null, reqMessage);
           } catch (BindingException ex) {
           throw new WSException("Cannot bind incomming soap message", ex);
           }
           }
          }
          


          • 2. Re: Ejb3 JMSTransportSupport
            John Gilbert Apprentice

            This could be handle generically without writing code. Just define the mdb in the deployment descriptor with an env-entry for the real service.

            <enterprise-beans>
             <message-driven>
             <ejb-name>AuthorizationCallbackMDB</ejb-name>
             <ejb-class>
             org.jboss.webservice.transport.jms.JMSTransportSupport
             </ejb-class>
             <messaging-type>javax.jms.MessageListener</messaging-type>
             <transaction-type>Container</transaction-type>
             <message-destination-type>javax.jms.Queue</message-destination-type>
             </message-driven>
             <env-entry>
             <env-entry-name>serviceName</env-entry-name>
             <env-entry-type>String</env-entry-type>
             <env-entry-value>AuthorizationCallbackServiceMockBean</env-entry-value>
             </env-entry>
             </enterprise-beans>
            


            • 3. Re: Ejb3 JMSTransportSupport
              Thomas Diesler Master

              Thanks, this work should be done against jbossws/trunk and should go into jbossws-2.0.0.

              Maybe you could create a jira issue and attach a patch against jbossws-2.0.0.CR1

              • 4. Re: Ejb3 JMSTransportSupport
                John Gilbert Apprentice

                one thing that is not right with this approach is that there is no jms address in the wsdl, because only the SLSB is deployed as a web service.

                any thoughts?