aspose file tools
The moose likes Web Services and the fly likes JAXB with JAX-RPC1.1+ EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "JAXB with JAX-RPC1.1+ EJB" Watch "JAXB with JAX-RPC1.1+ EJB" New topic
Author

JAXB with JAX-RPC1.1+ EJB

Ephraim Paka
Ranch Hand

Joined: Apr 12, 2007
Posts: 37
I am using JAXB frame work to marshall and unmarshal the xml document and its being done in my stateless session ejb( when method is invoked) is it the right way to implement or should I unmarshall/marshall before hand if so how?

Thanks All
E
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
Why does the session bean exist?
It would be pretty inconvenient for an EJB client with Java object parameters to be forced to convert them to XML first.
Is that situation likely to arise?

If you don't have any EJB clients why choose implement a web service as an EJB endpoint?


"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
Ephraim Paka
Ranch Hand

Joined: Apr 12, 2007
Posts: 37
Hello Peer,

I chose EJB endpoint because , it offers lifecycle management( I donot have to write them) for the bean and also transaction support for JDBC. In my case the .net client calling this ejb based endpoint using SOAP.

Thanks
E
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
As you do not plan to have EJB clients I guess it's OK to do the unmarshalling/marshalling inside the bean though personally I would be inclined to look for a method to do it outside of the SLSB.

Declarative transaction control is of course one of the reasons for choosing an ejb - however Spring was created (initially as Interface21) to give you another option (I think they also have JDBC templates).

If it turns out that you need more "control" you can always implement the endpoint as a servlet endpoint that does the unmarshalling/marshalling and then calls your regular SLSB. Servlet-based endpoints have the one advantage that you should be able to get a hold of the HTTP-headers if the need arises.

(I hope you are not counting on the transactions spanning multiple WS calls - that would require WS-Coordination/WS-Transaction support (Web services transactions))

Servlet based endpoints have service lifecycle management methods - to get access to them you need to implement the javax.xml.rpc.server.ServiceLifecycle interface (ServiceLifecycle).
Ephraim Paka
Ranch Hand

Joined: Apr 12, 2007
Posts: 37
Peer,

I know I would want to do it out side the SLSB( like in Handlers), but its one the solutions/patterns that SUN web site proposed. Also my services are pretty statesless , non-chatty, discrete single transaction calls , thats one of the reasons I chose JDBC ( I may go with iBatis). I like spring FW and used it with iBatis but in my case I donot think its necessary

Thanks
E
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: JAXB with JAX-RPC1.1+ EJB
 
Similar Threads
scdjws query
JAXB - Ordering of elements in generated XML
Does jaxws 2.0 use JAXB for java object serialization?
java objects to xml streams in pipe
Problem with Jaxb marshalling inside EJB