Using SOAP to Access a Third-Party Web Service

Problem

You want a job to access a third-party web service that uses a SOAP interface.

Solution

Create a job that uses a SOAP transformation to access the web service. SOAP (Simple Object Access Protocol) is a simple XML-based protocol to let applications exchange information over HTTP. The SOAP transformation generates SAS SOAP procedure code to access a web service in the context of a job. The procedure invokes a SOAP web service through Java Native Interface (JNI). The procedure provides options for the request XML document (IN), the service endpoint (URL), the SOAP action or operation (SOAPACTION), and the map used to handle the response (OUT).
To use the SOAP transformation, perform the following tasks:

Verify Prerequisites

It is assumed that you are familiar with how to use the SOAP interface to access web services. Gather the same information that you need to use the SAS SOAP procedure to read from and write to the desired web service. Example options and values are shown in the next section. For detailed information about the SAS SOAP procedure, see the documentation for that procedure in the Base SAS Procedures Guide.

Create a Job That Uses a SOAP Transformation to Access a Web Service

Perform the following steps. It is assumed that you are familiar with creating SAS Data Integration Studio jobs, as described in Creating Jobs.
  1. Create an empty SAS Data Integration Studio job.
  2. In the Transformations tree of the process editor, open the Access folder.
  3. Drag the SOAP transformation into the empty job.
  4. Right-click the SOAP transformation and select Properties.
  5. Specify the options that you need to read from and write to the desired web service. See the following table for some example values.
  6. Save the job.
  7. Run the job and verify your output.
The following table shows an example set of options that you can specify in the SOAP transformation. In this example, the web service is available from the National Weather Service in the United States. For the example transaction, a ZIP code is passed to the service in XML format (WeatherGovRequestXML.xml). The service returns the longitude and latitude for that ZIP code in XML format (SOAPSoapActionOutputFile.xml).
Example Options for the SOAP Transformation
Tab Selection Path
Fields
Example Values
Optionsthen selectInput File
Specify the SAS fileref associated with request XML file (IN):
soapacti
File Options:
RECFM=V LRECL=5000
Note: RECFM=V specifies that the input file is in variable format. LRECL=5000 specifies the logical record length for the input file in bytes.
Will the SOAP Request XML be contained in one file?
Yes
Specify an existing file that contains the SOAP request XML:
C:\SOAPFiles\WeatherGovRequestXML.xml
Optionsthen selectOutput File
Specify the SAS fileref associated with response XML file (OUT):
soapacto
Specify complete path and filename of response XML file
C:\SOAPFiles\SOAPSoapActionOutputFile.xml
File Options:
RECFM=V LRECL=5000
Note: RECFM=V specifies that the output file is in variable format. LRECL=5000 specifies the logical record length for the output file in bytes.
Optionsthen selectAdditional Required Aurguments
Will the call be made to a SAS registered Web service?
No
Note: One example of a SAS registered service is a SAS Data Integration Studio job that has been deployed as a web service.
Specify the URL of the Web service endpoint to be called:
http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php
Optionsthen selectSOAP Optionssection
Specify an output log file used for debugging purposes (DEBUG):
C:\SOAPFiles\SOAPSoapActionDebug.txt
Note: Includes debugging statements from the mprint option set.
Specify a defined SOAP action (SOAPACTION):
http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl#LatLonListZipCode
Specify the mustUnderstand attribute in the SOAP header (MUSTUNDERSTAND):
Yes
Optionsthen selectSecurity
Will Web authentication be used?
No
Will WS-Security Web services be used?
No
Will an HTTP proxy server be used?
Yes
Specify the HTTP Proxy Server Host Name (PROXYHOST):
my.proxy.com
Specify the HTTP Proxy Server Port (PROXYPORT):
80
Optionsthen selectProperties
Is a SOAP envelope to be included in the XML response?
Yes
Optionsthen selectAdditional Options
System options:
mprint
Note: Specifies that SAS statements generated by macro execution are traced for debugging.