aspose file tools*
The moose likes Web Services and the fly likes How to Unit test an axis service that extends ServletEndpointSupport? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to Unit test an axis service that extends ServletEndpointSupport?" Watch "How to Unit test an axis service that extends ServletEndpointSupport?" New topic
Author

How to Unit test an axis service that extends ServletEndpointSupport?

Joshua White
Ranch Hand

Joined: Jun 04, 2001
Posts: 97
Hello,

I am trying to figure out how to write a JUnit test case that can test my service endpoint outside of the servlet container. My axis service endpoint extends springs ServletEndpointSupport but I cannot seem to find any mock objects that will help me initialize this object correctly.

To initialize the servlet, I need to call the init method from the ServiceLifecycle Interface:

init(Object context)

Trouble is, the context here is of the type javax.xml.rpc.server.ServletEndpointContext. As I mentioned earlier, I have been unable to find any Mock objects for this class. Can someone point me to an example?

Regards,

Josh
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39535
    
  27
I'm not familiar with ServletEndpointSupport, but most WS are at the core based on a Java POJO that has no dependencies on external objects (only the libraries it needs to complete its service). Wouldn't it make more sense to unit-test that?


Ping & DNS - updated with new look and Ping home screen widget
Joshua White
Ranch Hand

Joined: Jun 04, 2001
Posts: 97
Normally it would. This class however makes use of the Spring Context to get some of its dependencies. If this was a normal Spring servlet, I could create a spring context and insert it into a mock servlet context and initialize the servlet with that. Unfortunately, because this class implements ServiceLifecycle, the init method is now looking for ServletEndpointContext instead.

Any other ideas?

Joshua
 
wood burning stoves
 
subject: How to Unit test an axis service that extends ServletEndpointSupport?
 
Similar Threads
deploy webservice which access application level object
Writing web services with AXIS
Run Servlet on deployment
Test axis service
Axis 1.* objects feeded by Spring