Uploaded image for project: 'JBoss Web Services'
  1. JBoss Web Services
  2. JBWS-1402

Ejb3 JMSTransportSupport

XMLWordPrintable

    • Icon: Patch Patch
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • None
    • jbossws-native
    • None

      Allow the use of Ejb3 MDBs to support soap over jms. Note: This is a different solution then outlined in the referenced forum discussion.

      Here is a sample Ejb3 MDB which is also annotated with JWS annotations:

      @MessageDriven(activationConfig =

      { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"), @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/AuthorizationCallbackQueue"), @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "AUTO_ACKNOWLEDGE"), @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable") }

      )
      @WebService(name = "AuthorizationCallbackService", serviceName = "AuthorizationCallbackService")
      @SOAPBinding(style = Style.RPC, use = Use.LITERAL, parameterStyle = ParameterStyle.BARE)
      @SOAPMessageHandlers(

      { @SOAPMessageHandler(className = "org.jboss.ws.wsse.WSSecurityHandlerInbound") }

      )
      @SecurityDomain("portal")
      public class AuthorizationCallbackMDB extends JMSTransportSupport implements MessageListener {

      @WebMethod
      @Oneway
      public void authorizationResponse(@WebParam(name = "paymentId") long paymentId, @WebParam(name = "status") boolean status) throws java.rmi.RemoteException

      { ... }

      }

      The following changes where made to get this to work:

      jbossws-core.jar -> org.jboss.ws.server.ServiceEndpointInfo constructor

      } else if (udi.type == UnifiedDeploymentInfo.Type.JSR181_EJB3) {
      String ejbName = sepMetaData.getLinkName();
      UnifiedApplicationMetaData applMetaData = (UnifiedApplicationMetaData) udi.metaData;
      UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData) applMetaData
      .getBeanByEjbName(ejbName);
      if (beanMetaData instanceof UnifiedMessageDrivenMetaData)

      { this.type = Type.MDB21; }

      else

      { this.type = Type.SLSB30; }

      }

      jbossws-jboss-integration.jar -> org.jboss.ws.integration.jboss.DeployerInterceptorEJB3

      protected UnifiedDeploymentInfo createUnifiedDeploymentInfo(DeploymentInfo di) throws Exception {
      ...
      for (Object container : ejb3Module.getContainers().values()) {
      if (container instanceof StatelessContainer)

      { StatelessContainer slc = (StatelessContainer) container; UnifiedBeanMetaData uslc = new UnifiedBeanMetaData(); uslc.setEjbName(slc.getEjbName()); uslc.setEjbClass(slc.getBeanClassName()); beans.add(uslc); }

      if (container instanceof MDB) {
      MDB mdc = (MDB) container;
      if (mdc.resolveAnnotation(WebService.class) != null)

      { UnifiedBeanMetaData umdc = new UnifiedMessageDrivenMetaData(); umdc.setEjbName(mdc.getEjbName()); umdc.setEjbClass(mdc.getBeanClassName()); ActivationConfigPropertyMetaData p = (ActivationConfigPropertyMetaData) mdc .getActivationConfigProperties().get("destination"); ((UnifiedMessageDrivenMetaData) umdc) .setDestinationJndiName(p.getValue()); beans.add(umdc); }

      }
      }
      ...
      }

      protected boolean isWebserviceDeployment(DeploymentInfo di) {
      ...
      for (Object manager : ejb3Module.getContainers().values()) {
      if (manager instanceof StatelessContainer) {
      StatelessContainer container = (StatelessContainer) manager;
      if (container.resolveAnnotation(WebService.class) != null)

      { isWebserviceDeployment = true; break; }
      }
      if (manager instanceof MDB) {
      MDB container = (MDB) manager;
      if (container.resolveAnnotation(WebService.class) != null) { isWebserviceDeployment = true; break; }

      }
      }
      ...
      }

      The only thing I couldn't fix was the generated endpoint address in the wsdl. It still comes out like this

      <soap:address location='http://localhost:8080/payment-authorizer-0/AuthorizationCallbackMDB'/>

      instead of something like this

      <soap:address location='jms://localhost/queue/AuthorizationCallbackQueue'/>

      On a similar note I have created a straight forward jboss remoting JmsClientInvoker. It only works with Oneway messages, which is reasonable.

            Unassigned Unassigned
            jgilbert_jira John Gilbert (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: