This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 41052
    
  43
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 - my free Android networking tools app
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Unit test an axis service that extends ServletEndpointSupport?
 
Similar Threads
Writing web services with AXIS
deploy webservice which access application level object
Run Servlet on deployment
Axis 1.* objects feeded by Spring
Test axis service