Alex Hitchins
Alex Hitchins

Reputation: 33

SOAP to REST Conversion

I have a web service written in C# using SOAP. A client has requested the same service be available as a REST based service.

Is there a clever/quick way I can achieve this, or am I looking at a rebuild from new?

Upvotes: 3

Views: 5125

Answers (3)

Dmitry
Dmitry

Reputation: 17350

SOAP and REST are different not only conceptually but mechanically.

Conceptually SOAP methods are pretty much RPC, remote procedures. So your web methods look like "GetListOfCustomers" and "DeleteCustomer". While in REST you model Customers as resources and use HTTP verbs on these resource. To get the list of customers client will send HTTP GET and server will return customer representation in XML, JSON, HTML or custom format. Customer representation may have embedded URL links that will allow client code to delete customer for example. This is called HATEOAS

Mechanically SOAP is a layer on top of HTTP. Layer that ignores and reimplements existing HTTP capabilities like envelop, verbs, caching, encoding etc. As opposed to REST that relies on all these HTTP features. So mechanically REST is simpler because there is no additional layer that SOAP has.

When you were asked to make existing SOAP service to be available as REST it probably implied purely mechanical aspects. You probably need "XML RPC over HTTP" which will require some work on your part but may not be as hard as redesigning API from SOAP/RPC to REST/HATEOAS.

Upvotes: 4

John Saunders
John Saunders

Reputation: 161773

The solution will depend on how you implemented the SOAP web service.

This is not a "conversion". You will be writing a REST-based service to do the same sorts of thing that your SOAP service does. If you developed your SOAP service correctly, then you will be able to reuse much of the code. You will then be able to deploy a single service that serves both requirements.

Upvotes: 0

Darrel Miller
Darrel Miller

Reputation: 142044

SOAP based services are built with a completely different set of constraints than REST services. If the services is simple then the end result of the two approaches may look somewhat related, but in reality they are two completely different approaches.

Upvotes: 5

Related Questions