Calling SOAP web service with profile in function

Please import the following profile and set it to active. This profile serves us as a local web service: Profile-Profile_as_web_service_dynamic_response.pak.

Calling the web service


Now import the following profile. We use this profile to call the local web service in a function : Profile-Calling_web_service_with_function.pak

Please open the example profile and navigate to phase 3.

In the target structure, you will see two fields A and B with fixed values that we use to call the web service.


images/download/attachments/159865937/1875-version-1-modificationdate-1701068892500-api-v2.png




We use function call SOAP-WebService() on field "call_web_service". We set the following parameter values there.

In field "read_result_from_list", we simply read the result obtained by the web service from list h.


Parameter

Value

Description

a

https://localhost:443/dw/Request/addition_web_service

Specifies the URL of the web service. That is our local web service.

d

./conf/add.xml

See below.

e

application/soap+xml

Specifies the MIME type of the outgoing requests.

f

A,B

Here you list the target structure fields whose values are to be used to replace the placeholders in the template. See target structure above and parameter d.

g

result

This is the name of the XML element (or several names separated by commas) that we want to read from the web service response. XPath expressions can also be used if you wish. Note: See section Profile as SOAP web service (dynamic response).

h

mylist

Specifies the name of the list in which the read values (see parameter g) are to be saved.


Description of parameter d:

We need a template file for the request that specifies what it should look like. This template is the same as in section Calling SOAP Web Service with Profile in Input Agent. Copy the template there. Note: The path must begin with "./conf/".

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:wsdw="http://tempuri.org/"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- SOAPAction:https://beta.lobster.de/dw/Request/addWebService -->
<soapenv:Header>
</soapenv:Header>
<soapenv:Body>
<wsdw:Add>
<wsdw:intA>add_some_value_here</wsdw:intA>
<wsdw:intB>add_some_value_here</wsdw:intB>
</wsdw:Add>
</soapenv:Body>
</soapenv:Envelope>

Now replace the values "add_some_value_here" in the elements "intA" and "intB" with the placeholders "@A@" and "@B@" for the names of the target structure fields whose values we want to use. See also target structure above and parameter f.

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:wsdw="http://tempuri.org/"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- SOAPAction:https://beta.lobster.de/dw/Request/addWebService -->
<soapenv:Header>
</soapenv:Header>
<soapenv:Body>
<wsdw:Add>
<wsdw:intA>@A@</wsdw:intA>
<wsdw:intB>@B@</wsdw:intB>
</wsdw:Add>
</soapenv:Body>
</soapenv:Envelope>

Setting HTTP request headers


Some web services require additional values that are expected in the HTTP header, such as eBay (application ID, etc.). These can be set as follows.

See parameter p in function call SOAP-WebService().