Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Soap Client consuming Rest Web Services

I am working on this project where the client only supports SOAP WSDL for consuming web services where as it supports rest for incoming calls. I need to Integrate this tool with another tool which is completely restful(has WADL). Is is possible for soap client to consume restful web services? If yes which tool will you all suggest?

like image 715
user5573880 Avatar asked Sep 26 '22 04:09

user5573880


2 Answers

No, it's not possible for a soap client to consume restful services. There is no interoperability between them whatsoever.

Even if you could do this you should not. Use a tooling library and just create a rest client for your rest service.

like image 91
tom redfern Avatar answered Sep 30 '22 07:09

tom redfern


SOAP defines a standard communication protocol (set of rules) specification for XML-based message exchange. SOAP uses different transport protocols, such as HTTP and SMTP. The standard protocol HTTP makes it easier for SOAP model to tunnel across firewalls and proxies without any modifications to the SOAP protocol.

REST describes a set of architectural principles by which data can be transmitted over a standardized interface (such as HTTP). REST does not contain an additional messaging layer and focuses on design rules for creating stateless services. A client can access the resource using the unique URI and a representation of the resource is returned. With each new resource representation, the client is said to transfer state. While accessing RESTful resources with HTTP protocol, the URL of the resource serves as the resource identifier and GET, PUT, DELETE, POST and HEAD are the standard HTTP operations to be performed on that resource.

It can be done via jQuery.

jQuery sample for the Language Identifier :

$.post('https://services.open.xerox.com/RestOp/LanguageIdentifier/GetLanguageForString', 
{'document' : 'This is a sample'}, function (data) {
  var res = 'Not found';
  if (data != null) {
    res = data;
  }
});

Further reading: https://spring.io/guides/gs/consuming-rest-jquery/

like image 43
Josip Ivic Avatar answered Sep 30 '22 06:09

Josip Ivic