Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
java
java
titleMyEJBImpl.java
borderStylesolid
/**
 * Service delegate to the AutomaticSimulationSession EJB
 *
 * @author <a href="mailto:onofre@fimasys.fr">Jean-Baptiste Onofré</a>
 */
package org.apache.servicemix.examples;

import javax.jws.WebService;
import javax.xml.ws.Holder;

import com.ejb.provider.MyEJB;

@WebService(serviceName = "myService", targetNamespace = "http://www.example.com/myService", endpointInterface = "org.apache.servicemix.examples.MyEJB")
public class MyEJBImpl implements MyEJB {

   // simple Spring remote EJB proxy
   private AutomaticSimulationSession proxy;

   // getters and setters

   public void setProxy(AutomaticSimulationSession proxy) {
      this.proxy = proxy;
   }

   public AutomaticSimulationSession getProxy() {
      return this.proxy;
   }

   // service delegation methods

   /**
    * Delegation to the <code>echo</code> method of the <code>MyEJB</code> EJB.
    */
   public String echo(String message) {
      try {
         return (proxy.echo(message).toString();
      }
      catch(Exception exception) {
         exception.printStackTrace();
         return "Error occurs : " + exception.getMessage();
      }
   }

}

Our EJB is now available in ServiceMix as a service registered in the NMR.

So now, we use the EJB service via a binding component

[ Proceed to the next step | 6.03. Intermediate - Creating the HTTP SU ]

Wiki Markup
{scrollbar}