[jboss-user] [EJB3] - Webservices on JBoss 5.1
K J Smith
do-not-reply at jboss.com
Fri Jul 20 11:59:32 EDT 2012
K J Smith [https://community.jboss.org/people/kjs218] created the discussion
"Webservices on JBoss 5.1"
To view the discussion, visit: https://community.jboss.org/message/749325#749325
--------------------------------------------------------------
I am trying to get webservices working on JBoss 5.1
I have set up a very simple stateless bean accessing a single table
+ at Stateless+
+ at WebService(targetNamespace = " http://xxxxxxx.net 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??
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/749325#749325]
Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120720/7029e01a/attachment-0001.html
More information about the jboss-user
mailing list