Posts

Showing posts with the label Webservice

REST Design Pattern and Best Practices

Image
There is lot of material available on net about the REST design pattern and REST way of services but still to get started you need to read a few before you could make a call. I have tried to summarize my beginning to make it easier for others. REST: The Style of Architecture REST ( REpresentation State Transfer) is the way the whole web is organized. Web is a collection of resources which can be identified with a URI which are globally identifiable. People do struggle to define REST. One wrong statement is "REST is a communication Protocol". REST is not protocol; it is just a style of software architecture for distributed system. REST style of Architecture shows following characteristics: As opposed to the procedure based approach of SOAP, REST follows the action based approach to act on a resource. The actions can be described in the form of four verbs: (In HTTP world these are referred to as Methods. T...

Soap request from JavaFX

I was searching on net to know how to send soap request from JavaFX. I could not get a straight answer. While looking at the JavaFX 1.0 API, I did find java.io.http.HttpRequest class to send HTTP asynchronous requests. The document says that you can invoke RESTful weservices through the class. Since HTTPRequest supports POST as a method for sending the request, I though of sending the SOAP message over HTTP. I wrote a simple utility class to facilitate the same and it did help me achieve my goal. The example is a simple class keping in mind that usually soap request are known through WSDL but we do mistakes while preparing a complete XML soap message. I would like to share some of the points for anyone trying the same. 1. Create a simple SoapRequest class as follows: public class SoapRequest extends HttpRequest{ 2. Define the variables to create xml tags, Soap envelop and body tags // xml header  var XML_HEADER:String = "";  // namespace for SOAP 1.1 message, this...