Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / May 2006

Tip: Looking for answers? Try searching our database.

bean as webservice

Thread view: 
jasonsig - 04 May 2006 21:26 GMT
Hi, I wrote a simple web service 'apache axis'  that just accepts data
and updates a database. What type of bean is best suited for this:
1. Regular bean
2. EJB

Is the bean a shared instance 'multiple threads access a shared
instance of the bean'?
if this was the case
1. in having a singleton for a DBCP that the bean uses for getting its
connection objects to
   the database be considered safe?

thx jason
Stefan Theusner - 04 May 2006 22:10 GMT
> Hi, I wrote a simple web service 'apache axis'  that just accepts data
> and updates a database. What type of bean is best suited for this:
> 1. Regular bean
> 2. EJB

Webservice endpoints could be:
1. Servlet (Servlet specification)
2. Statless Session Bean (EJB 2.1 spec.)
3. Message Driven Bean (for JAXM also part of the EJB 2.1 spec.)

Take a look at http://www.jboss.org/wiki/Wiki.jsp?page=JBossWS
there you can found all needed informations i think.

> Is the bean a shared instance 'multiple threads access a shared
> instance of the bean'?

Statless Session Bean: one to one relation
Servlet: One instance (catchword concurrent access and synchronize)

> if this was the case
> 1. in having a singleton for a DBCP that the bean uses for getting its
> connection objects to
>     the database be considered safe?

I don't know DBCP.

regards,
stefan
jasonsig - 04 May 2006 23:34 GMT
Hi, my webservice is a method from a regular 'java class'. I added the
axis libraries to the web application, that consists of just a bean and
a singleton class that handles jndi for data base connection pooling.

Would this be best practice or should I use a Stateless Session Bean?

thx jason
Stefan Theusner - 05 May 2006 17:05 GMT
Hi,

> Hi, my webservice is a method from a regular 'java class'. I added the
> axis libraries to the web application, that consists of just a bean and

I always would prefer JWSD 2.0 because in case of JBoss it is
recommended, by JBoss, to generate your artificats (classes) by using
wscompile tool. In my last project i also have to use an axis based
webservice client and got problems with some JBoss versions.

> a singleton class that handles jndi for data base connection pooling.

Of course you could use a singleton for database management.

Do you use connection pooling via datasources? If not you should.

Using datasources with Tomcat
http://tomcat.apache.org/tomcat-5.0-doc/jndi-datasource-examples-howto.html

Using datasources with JBoss:
http://wiki.jboss.org/wiki/Wiki.jsp?page=ConfigDataSources

Using datasources with Geronimo:

> Would this be best practice or should I use a Stateless Session Bean?

Would the best practice in J2EE applications because you can configure
existing business methods for webservice use.

regards,
stefan


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.