Execute Method

Overview of the Execute Method

Client applications of the web service call the Execute method to run a SAS Stored Process.
When an application calls the Execute method, the web service performs the following actions:
  • receives the call and validates the SOAP request against the WSDL.
  • validates the command against the command schema.
  • searches in the SAS Metadata Server to find the SAS server to connect to that can service the request. If the user name and password are provided in the Properties parameter, then they are used to connect to the SAS Metadata Server. The credentials to use when connecting to the SAS Application Server are obtained from the metadata.
  • invokes the SAS code that represents the stored process on the SAS Application Server.
  • checks the value of the SYSCC macro in SAS. If the SYSCC macro variable is not 0 (indicating success) or 4 (indicating a warning), then the web service throws a SOAP fault and includes the value of SYSMSG in the fault.
  • returns all data that was written to _WEBOUT.
Here is the syntax for the Execute method:
Execute (
   [in] Command As Command,
   [in] Properties As Properties,
   [out] Result As Resultset)

Command

The Execute method takes the Command and Properties parameters as input. Both of these parameters are in XML.
The following code shows the command passed to the Execute method:
<StoredProcess name="MyStoredProcess">
   <Stream name="instream"> 
      <TABLE>
         <Class>
            <Name>Alfred</Name>
            <Sex>M</Sex>
            <Age>14</Age>
            <Height>69</Height>
            <Weight>112.5</Weight>
         </Class>
         <Class>
            <Name>Alice</Name>
            <Sex>F</Sex>
            <Age>13</Age>
            <Height>56.5</Height>
            <Weight>84</Weight>
         </Class>
         ...
      </TABLE>
  	</Stream>
   <Parameter name="inputname">myName</Parameter>
</StoredProcess>
When the previous code is passed to the Execute method, the SAS code has a macro defined whose name corresponds to the String parameter:
%LET inputname=myName
The SAS code also has a fileref assigned that corresponds to the name of the Stream parameter:
The SAS program should write output to the pre-assigned fileref _WEBOUT. Most applications do this by using the XML LIBNAME engine, as follows:
libname instream xml;
libname _WEBOUT xml xmlmeta=&_XMLSCHEMA;

proc copy in=instream out=_WEBOUT;
run;

libname instream clear;
libname _WEBOUT clear;

Properties

The Properties parameter enables you to specify properties of the Execute method. Properties describe how to invoke the Command parameter. Calling applications specify the SAS Stored Process Service Provider to be used in DataSourceInfo, as shown in the following example:
<PropertyList>
   <DataSourceInfo>
      Provider=SASSPS;
   </DataSourceInfo>
</PropertyList>
Use the DISCOVER_PROPERTIES request type in the Discover method to get information about properties that are available for each request type and the values that are associated with those properties. The DISCOVER_PROPERTIES request type returns information about both standard and provider-specific properties. The returned information includes the name, description, data type, access, and current value of each property. The information also shows whether each property is required.
You can list properties in any order. The Properties parameter is required in the Discover method. The Properties parameter must be also specified for the Execute method, and must include at least the DataSourceInfo property.
Note: After you have selected a data source from the DISCOVER_DATASOURCES rowset, set the DataSourceInfo property in the Properties parameter, which is sent to the server using the Command parameter by the Execute method. Do not attempt to write your own value for the DataSourceInfo property. Use a value only from the DISCOVER_DATASOURCES rowset.
To cause the execute method to run under a specific user's identity, a UserName and Password property can be included in the PropertyList element, such as:
<PropertyList xmlns="urn:schemas-microsoft-com:xml-analysis">
   <DataSourceInfo>
      Provider=SASSPS
   </DataSourceInfo>
   <UserName>username</UserName>
   <Password>password</Password>
</PropertyList>
If you choose to include the UserName or Password properties, it is important to ensure that access to your web service is secure and encrypted. For more information, see the SAS Intelligence Platform: Web Application Administration Guide.

Result

The Result parameter is required. This parameter specifies the result set that the provider returns. The information that is returned can vary according to which values are used in the Command and Properties parameters.