Webservice Gateway - Examples
Webservice demonstration
In this demonstration we are going to send a number to a webservice and we get the number of dollars back in writing.
The webservice gateway is meant for sending SOAP calls to webservices. If you want REST, use the HTTP Gateway.
For this example we are sending a number to the webservice:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://www.dataaccess.com/webservicesserver/">
<soap:Header/>
<soap:Body>
<web:NumberToDollars>
<web:dNum>4</web:dNum>
</web:NumberToDollars>
</soap:Body>
</soap:Envelope>
The reply will give us the number of dollars back, like so:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<m:NumberToDollarsResponse xmlns:m="http://www.dataaccess.com/webservicesserver/">
<m:NumberToDollarsResult>four dollars</m:NumberToDollarsResult>
</m:NumberToDollarsResponse>
</soap:Body>
</soap:Envelope>
Example
Requirements
Unzip the file and install the interface by creating a new Business Connector with the name WebServiceGateway Interface (for example) and import the interface via the Create new interface window.
Select the WebServiceGateway Interface.cinterface file and press Save to upload the file into the system.
WSDL: http://www.dataaccess.com/webservicesserver/numberconversion.wso?WSDL
Business connector / Interface and Flows
How it works
We drop an XML file into the ../temp/input directory. This file will be picked up and sent to the webservice (SOAP request). The file will be processed and a reply will be sent to us. This file will be dropped into the ../temp/output directory, where we can read it.
First example
In the .zip file you can find the file soapinput.xml. This file looks like this:
<web:NumberToDollars xmlns:web="http://www.dataaccess.com/webservicesserver/">
<web:dNum>4</web:dNum>
</web:NumberToDollars>
This looks a bit different than the file described at the beginning of this example. The file does not need the SOAP envelope. This is automatically added by the Webservice Gateway. This leaves us with the problem of where to add the namespaces (xmlns:web="http://www.dataaccess.com/webservicesserver/"). As you can see, we use the namespace web but as we removed the SOAP envelope, in fact we deleted the namespace declaration.
The declaration of the used namespace you can add at the fist tag where the namespace will be used. So you can see, we added the namespace at the NumberToDollars tag.
Now put the file into the directory ../temp/input, if all is ok, the file will be removed and the reply will be in the ../temp/output directory.