This is an old revision of the document!


REST/SOAP call and retrieval Mapping

This workflow task type, named “Run Web Service” can be used to launch a REST or SOAP call to another system and retrieve the results to be saved in fields of coreBOS or to be passed along the workflow set of tasks to be consumed in other workflow tasks by using the getContext function.

To use this task type we need a map of type Webservice Mapping. This map must be selected in the workflow task.

In the task, we can attach just one map which can be selected using the input field.

The “Web Service Mapping” defines the web service method parameters that will be launched and is divided into three sections:

  • wsconfig where we define the necessary settings to make the call
  • fields which define the parameters of the call and will permit us to capture values from the coreBOS application
  • Response

wsconfig

  • <wsurl>Endpoint where we send the data</wsurl>
  • <wshttpmethod>GET, PUT, POST, DELETE</wshttpmethod>
  • <methodname>define the method that should be called</methodname>
  • wsuser and wspass in case the service uses these
  • wsheader contain keyname and keyvalue pairs with information that must be sent in the header of the call
  • <wstype>REST or SOAP</wstype>
  • <inputtype>XML/URL/JSON/URLRESTFUL</inputtype>
  • <outputtype>JSON or XML</outputtype>

Most of the directives are self-explanatory but there are a few that need to be explained due to the process they have related.

The INPUTTYPE defines how we will send the parameters (fields) to the end-point:

  • XML and JSON will be set in the body of the call
  • URL will have the values added in the URL as GET parameters
  • URLRESTFUL will search the wsurl directive for variables defined in the fields section preceded with a dollar sign. If they are present they will be substituted by the calculated value.

If the OUTPUTTYPE is JSON two additional tasks are performed:

  • if the Response section has a “field” value for the response then we will save the value received from the call in the indicated field
  • all the Response values received will be put into the workflow context. If no name is given in the Response section for the variable in the context the application will use the name of the variable returned preceded by the text wsctx_

fields

  • <fields>block that contains the input parameter fields</fields>
  • <fieldname>input parameter for REST/SOAP call</fieldname>
  • <OrgfieldName>fieldname in coreBOS where we get the input parameter value</OrgfieldName>

this section is processed by the same engine that is used in the Field Mapping Business Map so we can use all the options that we have there like Expressions and Rules

Response

  • <Response>block that contains the response fields</Response>
  • <fieldname>the value we get back from web service call (in the block Response)</fieldname>
  • <OrgfieldName>fieldname in coreBOS to update/insert the WS response</OrgfieldName>

Examples

An example of Map for SOAP Call:

<map>
<originmodule>
<originname>Accounts</originname>
</originmodule>
 
<wsconfig>
<wsurl>http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl</wsurl>
<wshttpmethod>POST</wshttpmethod>
<methodname>checkVat</methodname>
<wsresponsetime></wsresponsetime>
<wsuser></wsuser>
<wspass></wspass>
<wsproxyhost></wsproxyhost>
<wsproxyport></wsproxyport>
<wsheader>
<header> 
<keyname>Content-type</keyname> 
<keyvalue>application/json</keyvalue> 
</header>
</wsheader>
<wstype>SOAP</wstype>
<inputtype>JSON</inputtype>
<outputtype>JSON</outputtype> 
</wsconfig>
 
<fields>
<field>
<fieldname>countryCode</fieldname>
<Orgfields>
<Orgfield>
<OrgfieldName>bill_code</OrgfieldName>
<OrgfieldID></OrgfieldID>
</Orgfield>
<delimiter></delimiter>
</Orgfields>
</field>
<field>
<fieldname>vatNumber</fieldname>
<Orgfields>
<Orgfield>
<OrgfieldName>siccode</OrgfieldName>
<OrgfieldID></OrgfieldID>
</Orgfield>
<delimiter></delimiter>
</Orgfields>
</field>
</fields>
 
<Response>
<field>
<fieldname>valid</fieldname>
<destination>
<field>tickersymbol</field>
</destination>
</field>
<field>
<fieldname>requestDate</fieldname>
<destination>
<field>ownership</field>
</destination>
</field>
</Response>
</map>

coreBOS Documentación