Integrating SAS in a Web Services Architecture Dan
Integrating SAS® in a Web Services Architecture Dan Jahn Developer – SAS Cary Copyright © 2005, SAS Institute Inc. All rights reserved.
Web Services Driving the Pendulum Power on the Server n. Back-end servers n. Mid-Tier servers Copyright © 2005, SAS Institute Inc. All rights reserved. Power on the Desktop n. Smart Client
Agenda § Introduce Stored Processes § When to Use Web Services § Technical roadmap for developing Web Services with SAS Copyright © 2005, SAS Institute Inc. All rights reserved.
Stored Process § SAS Code • Runs on SAS Stored Process Server § Metadata • Stored in SAS Metadata Server Copyright © 2005, SAS Institute Inc. All rights reserved.
SAS Stored Processes Web Report Studio Desktop SAS + SASMC SAS Metadata Server Enterprise Guide Custom Java/. Net code ETL Studio SAS Stored Process Server Copyright © 2005, SAS Institute Inc. All rights reserved. Stored Process Web App SAS BI Web Services
When to use Web Services § Interoperability • Java and. Net clients • Servers, desktops, devices • Based on Standards!!! § Not for lots of Data § SOA!? ! • SAS makes it easy to use SOA without Web Services Copyright © 2005, SAS Institute Inc. All rights reserved.
SOA Copyright © 2005, SAS Institute Inc. All rights reserved.
4 Tenets of Service Oriented Architecture § § Boundaries are Explicit Services are Autonomous Services share Schema and Contract, not Class Compatibility is based upon Policy Copyright © 2005, SAS Institute Inc. All rights reserved.
Attachments § § Inline WS-Attachments == DIME Sw. A == Soap with Attachments == WS-I MTOM == SOAP Message Transmission Optimization Mechanism==W 3 C Copyright © 2005, SAS Institute Inc. All rights reserved.
SAS Web Service Roadmap Three Implementation Phases: 1. Write a custom Web Service – SAS v 7 2. SAS BI Web Services Version 1 – SAS 9. 1 3. SAS BI Web Services Version 2 – SAS 9. 2 Copyright © 2005, SAS Institute Inc. All rights reserved.
Phase 1: Custom Web Service § § Highly customizable You write the code for the Web Service Custom level of Platform integration Samples available in. Net and Java Copyright © 2005, SAS Institute Inc. All rights reserved.
Custom Web Service IOM SOAP Custom Web Service Client Application Copyright © 2005, SAS Institute Inc. All rights reserved. SAS Workspace Server
IOM § Integrated Object Model § Originally Workspace Server; now OLAP, Metadata, and Stored. Process Servers Copyright © 2005, SAS Institute Inc. All rights reserved.
Custom Web Service in. Net § Object. Manager – makes connections to SAS § Workspace Server has OLE/DB interfaces for use with ADO ob. Server. Machine. DNSName = “localhost”; ob. Server. Port = 5307; i. Workspace = ob. Object. Factory. Create. Object. By. Server(“”, true, ob. Server, “user. Name”, “password”, xml. Info); … i. SP. Execute("Get. Credit. Limit", "custname" + "=" + cust. Name + " custid=" + cust. ID + " out. Data=work. out"); Copyright © 2005, SAS Institute Inc. All rights reserved.
Custom Web Service in Java § SAS Foundation Services § Workspace Server has JDBC interfaces server. Info. put("host", "localhost"); server. Info. put("port", "5307"); server. Info. put("user. Name", "username"); server. Info. put("password", "password"); IWorkspace i. Workspace = wsf. create. Workspace. By. Server(server. Info); … i. SP. Execute("Get. Credit. Limit", "custname" + "=" + cust. Name + " custid=" + cust. ID + " out. Data=work. out"); Copyright © 2005, SAS Institute Inc. All rights reserved.
Workspace or Stored. Process Server? § You can use either for your custom Web Service § Data interfaces with Workspace only § Workspace server designed for long-held connections (Enterprise Guide). § Stored. Process. Server designed for quick, web transactions. Copyright © 2005, SAS Institute Inc. All rights reserved.
Phase 2: SAS BI Web Services SAS 9. 1 § Uses Stored. Processes that run on a Stored. Process. Server § XMLA Generic WSDL – Execute and Discover § Stored. Processes must generate XML with XML Libname Engine Copyright © 2005, SAS Institute Inc. All rights reserved.
SAS BI Web Services IOM SOAP SAS Metadata Server Client Application SAS BI IOM Web Services SAS Stored Process Server Copyright © 2005, SAS Institute Inc. All rights reserved.
Create A Stored Process § Install: Decide on Java or. Net on Web Server § Write the SAS Program § Use SAS Management Console to define metadata Copyright © 2005, SAS Institute Inc. All rights reserved.
Write the SAS Program § Inputs: Macros and filerefs containing XML • Parameter Macro • Stream Fileref (containing XML) § Output: _WEBOUT fileref containing XML § XML Libname Engine § Errors: SYSCC and SYSMSG Copyright © 2005, SAS Institute Inc. All rights reserved.
Example SAS Code libname instream xml; libname _WEBOUT xmlmeta=&_XMLSCHEMA; proc means data=instream. &tablename; output out=_WEBOUT. mean; run; Copyright © 2005, SAS Institute Inc. All rights reserved.
Define Metadata § 1. 2. 3. SAS Management Console Define a Server Define a User Define a Stored. Process Copyright © 2005, SAS Institute Inc. All rights reserved.
SAS Code libname _WEBOUT xmlmeta=&_XMLSCHEMA; Client Code (Excel VBA) Set node. List = ws. wsm_Execute(. . . Copyright © 2005, SAS Institute Inc. All rights reserved.
SAS Code libname instream xml; Client Code (Excel VBA) "<Stream name='instream'> <Table><my. Data><col 1>4</col 1></my. Data></Table> </Stream>“ Copyright © 2005, SAS Institute Inc. All rights reserved.
SAS Code proc means data=instream. &tablename; Client Code (Excel VBA) <Parameter name='tablename'>my. Data</Parameter> Copyright © 2005, SAS Institute Inc. All rights reserved.
Make it Easier to Use § SAS BI Web Services Wizard • Visual Studio. Net add-in • Generates C# and VB code § SAS BI Web Services Explorer • ASP. Net Web Application • Explore available Stored. Processes • Create WSDL files Copyright © 2005, SAS Institute Inc. All rights reserved.
Phase 2: Call a Web Service From SAS § Use Mid-Tier as controller and communicate with SAS through IOM Copyright © 2005, SAS Institute Inc. All rights reserved.
Phase 3: SAS BI Web Services v 2 § Detailed WSDL § Attachments – MTOM § ODS or XML Libname Engine Copyright © 2005, SAS Institute Inc. All rights reserved.
Phase 3: Defining Metadata Using SAS Management Console: § Define the Stored Process § Select a set of Stored Processes to Define the Web Service § No special Keywords (XMLA Web Service) Copyright © 2005, SAS Institute Inc. All rights reserved.
Phase 3: Call a Web Service From SAS § proc soap; § Use XML libname engine to read/create XML § May choose to use XSL Copyright © 2005, SAS Institute Inc. All rights reserved.
Other Presentations § Tuesday 2: 30 Room 107 – Del. Gobbo/Wolfe – “Using Parameters to Create Intelligent Stored Processes” § Tuesday 3: 30 Room 107 - White/Wolfe – “Stored Process Creation, Testing and Maintenance via SAS Enterprise Guide” Copyright © 2005, SAS Institute Inc. All rights reserved.
Samples and Documentation § http: //support. sas. com/rnd/itech • ‘Samples’ Link • ‘Library’ Link Copyright © 2005, SAS Institute Inc. All rights reserved.
Contact Me § Dan. Jahn@sas. com § Demo Area: • Today: 5 pm-7 pm • Tuesday: 11: 45 am-5 pm • Wednesday: 8: 30 -10 am Copyright © 2005, SAS Institute Inc. All rights reserved.
Copyright © 2005, SAS Institute Inc. All rights reserved. 34
Copyright © 2005, SAS Institute Inc. All rights reserved.
Copyright © 2005, SAS Institute Inc. All rights reserved.
Copyright © 2005, SAS Institute Inc. All rights reserved.
Copyright © 2005, SAS Institute Inc. All rights reserved.
- Slides: 38