0 Replies Latest reply on Jul 20, 2012 11:59 AM by K J Smith

    Webservices on JBoss 5.1

    K J Smith Newbie

      I am trying to get webservices working on JBoss 5.1

       

      I have set up a very simple stateless bean accessing a single table

       

      @Stateless

      @WebService(targetNamespace = "http://xxxxxxx.net", serviceName = "AccountManagerService")

      public class AccountManagerBean implements AccountManager {

       

             @PersistenceContext(unitName = "WebService")

          private EntityManager em;

       

          @WebMethod

          @Override

          public void createAccount(@WebParam(name = "name") final String name) {

       

              final Account account = new Account();

              account.setName(name);

              account.setAmount(0);

             

              System.out.println("em ... "+this.em);

              this.em.persist(account);

          }

      ... etc ...

       

       

      This works FINE from a standard ejb-client...

       

      ...(some lines missed out!)...

      AccountManager accountManager = (AccountManager) context.lookup("AccountManagerBean/remote");

      accountManager.createAccount("Charles Bronson");

      ...

       

      Great!

       

       

      I have then set up webservices using wsconsume and wsprovide - all went fine again.

       

      Everything deployed fine too - since when running a webservices client ... the accountManager.createAccount() method IS called (some debugging print statements that i added  DO output as expected)

       

      ...(some lines missed out!)...

      AccountManagerService service = new AccountManagerService();

      AccountManagerBean ejb = service.getAccountManagerBeanPort();

      ejb.createAccount("Charles Bronson");

      ...

       

      BUT the injected entity manager in the bean is null !! and so the process falls over

       

      Going back again  to the regular ejb client - all is still okay.

       

      Does anyone have any ideas??