File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes publish a Servlet as an SOA implementation? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "publish a Servlet as an SOA implementation?" Watch "publish a Servlet as an SOA implementation?" New topic

publish a Servlet as an SOA implementation?

Bret Waldow
Ranch Hand

Joined: Aug 04, 2000
Posts: 59
Relative newbie here.

We have a service which provides a servlet as it's public interface. We want to make it available as an SOA implementation, with a WSDL description for clients to use.

The public interface is just the doGet() and doPost() methods of an HttpServlet.

As a servlet, it receives HttpServletRequest objects, and returns HttpServletResponse objects. These are not known SOAP types, and in fact, are interfaces. Java2WSDL doesn't understand them, and I don't know how to go about coming up with serializable equivalents for them.

What to do? Should we refactor the public interface as something built of known objects instead (like Strings, etc.)?

Thanks in advance.
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
First of all, I would refactor everything you can out of the servlet and into a plain old Java class, a business object.

Then, you could create a web service which uses the new Java class directly and translates your custom interfaces to standard data types or use a document-style web service where you specify your custom XML input and output messages (and translate these to your business object's interface).

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
I agree. Here's the link:
subject: publish a Servlet as an SOA implementation?
It's not a secret anymore!