File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes web servicizing a servlet in WSAD 4.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "web servicizing a servlet in WSAD 4.0" Watch "web servicizing a servlet in WSAD 4.0" New topic
Author

web servicizing a servlet in WSAD 4.0

Manas Ahlaad
Ranch Hand

Joined: Nov 07, 2001
Posts: 165
Hello,
Which methods of servlet do I need to expose , In order to create a web service interface for a servlet using WSAD 4.0 when i tried exposing all the methods it shows some error.
TIA
Manas
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by Manas Ahlaad:
Hello,
Which methods of servlet do I need to expose , In order to create a web service interface for a servlet using WSAD 4.0 when i tried exposing all the methods it shows some error.
TIA
Manas

I don't think exposing a servlet methods like doPost, doGet as a webservices is good idea.
Normally you will expose a class(with methods) which were written to do a specific operation/job as webservice operations.
example
public class test {
public int add(int a, int b){ return a+b;}
}


Spritle Software Blogs
Manas Ahlaad
Ranch Hand

Joined: Nov 07, 2001
Posts: 165
I am aware of the fact that request and reponse objects of servlet's methods cant be serialized . but as specified by j2ee1.4 spec , service implementation's container mediates access to a web service. i expose a servlet as a web service, my service's clients can invoke that server only indirectly , via the container. this allows many benefits like thread management, container's security , quality of service above all serilization and deserialization of request and reponse objects need not be done as request goes to container instead of servlet.
how about that ?
do wsad 4.0 support that ??
any other work around ??
TIA
Manas
JeanLouis Marechaux
Ranch Hand

Joined: Nov 12, 2001
Posts: 906
Hi Manas,
Just like Balaji, I don't think it's a good idea to publish a servlet as a webService.
A webService is a part of a business object (business rules) published to a 3rd party.
Are your business rules contained in servlets ? What about a n-tier architecture with layers ?
My understanding of the incoming J2EE 1.4 is that we'll be able to publish a webservice from the web tier (Jax-rpc service endpoint) and the EJB tier (EJB service endpoint).
But it does not mean the web tier service has to be a servlet. Actually, it can be a POJO.
When the service is a JAX-RPC one, the WebService engine is itself a servlet. So it will meet all your security and multithreading needs.

But to answer you primary question, I think you can publish a servlet as a webservice with WSAD, because a sevlet is a class (i never tried it)
Just right click on the servlet class, and choose "Web Services / Publish as web services". Then you'll have to check the method to expose and so on so forth.


/ JeanLouis<br /><i>"software development has been, is, and will remain fundamentally hard" (Grady Booch)</i><br /> <br />Take a look at <a href="http://www.epfwiki.net/wikis/openup/" target="_blank" rel="nofollow">Agile OpenUP</a> in the Eclipse community
Manas Ahlaad
Ranch Hand

Joined: Nov 07, 2001
Posts: 165
Hi Jean,
context 1. The primary business rule that the web service should perform is creating a session at server side and returning it so that in can be handy for user to browse the application.
context 2. I tried it with WSAD 4.0 , it allows to choose a servlet as you told it is also a class, it let me expose service method , but when it tried to create web service interfaces , proxy , client . some abnormal error has resulted stopping the flow.
any help in the two contexts ?
 
 
subject: web servicizing a servlet in WSAD 4.0