SOAP Request Action Plugin



This plug-in provides the ability to periodically execute a SOAP query on a web service. It can be used for a one-off request or as a polling mechanism.

Saved Parameters Description

Trigger and Polling Settings

Inputs Description

The list of inputs depends on the configuration of the SoapRequest action template.

Changes in this list of inputs will override any values set in the action template.

Mandatory inputs:

Optional Inputs:

Outputs Description

Supported Actions

None

Dependencies

None

Operating Instructions

Overview:

This action generates a SOAP request to a remote service and handles the response.
  1. Select either a remote WSDL as a HTTP URI (for example, http://www.ebi.ac.uk/ws/services/WSDbfetch?wsdl) or a locally imported WSDL file.
    A local WSDL file must be stored in this Orchestrator folder:
    /opt/aspera/var/config/orchestrator/actions_config/soap_requests/
  2. Select an operation from the 'Service' drop-down list.
  3. Check the 'Provide explicit payload?' box if you want to enter the XML payload explicitly. Input variables can be specified with the <%=myvariable%> notation.

    Alternatively to a WSDL URI or local file, an End point and a Soap action can be specified if 'Provide explicit payload?' is selected.

    Alternatively to an explicit payload, you can provide the 'Service action parameters' and/or 'Session header parameters'. This is not encouraged as it relies on parsing the wsdl to find the input parameters, which can be unpredictable. With the payload mode, you can test with soapUI and then just cut and paste the xml into the payload section.

  4. The authentication can be done via a HTTP basic authentication login and password in the appropriate fields. Username and password are then combined into a "username:password" string, and they are Base64 encoded and put in the http Authorization header.

Polling:

The SOAP request can be repeated until a condition is met.

Set a polling frequency to enable this feature (for example, 5 for 5 seconds periodicity).

Example with this response (Raw_response output):

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
     <ns1:GetSessionsResponse xmlns:ns1="urn:Aspera:XML:FASPSessionNET:2009/11:Types">
         <SessionKeysResult>
            <ResultCount>2</ResultCount>
            <RemainingResultCount>0</RemainingResultCount>
            <IterationToken>dd549761f97954417d2abf3c47ec877b0000000000001229</IterationToken>
            <SessionKey>
               <UUID>fe77385c-3d17-4613-b839-1fc04bc5d423</UUID>
            </SessionKey>
            <SessionKey>
               <UUID>678357a5-cbf1-490a-8417-3d1f17390ea6</UUID>
            </SessionKey>
         </SessionKeysResult>
     </ns1:GetSessionsResponse>
   </soapenv:Body>
 </soapenv:Envelope>

The xml_result variable is built from parsing the XML body if present. It contains this hash:

{"GetSessionsResponse"=>[{"SessionKeysResult"=>[{"ResultCount"=>["2"], "SessionKey"=>[{"UUID"=>["fe77385c-3d17-4613-b839-1fc04bc5d423"]}, 
 {"UUID"=>["678357a5-cbf1-490a-8417-3d1f17390ea6"]}], "RemainingResultCount"=>["0"], 
 "IterationToken"=>["dd549761f97954417d2abf3c47ec877b0000000000001229"]}],  "xmlns:ns1"=>"urn:Aspera:XML:FASPSessionNET:2009/11:Types"}]}

The stop condition is expressed in Ruby in "Polling stop condition code".

Example:

xml_result["GetSessionsResponse"][0]["SessionKeysResult"][0]["RemainingResultCount"][0] == '0' rescue nil
 

This will repeat the request until the result count in the XML response is equal to 0

Select "Keep trigger ongoing?" to enable a trigger functionality. Spawn a new workorder each time a new record (determined by the record identification code) is found in the response. Then proceed with the next steps in the workflow. The new instance will keep polling for new records in the response. A record that has already been detected is memorized and will not be re-detected again (unless the workflow is restarted).

Formatting:

Specify in "Result records extracting code" the Ruby code to extract an array of things out of the response.

Specify in "Record formatting code" the Ruby code to format each extracted record.

Specify in "Record identification code" the Ruby code to identify what consists of a unique record out of the formatted record.

With "Result records extracting code" such as:

return xml_result["GetSessionsResponse"][0]["SessionKeysResult"][0]["SessionKey"]

The extracted array will be the following with 2 records:

[{"UUID"=>["fe77385c-3d17-4613-b839-1fc04bc5d423"]}, {"UUID"=>["678357a5-cbf1-490a-8417-3d1f17390ea6"]}]

With "Record formatting code" such as

return { "id" => record["UUID"][0] } rescue nil

Each record will be a hash with id as the key and the UUID value

Service_results output will then hold an array such as:

[{"id" => "fe77385c-3d17-4613-b839-1fc04bc5d423"}, {"id" => "678357a5-cbf1-490a-8417-3d1f17390ea6"}]

With "Record identification code" = return "#{record["id"]}", if keep trigger ongoing is selected, the trigger will identify records by their UUID.

Note that "Record identification code" can be left empty if for example only 'return record["UUID"][0]' is specified in "Record formatting code". In this case, by default "Record identification code" will take the record UUID as the unique record identifier.

In this case, Service_results output will hold an array such as:

["fe77385c-3d17-4613-b839-1fc04bc5d423", "678357a5-cbf1-490a-8417-3d1f17390ea6"]
 

Also note that "Result records extracting code" and "Record formatting code" can be used without "Keep trigger ongoing?" being selected and without a polling period being set. Use this case to format an array of things out of the response and output it into Service_results.

In addition to the "Result records extracting code" and "Record formatting code", some post-treatment code can be applied in "Results formatting code". For example, if we wanted an output as a hash with iteration_token only, we would add in "Results formatting code":

 token = xml_result["GetSessionsResponse"][0]["SessionKeysResult"][0]["IterationToken"][0]
 results = { "iteration_token" => token }

In this case, change the "Result type" to hash. "Service_results" would then be:

 {"iteration_token"=>"91286e2557483993505661edef5435690000000000001234"}