• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

web servicizing a servlet in WSAD 4.0

 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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;}
}
 
Manas Ahlaad
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 906
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Manas Ahlaad
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic