Web Services and Blackboard Bob Alcorn Blackboard, Inc.
-
Upload
agustin-gedman -
Category
Documents
-
view
226 -
download
0
Transcript of Web Services and Blackboard Bob Alcorn Blackboard, Inc.
![Page 1: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/1.jpg)
Web Services and Blackboard
Bob Alcorn
Blackboard, Inc.
![Page 2: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/2.jpg)
And now a word from our lawyers…Any statements in this presentation about future expectations, plans and prospects for Blackboard and other statements containing the words "believes," "anticipates," "plans," "expects," "will," and similar expressions, constitute forward-looking statements within the meaning of The Private Securities Litigation Reform Act of 1995. Actual results may differ materially from those indicated by such forward-looking statements as a result of various important factors, including the factors discussed in the "Risk Factors" section of our most recent 10-K filed with the SEC. In addition, the forward-looking statements included in this press release represent the Company's views as of April 11, 2005. The Company anticipates that subsequent events and developments will cause the Company's views to change. However, while the Company may elect to update these forward-looking statements at some point in the future, the Company specifically disclaims any obligation to do so. These forward-looking statements should not be relied upon as representing the Company's views as of any date subsequent to April 11, 2005. Blackboard, in its sole discretion, may delay or cancel the release of any product or functionality described in this presentation.
![Page 3: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/3.jpg)
Overview
• Web Services Overview– High-level, not a detailed tutorial
• Relationship to Blackboard Building Blocks™
• Consuming Web Services
• Creating Web Services
![Page 4: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/4.jpg)
Audience
• Familiarity with Java Servlet programming
• Familiarity with HTTP
• Experience with Blackboard Building Blocks
![Page 5: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/5.jpg)
Overview – Web Services
• Collection of inter-related technologies– SOAP. The basic protocol semantics. “…definition
of the XML-based information which can be used for exchanging structured and typed information between peers in a decentralized, distributed environment.”
– XML Schema. Type system for SOAP.– UDDI. Service discovery.– WSDL. Service description.
• In a nutshell, XML encoded method calls over HTTP
![Page 6: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/6.jpg)
Web Services and Blackboard Building Blocks
• Perfect fit for heterogeneous computing…– Client to server, Server to server– Easy to understand and analyze– Well-supported
• Blackboard® application can be either consumer or producer– Ideal model for “standalone” programs
![Page 7: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/7.jpg)
Web Services and Blackboard Building Blocks
• Consumer– Add “call out” capability to your extensions
• Producer– Expose your methods via Web Services
![Page 8: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/8.jpg)
Web Services and Blackboard Building Blocks
• Freely available Java-based toolkits– Axis (formerly IBM soap4j)– Sun Web Services Developer Kit– Other vendor solutions…
• Maps perfectly to deployment model– Toolkits designed for deployment in web
apps
![Page 9: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/9.jpg)
Web Services and Blackboard Building Blocks
• Blackboard Building Block deployment model has some unique advantages– Different extensions can implement their
own Web Services… identical names– Axis can exist in multiple webapps, even
with different versions
![Page 10: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/10.jpg)
Challenges in Existing Architecture
• Session Management– Assumes stateful, browser-oriented clients– Cookie redirect
• Authentication– SOAP standards mute on credentials– Authentication APIs not generalized
enough… – Authentication APIs not specific enough…
![Page 11: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/11.jpg)
Web Services – Technical Issues
• API Granularity– Calls are expensive, incorporating the
overhead of• XML serialization• Network (HTTP) communication• XML de-serialization• …and back again
![Page 12: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/12.jpg)
Doing it Today…
• Blackboard Learning System™ App Pack 1 and higher incorporate .NET/CLR code for both API layer data access and Web Services (via .asmx)– Gain the benefits of CLR, ease of development
with .NET tools
• Extensions can also package Java-based Web Services tool of choice– Local to web application– E.g., Apache Axis
![Page 13: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/13.jpg)
Using Web Services
Deploy toBlackboard
Get SomeWSDL
Provided by the Web Service
GenerateStubs
E.g., wsdl2java
Write codeUsing Stubs
The code you write
PackageWebapp
The standard B2 packaging
![Page 14: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/14.jpg)
Configuration
• Standard Blackboard Building Block configuration– bb-manifest.xml– web.xml
• Requires outgoing socket connection permission <permission type=“socket” name=“api.google.com” actions=“connect”/>
![Page 15: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/15.jpg)
Configuration – Gotcha!
• client-config.wsdd must be readable by the extension (e.g., WEB-INF)– Set property first!
![Page 16: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/16.jpg)
Configuration – Gotcha!
• You must declare additional permissions– RuntimePermission,
accessDeclaredMembers– PropertyPermission,
javax.wsdl.factory.WSDLFactory, write– RuntimePermission, getClassLoader– RuntimePermission, createClassLoader
![Page 17: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/17.jpg)
Example
• Find a service to consume– MERLOT Web Search Service
• Use WSDL to generate Java stub classes– Wsdl2java – Takes a .wsdl file (or URL)
and generates stub classes– Can be invoked via an Ant task…
![Page 18: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/18.jpg)
Generating Stubs
• For typed invocation– Makes it easy to work within your language
of choice; data mapped to language objects
– Dynamic invocation also supported by most toolkits
• Axis – IBM wsdl4j– Ant task
![Page 19: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/19.jpg)
Generating Stubs – Ant Task
<path id="axis.classpath"> <fileset dir="${axis.home}/lib"> <include name="**/*.jar"/> </fileset> </path> <taskdef resource="axis-tasks.properties"
classpathref="axis.classpath"/>
![Page 20: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/20.jpg)
Generating Stubs – Ant Task
<axis-wsdl2java output="src“verbose="true“url=“${merlot.wsdl}”>
<mapping
namespace="http://www.blackboard.com/ls/webservices/“package="blackboard.client"/>
<mapping namespace="http://localhost/webapps/bb-webservice-bb_bb60/services/CourseManager" package="blackboard.client"/>
</axis-wsdl2java>
![Page 21: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/21.jpg)
Example – Permissions
<permissions> <permission . . . /> <permission . . . />
<permission type="socket" name=“matanzas.merlot.org" actions="connect,resolve"/>
<permission type="runtime" name="accessDeclaredMembers" actions=""/>
<permission type="java.util.PropertyPermission" name="java.protocol.handler.pkgs" actions="write"/>
</permissions>
![Page 22: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/22.jpg)
Example – Using the StubsString queryTerms = request.getParameter("queryTerms");
//get config fileString fileName =
getServletContext().getRealPath( "/WEB-INF/client-config.wsdd" );
AxisProperties.setProperty( EngineConfigurationFactoryDefault.OPTION_CLIENT_CONFIG_FILE, fileName );
GoogleSearchServiceLocator locator = new GoogleSearchServiceLocator();
GoogleSearchPort googleSearch = locator.getGoogleSearchPort();
GoogleSearchResult result = googleSearch.doGoogleSearch( . . . );
elements = result.getResultElements();
request.setAttribute( Constants.RESULTS_KEY, Arrays.asList( elements ) );. . .
![Page 23: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/23.jpg)
Checklist
• Axis libraries
• client-config.wsdd
• Stub generator/stubs
• Client class with configuration to bootstrap properties
• Manifest with correct permissions
![Page 24: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/24.jpg)
.NET APIs and Web Services
• CLR APIs introduced in Blackboard Academic Suite™ version 6.1.5 used to expose basic Web Services, via ASP.NET
• Methods correspond to loaders/persisters in APIs
• Windows only
![Page 25: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/25.jpg)
Using .NET API Web Services
• Example using Java
• Generate stubs– http://server/BlackboardWebServices/
AnnouncementWebService.asmx?wsdl
• Implement authentication– Currently only supports Blackboard
authentication– Credentials passed via SOAP header
![Page 26: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/26.jpg)
Using .NET Web ServicesBbAnnouncementWSSoapStub webService = (BbAnnouncementWSSoapStub) newBbAnnouncementWSLocator().getBbAnnouncementWSSoap(); String passHash = webService.getMD5Hash( PASSWORD ); SOAPHeaderElement authHeader = new SOAPHeaderElement( null, "BbAuthentication" ); authHeader.addChildElement( "bbUser" ) .addTextNode( "administrator" );authHeader.addChildElement( "bbPassword" ) .addTextNode( passHash );authHeader.addChildElement( "bbAuthenticationType" );
webService.setHeader( authHeader ); Announcement[] list = webService.loadByCourseId( courseId ) .getAnnouncement();
![Page 27: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/27.jpg)
Generating Web Services
• Decide on the methods you want to support– “Chunky” is better; return a lot of data in
few calls
• Create Java classes that implement the interface
![Page 28: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/28.jpg)
Web Service Class
public class CourseManager {
public CourseWrapper[] getCourseList( String userName ) { //… work goes here }
}
![Page 29: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/29.jpg)
Axis Tasks
• Implement Class• Configure Axis deployment descriptor (server-
config.wsdd)– Defines service name– Point to web service “class” and set parameters
for which methods are the web service methods
• Implement “handlers”– Objects that perform Blackboard-specific
processing. E.g., setContext()
![Page 30: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/30.jpg)
Configuring Axis
• Must specify server-config.wsdd– Again, this is because the protocol doesn’t
handle SecurityException
• Add handlers for Blackboard-specific requirements– Authentication, Session, Context– But… no common Servlet/JSP entry point
![Page 31: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/31.jpg)
server-config.wsdd
<service name="CourseManager" provider="java:RPC"><parameter name="allowedMethods" value="*"/><parameter name="className"
value="blackboard.webservice.CourseManager"/></service>
Declaring the service…
![Page 32: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/32.jpg)
Custom Axis Handlers
• “Chain of Responsibility” design pattern
• Can be configured per service, or globally within the webapp
• ServletFilter can be used instead of handler
![Page 33: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/33.jpg)
Example – server-config.wsdd
<transport name="http"> <requestFlow> <!-- . . . --> <handler type=
"java:blackboard.webservice.axis.ContextSetHandler"/> </requestFlow> <responseFlow> <handler type=
"java:blackboard.webservice.axis.ContextReleaseHandler"/>
</responseFlow></transport>
![Page 34: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/34.jpg)
Example – Custom Handler
public class ContextSetHandler extends BasicHandler {
public void invoke( MessageContext msgCtx ) throws AxisFault { try { ContextManager ctxMgr = (ContextManager)BbServiceManager .lookupService(ContextManager.class); HttpServletRequest request = (HttpServletRequest)msgCtx.getProperty( HTTPConstants.MC_HTTP_SERVLETREQUEST );
ctxMgr.setContext( request ); } catch (Exception e) { // . . . } }}
![Page 35: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/35.jpg)
Configuration – Gotcha
• WSDLFactory and permissions– Create bootstrap servlet to init system
property; factory locator does not recover from file system security
• Reflection permissions– Axis uses reflection extensively to auto-
map the Java class to WSDL and negotiate the end point
![Page 36: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/36.jpg)
Using the Web Service
• WSDL URL:– http://server/webapps/bb-service-
bb_bb60/services/ServiceName?wsdl
• Use as input to wsdl2java
![Page 37: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/37.jpg)
Checklist
• Class to implement web service
• Class to provide handler functionality
• Axis libraries
• server-config.wsdd
• Configuration/Bootstrap servlet
• Manifest with correct permissions
![Page 38: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/38.jpg)
Great. Now What?
• Well, this is where truly heterogeneous programming comes in…
• Sample Java Client
• Sample .NET Client
![Page 39: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/39.jpg)
Sample Java Client
WSDL URIWsdl2java
(Ant)
http://localhost/webapps/vid-handle-bbuid/services/YourService?wsdl
Stubs + your code
javac
Your program
![Page 40: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/40.jpg)
Sample Java Clientpackage blackboard.client;
public class SampleClient { public static void main( String[] args ) { try { CourseManagerServiceLocator locator =
new CourseManagerServiceLocator();
CourseManager service = locator.getCourseManager();
CourseWrapper[] list = service.getCourseList( . . . ); for ( int i = 0; i < list.length; i++ ) { System.out.println( list[i].getCourseId() ); } } catch( Exception e ) { } }}
![Page 41: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/41.jpg)
Sample .NET Client
WSDL URI Wsdl.exe
http://yourserver/webapps/id-vid-bbuid/services/YourService?wsdl
Stubs + your code
Csc.exe
Your program
![Page 42: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/42.jpg)
Sample .NET Clientusing System;
namespace Blackboard.Client{ public class ServiceClient { public static void Main( string[] args ) { try { CourseManagerService service = new CourseManagerService(); CourseWrapper[] list = service.getCourseList( . . . );
System.Console.WriteLine( list.Length + " courses found." ); foreach (CourseWrapper course in list ) { System.Console.WriteLine( course.courseId ); } } catch( Exception e ) {} } }}
![Page 43: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/43.jpg)
Conclusion
• Web Services are available today– In different flavors, even
• Some pitfalls
• Promises an entirely new class of application for Blackboard
![Page 44: Web Services and Blackboard Bob Alcorn Blackboard, Inc.](https://reader035.fdocuments.in/reader035/viewer/2022062219/551a0d6e5503464c588b502b/html5/thumbnails/44.jpg)
Thank You!