What is the difference between Http post vs webservice call
HttpClient client = new HttpClient();
PostMethod method = new PostMethod(_url);
method.setRequestEntity(new MultipartRequestEntity(_data, method.getParams()));
int statusCode = client.executeMethod(method);
We are currently using Http post for communicating third party, they have developed web service as new interface, so just want to know why we should use WS.
Joined: Apr 02, 2005
Posting a message over http is what you already know .
Webservice is, createing a message in a specific protocol(SOAP envelope which defines an xml format) and then post
it over the http . On the serverside the soap envelope recieved is decoded and then call the corresponding service (maybe
anything not only java) and then again send the response in the xml format to the client .
The advantage is since you are using a predefined xml format , you can communicate between different platforms i.e. a java
program can communicate to a c# program whithout even needing to know that it is talking to a c# program.
Joined: Mar 22, 2005
WS also use HTTP (and HTTP POST), so that is not a distinguishing characteristic. Furthermore, SOAP is just one form of WS; another major variant is REST, which is gaining much momentum of late.
SOAP is complex, but it has the advantage of providing other services and functionalities that a generic XML-over-HTTP POST does not provide, like WSDLs and WS-Security.