This article gives a walkthrough on creating a SOAP API from an existing WSDL.

For the tutorial I will be using an APIConnect service on IBM BlueMix. Let us start by creating an API Service in IBM BlueMix.

Once you have a BlueMix account and API Connect service created, click on the APIConnect Service.

In APIConnect you can create SOAP APIs by either

  • importing a .wsdl file or
  • importing a .zip file in which you bundle up wsdl(s) and all XSD files referenced by the wsdl.
  • provide a url to the wsdl.


create-soap-api-options

Create API from WSDL.

For our sample api, we will use Weather Services.

Select the Load from URL option in the New API from WSDL window.

  • Copy the url for weather service in the url field and select next.
  • This brings up list of all services defined in the WSDL. Select the “Weather” service.
  • Click on “show operations” to see the list of resources that would be created in this API.

In the video above we see a dialogue box where we were asked if we want to Create a Product. This is optional and not required for creating draft API, but we would need this when we publish the API.

To understand more about product, refer to this link APIConnect Product.

Content of the API.

After the API is created the UI loads the draft API design view. You can also view the API in other views

  1. Source – in this view you can review or edit the OpenAPI (Swagger 2.0) definitions of your APIs.
  2. Assemble – in this view you can use to create assemblies. With assemblies, you can readily tailor your APIs to include components such as activity logging and redaction of specific fields.

In Design view under paths you would see three resources, which matches the operations defined in wsdl.


screen-shot-2016-09-14-at-11-52-07-pm

In the assemble view you would see proxy policy with the target-url set to the SOAP service url, in our case it is set to

http://wsf.cdyne.com/WeatherWS/Weather.asmx

Test the sample API.

Our simple API is now ready and we can test the API using the test tool in Assemble view.

For the tutorial we would test the GetCityWeatherByZIP resource.

In the test tool we start with

  1. publishing / re-pubishing the product which contains the api.
  2. Then we select the resource GetCityWeatherByZIP .
  3. Under parameters, click on “generate” link to create a request payload. In the sample payload generated enter a value for ZIP,
  4. Click invoke.

You should see a response with HTTP Status code 200 OK. with a xml payload containing information with city name and the weather in the city

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope   xmlns:xsd="http://www.w3.org/2001/XMLSchema"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetCityWeatherByZIPResponse       xmlns="http://ws.cdyne.com/WeatherWS/">
      <GetCityWeatherByZIPResult>
        <Success>true</Success>
        <ResponseText>City Found</ResponseText>
        <State>CA</State>
        <City>San Jose</City>
        <WeatherStationCity>Hayward</WeatherStationCity>
        <WeatherID>14</WeatherID>
        <Description>Cloudy</Description>
        <Temperature>63</Temperature>
        <RelativeHumidity>93</RelativeHumidity>
        <Wind>W8</Wind>
        <Pressure>29.98R</Pressure>
        <Visibility/>
        <WindChill/>
        <Remarks/>
      </GetCityWeatherByZIPResult>
    </GetCityWeatherByZIPResponse>
  </soap:Body>
</soap:Envelope>

So far we saw how a proxy SOAP API is created using WSDL for existing web services. This enables organizations to externalize their internal web services and also gives them control on how they want to govern the access to the services by applying various policies provided by APIConnect.

In the following blogs we will discuss more on

Using out of the box policies for APIs
Creating custom policies.
Understanding Product
Product life cycle.

3 comments on"Creating simple proxy SOAP API in APIConnect v5"

  1. SiddharthTrivedi October 12, 2016

    Hi Ryan, I just tried it again with Safari, Chrome and Firefox and am able to run the videos. If you still face an issue please paste the link here.

  2. Siddharth, since we don’t have access to gateway server (if running api’s on DataPower) on Bluemix, how to troubleshoot if we run into any issues ?

Join The Discussion

Your email address will not be published. Required fields are marked *