net.and.java neumann

Upload: shrikanthbv

Post on 07-Apr-2018

230 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 .Net.and.Java Neumann

    1/19

    Using .NET & Java with theBlackboard Web Services

    Lance Neumann, Senior Software Architect, Blackboard Inc.

  • 8/6/2019 .Net.and.Java Neumann

    2/19

    Brief overview of Web Services

    Web Services for Blackboard Learn

    How to get Sample Code

    Layout of Sample .NET projects

    Layout of Sample java projects

    Explanation of code generation scripts

    What will you learn in this session?

    Build procedures Client side concepts sessions, entitlements, etc.

    If time permits: Screen shots of .NET client application

  • 8/6/2019 .Net.and.Java Neumann

    3/19

    Essentially remote procedure calls using SOAPover HTTP

    Utilizes axis2 1.3 Session based authentication as

    Web Services overview

    Custom deployment/discovery to supportmanageability from the UI

  • 8/6/2019 .Net.and.Java Neumann

    4/19

    Web Services Management

  • 8/6/2019 .Net.and.Java Neumann

    5/19

    Download from within the UI:

    Will download a .zip file containing:

    Getting the sample client code

    Sample c# .net client wrapper library Sample c# .net client application

    Sample java client wrapper jar

    Sample java client application

    Sample java proxy server application

    Sample Web Service

    Readme.txt files at all levels with instructions

  • 8/6/2019 .Net.and.Java Neumann

    6/19

    dotnetclient\BbWsClient : Generated client code and Sample

    Wrapper classes

    qa\dotnet\wsagent: Sample client application

    Key Files: dotnetclient\readme.txt

    .NET client code layout

    .

    dotnetclient\BbWsClient\BbWsClient.csproj

    dotnetclient\BbWsClient\BbWsClient2008.csproj

    qa\dotnet\readme.txt

    qa\dotnet\wsagent\wsagent.csproj

    qa\dotnet\wsagent\wsagent.sln qa\dotnet\wsagent\wsagent2008.csproj

    qa\dotnet\wsagent\wsagent2008.sln

  • 8/6/2019 .Net.and.Java Neumann

    7/19

    dotnetclient\sampleGenClient.cmd

    Needs access to wsdl.exe by default uses the one installed atc:\Program Files\Microsoft SDKs\Windows\v6.0A\bin

    Run in the dotnetclient directory with the base url of your AcademicSuite server as a parameter:sampleGenClient.cmd http://my.server.url

    Two arts:

    Code Generation Scripts: .NET

    Code generation Code adjusting

    Code Generation is merely running wsdl.exe for each of the Web

    Services placing the files in dotnetclient\BbWsClient\gen

    Note that you must have set all your Web Services as discoverableprior to generating code or this step will fail.

  • 8/6/2019 .Net.and.Java Neumann

    8/19

    Code adjusting runs a series of sed-like replacements on the

    generated .cs files. These adjustments include: Renaming duplicated classes for shared classes across Web Services to avoid

    build errors and ensure that all client code shares the same class definition Changing the parent class for all Web Services to

    Microsoft.Web.Services2.WebservicesClientProtocol to support WS-Security

    A simple sed-like program is included in the .zip (bsed.exe) this is

    Code Generation Scripts: .NET

    _ ,

    required. If you wish to use your own sed then set SED_PATH priorto running sampleGenClient.cmd

  • 8/6/2019 .Net.and.Java Neumann

    9/19

    Follow the readme.txt to make sure you have the prerequisites

    installed (VS 2008 or 2003 and WSE 2.0)

    Run sampleGenClient in the dotnetclient directory to generate the

    client stubs Open the wsagent solution file from the qa\dotnet\wsagent directory

    for your VS version (.net 2003: wsagent.sln, VS 2008:

    Building: .NET

    .

    Build and Run as normal (i.e. F5)

    This client application is a GUI interface to demonstrate all of the

    Web Service operations. It is not meant to be pretty merelyfunctional.

  • 8/6/2019 .Net.and.Java Neumann

    10/19

    Client: Generated code and sample wrapper classes

    Javaclient: Sample client application

    Proxy\java: Sample proxy server application

    Key Files: client\.project

    client\build.xml

    Java client code layout

    .

    client\sampleGenClient.cmd

    javaclient\.project

    javaclient\readme.txt

    proxy\java\.project

    proxy\java\build.xml proxy\java\readme.txt

  • 8/6/2019 .Net.and.Java Neumann

    11/19

    client\sampleGenClient.cmd

    Needs access to Axis2 1.3. By default this is d:\axis2\axis2-1.3 soset AXIS2_HOME to your axis2 installation first (See readme.txt)

    Needs to have sed on your path

    Two parts: Code generation

    Code Generation Scripts: Java

    Code Generation is merely running wsdlToJava for each of the WebServices placing the files in client\generated

    Note that you must have set all your Web Services as discoverable

    prior to generating code or this step will fail.

  • 8/6/2019 .Net.and.Java Neumann

    12/19

    Code adjusting runs a series of sed replacements on the generated

    .java files. These adjustments include: Some annotations to reduce warnings in the generated code

    Changes to the generated ns prefixes in a number of places to avoid runtimeconflicts using the default prefixes of ns1 and ns2

    Code Generation Scripts: Java

  • 8/6/2019 .Net.and.Java Neumann

    13/19

    Follow the readme.txt to make sure you have all the prerequisites

    installed (ant, jdk, sed, axis2, rampart, eclipse)

    In the client directory:

    Run sampleGenClient to generate the client stubs Copy project.properties to build_personal.properties and edit it to set

    AXIS2_HOME for your system

    Run ant

    Building: Java

    To build/run the javaclient application you need eclipse. Use the Import existing projects into workspace feature and import all the .project

    files from the unzipped client folder. (or just client/.project and javaclient/.project)

    Setup the classpath variable in eclipse preferences AXIS2_HOME as perclient/readme.txt

    Build

    There are several possible main classes to run here: All incom.blackboard.test.wsclient.clients.* Each of these is a relatively crypticcommand line tool that tests a variety of the Web Service methods across all theWeb Services.

  • 8/6/2019 .Net.and.Java Neumann

    14/19

    Client Concepts: Registration

  • 8/6/2019 .Net.and.Java Neumann

    15/19

    Three types of sessions/methods to get a session id:

    User ContextWS.login Needs userid and password only works if authentication sources is AS Internal database

    Session gets all the entitlements for the given user Tool ContextWS.loginTool

    Need to register the tool first, via ContextWS.registerTool

    Uses shared password for the tool set on the properties page for the proxy tool in AS

    Client Concepts: Session + entitlements

    ess on on y ge s e en emen s or e me o s reques e n e ear er ca o

    registerTool

    Ticket ContextWS.loginTicket Need to register the tool first, via ContextWS.registerTool

    Uses a ticket representing the currently logged in user, provided to the tool by AS during anoutbound POST in response to a proxy tool action

    Session gets the intersection of the entitlements the user has in AS and those requestedduring the registerTool call

    In all cases, once a session id is obtained, it must be set in the WS-Securityheaders for all subsequent method calls.

  • 8/6/2019 .Net.and.Java Neumann

    16/19

    Java: com.blackboard.test.wsclient.ClientWrapper - this class is the

    main sample wrapper code to deal with: Creating the client stub instances

    Setting axis2 client options such as a callback class to handle the WS-Securityheaders

    Providing wrapper instances for the Web Services (i.e. wsclient.wrappers.*)

    .net: WebserviceWrapper.cs provides similar functionality:

    Client Concepts: Wrappers

    creates the client stub instances

    Sets up the usertoken on the requestsoapcontext to handle the WS-Securityheaders

    Factory for wrapper instances for the Web Services (i.e. *Wrapper.cs)

    Provides some wrapper calls to some of the methods on the ContextWS

  • 8/6/2019 .Net.and.Java Neumann

    17/19

    .net Client Details: Main page

    Conceptual Mockup: Subject to change without notice

  • 8/6/2019 .Net.and.Java Neumann

    18/19

    http://www.edugarage.com/display/BBDN/How+to+Write+Basic+Web+Service+Clients

    Javadocs downloadable from UI for each Web Service

    Resources

  • 8/6/2019 .Net.and.Java Neumann

    19/19

    Questions?