This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 58
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]
It is sorta covered in the JavaRanch Style Guide.
subject: publish a Servlet as an SOA implementation?
Similar Threads
Servlet Object
Could someone explain this syntax to me please...
interfaces and locks
Confusion in Generics Syntax
Bags & Multisets Collections