Call Web Service with Profile in Input Agent

Please import the following profile and set it on active: Profile-Local_Web_Service.pak

This profile serves us as a local web service (more on that later).

Now please create a new profile Call_Web_Service and choose the time-driven Input Agent of type HTTP.


Configure Input Agent in Profile


images/download/attachments/69044163/Input_Agent_Cron_EN-version-2-modificationdate-1615188997375-api-v2.png

(1) Enter the URL http://localhost/dw/Request/addWebService. This is our local web service.

(2) Set this checkbox.


WSDL


images/download/attachments/69044163/WSDL_anfragen_EN-version-1-modificationdate-1615186899108-api-v2.png

(3) Click on this button. A new dialogue appears.


images/download/attachments/69044163/WSDL_anfragen_2_EN-version-2-modificationdate-1615189017063-api-v2.png


Input field (4) will contain the URL you entered earlier in (1) with the additional suffix ?wsdl. If you now click on (5), you will get a list of all available methods (in our case only one) in (6).

What is happening here?

Systems that offer methods via web services usually provide a WSDL (Web Services Description Language) file. This is a 'normal' XML file with a clearly defined structure. It contains, for instance, the available methods and their parameters.


Choose Web Service Method


You do not have to read and understand WSDL files, Lobster_data will show you all the available methods in a dialogue. Select method Add (6) with a double-click (this method adds two numbers) and click (7). This automatically creates a template for the SOAP request, see the following screenshot.


Complete WSDL


images/download/attachments/69044163/Methode_aufrufen_1_EN-version-3-modificationdate-1625734815093-api-v2.png

Almost done. Lobster_data prepares the XML file (the SOAP request template) for you, the way the selected method requires it.

(8) Replace the text add_some_value_here (occurs twice) with 1 and 2.

(9) Now click this button. Another dialogue with the response of the server appears, in which you will find the text <result>3</result>.


images/download/attachments/69044163/Methode_aufrufen_2_EN-version-1-modificationdate-1615186899093-api-v2.png


(10) Finally, you can automatically create a fitting source structure for the response file.

(11) Some servers require the HTTP header SOAPAction. During the XML generation, the value behind SOAPAction: in comment (11) is read and used as value for this (automatically generated) HTTP header.


Dynamic Values


Of course, you do not always want to add 1 and 2. You are allowed to use placeholders in the request code with the syntax @VARIABLENAME@ . In that case, it makes sense to build another profile that is calling this profile via message. You can fill a variable VARIABLENAME in the calling profile and use it in the called profile with syntax @MSG_CALL_VARIABLENAME@. Remember to define variable MSG_CALL_VARIABLENAME in the called profile (see section Variables with Prefix MSG_CALL_). Simply use your placeholders instead of the fixed values 1 and 2 in your request template.

SOAP?


In this example, the data was exchanged via SOAP XML. The request is embedded in an envelope (<soap:envelope>....</soap:envelope>) and the actual data is embedded in the body (<soap:body>....</soap:body>). The response is delivered in the same way. Lobster_data creates and parses the body data just like any other XML file.