Friday 10 December, 2010

Web Services - FAQs

Note: This is how I understand Web services. I have mostly worked on SOAP based implementations of Web services which use ESB to transport the messages back and forth between the provider and the consumer. The SOAP contract is available to understand how to make use of a web service. I have used XML Beans, AXIS, Castor in the process.

My knowledge on REST is limited at this stage.

Q
: What exactly is a web service. ?
A:
A web service is a service provided by an application , such that it can be used by applications(internal , external) with minimal coupling. An example could be rss feeds.
Where in a newspaper provides all its article in the RSS format , for other websites to include in their web apps.

Q: When should a functionality be exposed as a webservice ?
A: When a functionality could be useful to other applications , and the functionality needs to be available out of the box (language independent , platform independent) . With the only constraint being XML as a medium of communication.

Q: What ways can a webservice be consumed ?
A: Interestingly this depends , on how the service provider expects the request to be.
  • RPC - tight coupling exists , message broker , stub , binding , registration, lookup etc are terms often used when we speak about RPC , similar to Java RPC/CORBA. More Service Oriented.
  • SOAP - Communication based on XML written in specific formats as defined is service XSD's and invoke services as defined in the WSDL. Message Oriented.
  • REST - Communication based on XML over Http but using specific set of functions like GET , POST etc.

Q:What exactly is the wsdl used for in a webservice ?
A: It basically is a document to describe which functionalities are exposed for consumption by the client.

A: What exactly is a contract in terms of webservice ?
A: Its is a document to describe how to invoke a web service , what are the inputs and the output formats applicable and also if a client is registered to use this service(public or private)

Q: What are the types Webservice implementations available in java?
A: CORBA, Restlets etc

Q:What are the various marshalling/ unmarshalling frameworks available in Java?
A: Castor, XMLBeans , JIBX etc

Q: What is an ESB ?
A:
An enterprise service bus acts as a interface to many systems which communicate with each other. The systems communicate to the ESB with a message and the ESB will thereafter process the message (forward it to the correct service provider, wait for the reply , send the reply back to the client).