• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Shall I call a web service with Object type object

 
Amaresh Saha
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my application there are few web services,
1) Webservice1 takes input of Person object and returns Person object
2) Webservice2 takes input of Student object and returns Student object
3) Webservice3 takes input of Employee object and returns Employee object

The requirement is that -
instead of publishing all these webservices, shall i publish only one web service, which will take input of Object object and return object of Object object.

Within the web-service , I will expose a method say
Object callMe(Object o)
{
if(o instanceof Person)
{
..............
}
else if(o instanceof Student)
{
...............
}
return o;
}

Is it feasible ??

Regards,
Amresh
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which will take input of Object object and return object of Object object.


Replace 'Object' with 'Document' and you are describing a document oriented web service. And as web services communicate with messages and not objects you may as well make that substitution. Document oriented web services don't have "web service methods" - they simply identify the kind of XML document that was submitted and then forward it to the appropriate process.

Document Handling Using JAX-WS Dispatch and Provider APIs describes how to implement document handling with JAX-WS.

Also have a look at this current thread about some very general design considerations regarding web services.

Beware of web service magic pixie dust.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic