permaculture playing cards*
The moose likes Servlets and the fly likes Servlet vs Web Service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet vs Web Service" Watch "Servlet vs Web Service" New topic
Author

Servlet vs Web Service

H Rice
Greenhorn

Joined: Jun 15, 2004
Posts: 5
Dear All,

I have inherited an existng web app A(no source). i was given the responsibility to add some value-added functionalities and immediately thought of using Axis. The reason for go through the web service way is that this allow me to implement a b2b solution (i have to implement a portal (web app B) on another web server which would need to communicate with web app A).

The question - since i can do the same thingy - web app B calls web app A by using a more traditional technique (a http post), what are the pros and cons of using web service over implementing a traditional servlet in this case?

The pros that I could think of are :-
1) more elegant coding (looks like a java call if we were to ignore the stubs)
2) more logical as this is really a b2b situation.
3) easy to extend

The cons..
1) more setup (web.xml) and deployment changes
2) the additional steps required to generate the wsdl and stub files

Any input? Happy to discuss this.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
pros?
Less dependence on the old existing code. If you at some point swap it out for something else the calling application need never notice. For that reason alone I'd seriously consider going the way.
More flexibility to offer services to 3rd parties in a consistent way.

cons?
More up-front work to create the webservice layer on both ends.
Possibly more network traffic (SOAP messages vs. plain HTML).
Higher resourece use on your machines (requests take longer to process, increasing CPU load and possibly RAM and disk load as well).


42
H Rice
Greenhorn

Joined: Jun 15, 2004
Posts: 5
Pros?
>> If you at some point swap it out for something else the calling application need never notice.
Agree.

>>>More flexibility to offer services to 3rd parties in a consistent way.
Actually, it is the reverse but I take your point. I need to call 3rd parties (other web apps on the same server and/or different servers) in a consistent way.


cons?
>>>More up-front work to create the webservice layer on both ends.
Agree but if it is worth it then I will bite the bullet.

>>>Possibly more network traffic (SOAP messages vs. plain HTML).
Probably ok in this case as this is an infrequent b2b operation

>>>Higher resourece use on your machines
Any figures?
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
I have no hard figures for higher resource use, but as you will be executing more code you should have higher load.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet vs Web Service