How to Turn Any SOAP Web Service into a REST API

DreamFactory makes adding REST API's to databases and SOAP web services a snap. In this tutorial, you'll learn an easy way to simplify your workflows by adding a REST API on top of a SOAP web service. DreamFactory's intuitive interface makes this incredibly easy.

How It Works

There are two types of remote web services: REST APIs and SOAP APIs.

If you want to wrap a SOAP API and make it easier to work with through the use of REST endpoints, this simple tutorial will enable you to achieve that goal.

With this process, you'll be able to make a request with JSON to the API and receive a response in JSON instead of a long-winded XML format. In turn, your team will save time and cut out delays and frustration thanks to the simple and effective process that will result from this simple change.

Who Is This For?

The use case here is a team that has a SOAP API and wants to wrap that API in REST so that you can call it with ease.

There are many applications where you're likely to find this useful and, in fact, just about every team out there that works with such APIs will probably benefit from going through this simple process.

How To Do It

The steps are truly very simple to follow.

#1 Locate The API

Begin by locating the API that you want to work with.

If starting from scratch, go to \"Create\" and select \"SOAP Service\" then fill in all the information. Give it a name, label, and a short description before making it active.

We're going to use an example named \"temp\" with the label \"Temperature\" and a short description explaining that it's a SOAP service capable of doing a temperature conversion.

#2 Define A WSDL URI

At the base level, all you really need to do is provide a WSDL URI in the \"Config\" tab for the service you are attempting to work with.

For our example, we'll use:

http://www.w3schools.com/xml/tempconvert.asmx?WSDL

This is a simple public one that you could use. It will give you a working web service wrapped with REST and live documented with Swagger.

#3 View The API Docs

Once you save your URI in DreamFactory, it will create live API docs in Swagger that are completely REST-based.

Scroll down the list and locate the API you're working with. When you click on it, some endpoints will appear. The number of endpoints you have available to you will depend on the specific API that you are working with.

Our example happens to have two endpoints, both of which we can use with ease directly in the DreamFactory dashboard.

#4 Utilize The Requests

With our example, we can do a quick \"Get\" request to see what's available. This will show us things like the calls we can make with our API.

In our example, we have two options. First, we can convert a given temperature with a Celsius to Fahrenheit conversion. The other option is to convert a temperature with a Fahrenheit to Celsius conversion.

Therefore, this option gives us two \"Post\" request options (Celsius to Fahrenheit or Fahrenheit to Celsius). Selecting one of these Post requests will populate the body post and enable us to get the information we need.

Why Use This Method?

You can probably already brainstorm a multitude of reasons why your team might choose to utilize this method. However, the two most obvious ones that stretch across the board are simplicity and security.

These are benefits that every single use case will see upon implementing this method into their workflow.

Simplicity

As you can see from our example, using this method makes things extremely simple. Not only are requests suddenly quick and easy, your APIs will be quickly locatable through the DreamFactory dashboard and so much simpler to manage for you and your team.

Overall, implementing this method to use with your APIs will make workflows so much faster for everyone who has to work with them regularly. This method negates the need for long-winded XML requests and makes managing your databases much more convenient and efficient overall.

Security

Beyond simplicity, another benefit of using this method is security. This security can be achieved through the role access functions.

Once you have wrapped your SOAP API, you can then have end users who have sessions and you can have any number of roles. Those users will have role associations for role-based access control.

To control this, head to \"Roles\" and select one from the list. Under the \"Access\" tab for a specific role, you can assign services to the role by pressing the \"+\" icon. Select the service from the drop-down list to assign it.

This gives you a number of security benefits when wrapping a SOAP API in REST endpoints with the DreamFactory system.

SOAP and REST Made Simple

With this simple setup, you can basically take any WSDL and just put that WSDL URL in. Upon saving your settings, it will auto-generate the endpoints in Swagger. With that, your applications will simply be able to call that REST API whenever you put them to use. It does it all for you!

DreamFactory strives to make the process as simple and straightforward as possible. This tutorial should enable you to get everything setup and functioning correctly without any delays or hurdles. The steps are rather easy to follow so long as you do everything in the right order.

In addition to wrapping SOAP APIs with a REST endpoint, DreamFactory makes adding REST APIs on top of popular databases such as SQL Server, Postgres, MySQL, and Redshift a breeze.