Friday, 18 May 2018

IBM API Connect - More on API consumption

Following on from an earlier post: -

I've been happily consuming an API from IBM API Connect ( on cloud ) using a SOAP client ( SoapUI ), sending in SOAP: -

<soapenv:Envelope xmlns:soapenv="" xmlns:hel="">
         <hel:request>David M M Hay</hel:request>

to get back SOAP: -

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:ds=""
<response>Hello David M M Hay</response>

I wanted to go a little further, and also consume the same API using a command-line, having subscribed to the API via the APIC Developer Portal.

To do this, I hit up the Developer Portal: -

and registered myself as a new developer ( trick is to use a DIFFERENT email address to avoid getting confused between the admin and developer roles ).

Having created an Application ( App ), I then navigated into my chosen API Product: -

and subscribed to the API.

I then grabbed my Client ID: -

Having created a XML snippet containing the SOAP request: -

vi canary.xml 

<soapenv:Envelope xmlns:soapenv="" xmlns:can="http://Canary">
         <input1>David M M Hay</input1>

I finished by involving the Canary API: -

curl --insecure --header "Content-Type: text/xml;charset=UTF-8" --header "X-IBM-Client-Id: b0aca626-ceed-4f21-b7d0-a8c725076659" --data @canary.xml

To break the command down, we have: -

Parameter Value Why
--insecure By default, every SSL connection curl makes is verified to be secure. This option allows curl to proceed and operate even for server connections  otherwise  considered insecure
--header Content-Type: text/xml;charset=UTF-8 The service expects XML
--header X-IBM-Client-Id: b0aca626-ceed-4f21-b7d0-a8c725076659 To set the client ID
--data @canary.xml The reference to the XML file containing the SOAP envelope The URL of the API, as exposed via the Developer Portal ( and hosted on the Gateway )

For the record, this is using the native macOS version of curl 

ls -al `which curl`

-rwxr-xr-x  1 root  wheel  185104 28 Mar 05:02 /usr/bin/curl

Final thought, this gave me the heads-up on using —header X-IBM-Client-Id : -

No comments:

IBM Systems Magazine - Secure Service Containers area Virtual Appliance Framework for Sensitive Workloads

I'm reading, and re-reading, this: - IBM Systems Magazine - Secure Service Containers area Virtual Appliance Framework for Sensitive W...