Attach a Service WSDL
-
From the
financing 1.0.0
API Design screen, click on theServices
option in the left column menu palette. -
Click the
+
icon in the Services section to import web service from WSDL. -
Click the
Load from URL
icon and enter the WSDL URL below and then clickNext
:https://thinkibm-services.mybluemix.net/financing/calculate?wsdl
-
Click the
Show operations
to see the available operations in the WSDL end point. SelectfinancingService
then clickDone
.
Build the Financing API Assembly
-
Click on the
Assemble
tab to access the assembly editor. -
Select the
DataPower Gateway policies
filter. -
In the processing pipeline, mouse over the
invoke
policy and click the trash icon to delete it. -
Scroll down to the bottom of the policy menu, drag and drop the
financing
web service operations to processing pipeline. -
Now you are going to modify the input and output
map
policy for mapping your REST API into SOAP. -
In order to consume a SOAP-based service from your REST-based API, you need to map the query parameter inputs that were defined as part of the
GET /calculate
operation to a SOAP payload. To do so, click on thefinancing: input
map policy on our pipeline to open the map editor.Tip:
Click on the+
icon to make the editor window fill the screen. -
Click on the
pencil
icon in the Input column. -
Click on the
+ parameters for operation...
option and select theGET Calculate
operation.The Map editor will automatically pull in the request parameters that you defined earlier.
-
Click on the
Done
button to return to the map editor. -
For each of the
Input
query parameters, map them to their respective SOAPOutput
elements.To map from an input field to an output field, click the circle next to the source element once, then click the circle next to the target element. A line will be drawn between the two, indicating a mapping from the source to the target.
-
Click the
X
button in the map editor to return to the policy pipeline. -
Click the
invoke
policy to open its editor. -
The SOAP service
URL
has already been set for you during the service import when we create the API. -
Click the
X
button to return to the policy pipeline. -
After the Financing Web Service is invoked, you need to map the SOAP response into a JSON object.
You already defined the response object called
paymentAmount
. To do the map, click on thefinancing: output
map policy on our pipeline to open the map editor. -
Click on the pencil icon to create a set the output object schema.
-
Click on the
+ outputs for operation...
option and select theGET /calculate
operation. -
Set the Content type configuration option to
application/json
. -
Click on the
Done
button to return to the map editor. -
Click the circle next to the
paymentAmount
source element once, then click the circle next to the target element. A line will be drawn between the two, indicating a mapping from the source to the target. -
Click the
X
button in the map editor to return to the policy pipeline. -
Save the API definition.
-
Click on the
<- All APIs
link to return to the draft APIs list.
Continue
You are now finished building the financing
API. The assembly takes the following actions:
- Maps the REST query parameters into a SOAP body.
- Invokes the SOAP service.
- Transforms the SOAP service’s response into JSON.
Proceed to Import Logistics API.