integrating sas in a web services architecture

38
Copyright © 2005, SAS Institute Inc. All rights reserved. Integrating SAS® in a Web Services Architecture Dan Jahn Developer – SAS Cary

Upload: zubin67

Post on 14-Jun-2015

3.173 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Integrating SAS® in a Web Services Architecture Dan JahnDeveloper – SAS Cary

Page 2: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Web Services Driving the Pendulum

Power on the ServerBack-end serversMid-Tier servers

Power on the DesktopSmart Client

Page 3: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Agenda

Introduce Stored Processes

When to Use Web Services

Technical roadmap for developing Web Services with SAS

Page 4: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Stored Process

SAS Code• Runs on SAS Stored Process Server

Metadata• Stored in SAS Metadata Server

Page 5: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

SAS BI Web Services

SAS Stored Process Server

SAS Metadata Server

SAS Stored Processes

Enterprise Guide

ETL Studio

Stored Process Web App

Custom Java/.Net code

Web Report Studio

Desktop SAS + SASMC

Page 6: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

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

Page 7: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

SOA

Page 8: Integrating SAS in a Web Services Architecture

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

Page 9: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Attachments

Inline

WS-Attachments == DIME

SwA == Soap with Attachments == WS-I

MTOM == SOAP Message Transmission Optimization Mechanism==W3C

Page 10: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

SAS Web Service Roadmap

Three Implementation Phases:

1. Write a custom Web Service – SAS v7

2. SAS BI Web Services Version 1 – SAS 9.1

3. SAS BI Web Services Version 2 – SAS 9.2

Page 11: Integrating SAS in a Web Services Architecture

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

Page 12: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Custom Web Service

SAS Workspace ServerClient Application

SOAPIOM

Custom Web Service

Page 13: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

IOM

Integrated Object Model

Originally Workspace Server; now OLAP, Metadata, and StoredProcess Servers

Page 14: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Custom Web Service in .Net

ObjectManager – makes connections to SAS

Workspace Server has OLE/DB interfaces for use with ADO

obServer.MachineDNSName = “localhost”;obServer.Port = 5307;iWorkspace = obObjectFactory.CreateObjectByServer(“”, true, obServer, “userName”, “password”, xmlInfo);…iSP.Execute("GetCreditLimit", "custname" + "=" + custName + " custid=" + custID + " outData=work.out");

Page 15: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Custom Web Service in Java

SAS Foundation Services

Workspace Server has JDBC interfaces

serverInfo.put("host", "localhost");serverInfo.put("port", "5307");serverInfo.put("userName", "username");serverInfo.put("password", "password");IWorkspace iWorkspace = wsf.createWorkspaceByServer(serverInfo); …iSP.Execute("GetCreditLimit", "custname" + "=" + custName + " custid=" + custID + " outData=work.out");

Page 16: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Workspace or StoredProcess Server?

You can use either for your custom Web Service

Data interfaces with Workspace only

Workspace server designed for long-held connections (Enterprise Guide).

StoredProcessServer designed for quick, web transactions.

Page 17: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Phase 2: SAS BI Web Services SAS9.1

Uses StoredProcesses that run on a StoredProcessServer

XMLA Generic WSDL – Execute and Discover

StoredProcesses must generate XML with XML Libname Engine

Page 18: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

SAS BI

Web Services

SAS Stored Process Server

SAS Metadata Server

Client Application

SOAP

IOM

IOM

SAS BI Web Services

Page 19: Integrating SAS in a Web Services Architecture

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

Page 20: Integrating SAS in a Web Services Architecture

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

Page 21: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Example SAS Code

libname instream xml;

libname _WEBOUT xml xmlmeta=&_XMLSCHEMA;

proc means data=instream.&tablename;

output out=_WEBOUT.mean;

run;

Page 22: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Define Metadata

SAS Management Console

1. Define a Server

2. Define a User

3. Define a StoredProcess

Page 23: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

SAS Code

libname _WEBOUT xml xmlmeta=&_XMLSCHEMA;

Client Code (Excel VBA)

Set nodeList = ws.wsm_Execute(...

Page 24: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

SAS Code

libname instream xml;

Client Code (Excel VBA)

"<Stream name='instream'>

<Table><myData><col1>4</col1></myData></Table>

</Stream>“

Page 25: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

SAS Code

proc means data=instream.&tablename;

Client Code (Excel VBA)

<Parameter name='tablename'>myData</Parameter>

Page 26: Integrating SAS in a Web Services Architecture

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 StoredProcesses

• Create WSDL files

Page 27: Integrating SAS in a Web Services Architecture

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

Page 28: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Phase 3: SAS BI Web Services v2

Detailed WSDL

Attachments – MTOM

ODS or XML Libname Engine

Page 29: Integrating SAS in a Web Services Architecture

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)

Page 30: Integrating SAS in a Web Services Architecture

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

Page 31: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Other Presentations

Tuesday 2:30 Room 107 – DelGobbo/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”

Page 32: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Samples and Documentation

http://support.sas.com/rnd/itech• ‘Samples’ Link

• ‘Library’ Link

Page 33: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Contact Me

[email protected]

Demo Area:• Today: 5pm-7pm

• Tuesday: 11:45am-5pm

• Wednesday: 8:30-10am

Page 34: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.Copyright © 2005, SAS Institute Inc. All rights reserved. 34

Page 35: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Page 36: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Page 37: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.

Page 38: Integrating SAS in a Web Services Architecture

Copyright © 2005, SAS Institute Inc. All rights reserved.