Invoke Web Service Policy Example

This example illustrates a simple sequence with a single task. Once started, the task executes the invokeWebService policy sending a ListWebServices SOAP request to the SAS BI Platform WebServiceMaker web service. The XML for the request is provided in the input data object, and the response is stored in the output data object. The task is assigned to sasadm as actual owner, so you can perform the task to complete, and stop the workflow.
First, define the relevant workflow and data objects.
The following figure shows the workflow diagram and workflow tree for a workflow where the policy data objects are local because they are associated with the task.
workflow tree for WebServiceMaker workflow with the task “List BI Services”
The data objects in the List BI Web Services task have the following properties:
Data Object Label
Type
Value
input
XML Object
<web:ListWebServices xmlns:web="http://support.sas.com/xml/namespace /biwebservices/webservicemaker-9.2"/>
output
XML Object
None
Note: The web service response is stored as the value for this data object during policy execution.
Both data objects use the following schema:
<schema elementFormDefault="qualified"
        targetNamespace="http://support.sas.com/xml/namespace/biwebservices/webservicemaker-9.2"
        xmlns="http://www.w3.org/2001/XMLSchema"
        xmlns:tns="http://support.sas.com/xml/namespace/biwebservices/webservicemaker-9.2"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <complexType name="StringArrayType">
      <sequence>
         <element maxOccurs="unbounded" minOccurs="1" name="string" type="string"/>
      </sequence>
   </complexType>
   <element name="MakeWebService">
      <complexType>
         <sequence>
            <element name="storedWorkflowPaths" type="tns:StringArrayType"/>
            <element name="serviceName" type="string"/>
            <element minOccurs="0" name="serviceNamespace" type="string"/>
            <element minOccurs="0" name="keywords" type="tns:StringArrayType"/>
            <element default="true" minOccurs="0" name="publishMetadata"
             type="boolean"/>
         </sequence>
      </complexType>
   </element>
   <element name="MakeWebServiceResponse">
      <complexType>
         <sequence>
            <element name="MakeWebServiceResult" type="string"/>
         </sequence>
      </complexType>
   </element>
   <element name="ListWebServices">
      <complexType/>
   </element>
   <element name="ListWebServicesResponse">
      <complexType>
         <sequence>
            <element name="ListWebServicesResult" type="tns:StringArrayType"/>
         </sequence>
      </complexType>
   </element>
   <element name="RemoveWebService">
      <complexType>
         <sequence>
            <element name="serviceName" type="string"/>
         </sequence>
      </complexType>
   </element>
   <element name="RemoveWebServiceResponse">
      <complexType/>
   </element>
   <element name="Fault" type="tns:Fault"/>
   <complexType name="Fault">
      <sequence>
         <element name="Exception" type="tns:Exception"/>
      </sequence>
      <attribute name="code" type="string"/>
   </complexType>
   <complexType name="Exception">
      <sequence>
         <element minOccurs="0" name="Exception" type="tns:Exception"/>
      </sequence>
      <attribute name="message" type="string"/>
   </complexType>
</schema>
Next, associate the policy definition with the task.
Policy Property
Value
Name
Task Started->Invoke Web Service
Event
Task Started
Action (Policy)
Invoke Web Service
Description
This policy is used to invoke a web service function over SOAP/HTTP.
Web Service Location
http://localhost:8080/SASBIWS/services/WebServiceMaker
Web Service Action
http://support.sas.com/xml/namespace/biwebservices/webservicemaker-9.2/ListWebServices
Web Service Input
WebServiceMaker/List BI Web Services/input
Web Service Output
WebServiceMaker/List BI Web Services/output
User Name
userid
Password
password
The final response stored in the output data object is as follows:
<n:ListWebServicesResponse
 xmlns:n="http://support.sas.com/xml/namespace/biwebservices/webservicemaker-9.2"
 xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <n:ListWebServicesResult>
      <n:string>WebServiceMaker</n:string>
      <n:string>XMLA</n:string>
   </n:ListWebServicesResult>
</n:ListWebServicesResponse>
See the examples provided with SAS Workflow Studio for details of this example.
Last updated: March 5, 2020