SOAP I - Setup and the Call
Setting up the HTTPConnector for a SOAP call is the same as for any other POST. The main differences are
|•||Your Request Data needs to be properly formatted as a SOAP Envelope in XML format|
|•||You will need to set some HTTP Header information correctly (Content-Type)|
In our example, we are going to read the XML SOAP Request from a file (but this could be passed in from anything that prepares the Request Data). I am doing this with the UniversalDataReader rather than using the Input file property of the HTTP Connector because I want to demonstrate the use of input and output ports with the HTTPConnector component.
Note that if you use an input port to get data into the HTTPConnector, then you MUST send data to the output port as well. Not sure why this is a requirement, but it is.
Go to the CDyne web service description page here
I am using the SOAP 1.2 call. The CDyne site tells us the following
POST /WeatherWS/Weather.asmx HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
The first thing to do is to define the Metadata that you are going to use for passing in the XML to the HTTPConnector and also for passing out from the HTTP Response. This is hopefully well described in this section.
Let's take a quick look at the settings we made for the HTTPConnector component:
|•||URL - from the Preamble bit higher up we can see the URL|
|•||Request Method - should always be a POST with SOAP calls|
|•||Additional HTTP header properties - here we have to set the Content-Type to "application/soap+xml" for SOAP 1.2 requests.|
|•||Now, we select the Input field from which the XML Request will be read. Before you can do this you must have connected the Edge and assigned metadata to it. You will be shown a list of any string type field to indicate which one contains the XML. In our case, we created a special XMLData metadata record with only one field, XMLString.|
|•||Finally, do the same for the Output field. I use the same metadata for this.|
That's it. Now you just hit and hope. Check the Console output when it runs and remember that you should address the Errors (red '!') symbols and not the yellow '?'). I strongly suggest you use the Web Service shown here to get some practice on as it is a public web service, it works without having to set anything up and it is about the right level of complexity.
The next section describes how to process the XML Web Service Response.