Virtuoso Universal Server 4.5 Application Integration (Web Service Composition) Reviewer's Guide OpenLink Software Published: March 9, 2006 © 2006 OpenLink Software. All rights reserved. OpenLink, UDA, Virtuoso registered trademarks or trademarks of OpenLink Software in the United States and/or other countries. The names of actual companies and products mentioned herein may be the trademarks of their respective owners. Virtuoso 4.
Table of Contents 1 Preface .................................................................................................. 3 1.1 Objective ........................................................................................... 3 1.2 System Requirements ....................................................................... 3 1.3 Installation........................................................................................ 4 2 Virtuoso Universal Server ........................................
1 Preface 1.1 Objective Thank you for taking the time to evaluate OpenLinks Virtuoso Universal Server 4.5. This guide introduces the Virtuoso 4.5 Server as well as Virtuoso’s new administration and configuration tool, the Virtuoso Conductor. This guide takes you through Virtuoso, covering virtual and federated database, publishing and utilizing web services, XML storage, processing and querying, business process management and more.
• IE 6.0, Mozilla (Firefox), Opera, etc. 1.3 Installation Download the Virtuoso 4.5 installer from OpenLink Software Virtuoso Download area at: http://oplweb.openlinksw.com:8080/download. Install both default and demo databases by following the instructions provided by the installer. At the end of the installation process, the Virtuoso server will be installed with both default and demo databases.
2 Virtuoso Universal Server 2.1 Introduction This reviewer’s guide presents Virtuoso 4.5, the latest version of OpenLink Software’s next-generation Universal Server Platform. Virtuoso facilitates the development and deployment of a new generation of Enterprise-wide, Internet-, Intranet-, and Extranetbased solutions. Virtuoso capabilities include handling of Disparate Databases & Data Sources, Web Service Composition and Business Process Integration.
• Identifying disparate data for integration and linking the data into Virtuoso • Creating XML based documents or ODBC data sources for heterogeneous data Web Services Composition • Identifying monolithic applications from which services are to be decoupled, composing, and linking their functionality into Virtuoso • Creating virtual directories as endpoints for exposing functionality for web services clients.
3 Web Services Platform 3.1 What Is This? As a Web Services Platform, Virtuoso includes built-in support for WSDL, SOAP, UDDI WS-Security, and several other Web Services Protocols. It enables the creation and composition of Web Services from existing application logic pools hosted within monolithic mission critical applications.
3.3 Exploiting Value Proposition 3.3.1 Web Service Composition from SQL Stored Procedures 3.3.1.1 Linking/Attaching External SQL Stored Procedures The following section includes steps for linking in external stored procedures from an ODBC Datasource. The steps in the example below uses a connected datasource called Demo_SQLSVR that maps to a Microsoft SQL Server database containing the Northwind schema. Step 1.
Figure 4 - Selecting the External Stored Procedures Step 5. In Figure 5 – Linking and Qualifying the Stored Procedures, a new page listing the chosen procedures and their associated data type information is displayed. On this form, you can alter the data type mappings that Virtuoso will use both internally and for any future interactions with the SOAP server. If you do not want to specify any special type information, the details can be left as default. Virtuoso 4.
Figure 5 – Linking and Qualifying the Stored Procedures Figure 6 – External Data Sources Note 1 - When linking in these procedures, for each remote procedure you have the option to change how they will be referenced within Virtuoso. These include changing the fields for Local Name, Database, and Schema. Step 6. As shown in Figure 6 – External Data Sources above, for each procedure there are radio buttons for selecting the PL Wrapper Requirements.
/WebDAV/HTTP Virtual Directories page lets you make a new URL Mappings. The HTTP Virtual Directories page should contain a table with a row for {Default Web Site}. Click on the Edit URL Mappings link for the {Default Web Site} line to begin defining a new SOAP mapping. Step 7. Step 8. To create a Virtual Directory with a SOAP mapping you first must select the Soap Service HTTP endpoints option under the Web Services Tab in the Conductor.
Figure 8 – Adding a Virtual Web Directory to Publish the Service Figure 9 – Publishing the SQL Stored Procedure You will be presented with a screen for selecting the procedures or XML templates. For selecting the procedures, you first have to select the appropriate catalogue that contains the procedure that you want to publish. For the XML Templates you simply select the template using the checkbox and provide an Export As name to choose the new SOAP name that a XML template for which it is referred.
Figure 11 – Selecting the Database containing the stored procedure Figure 12 - Web Services Test Page Service Invocation Response More Information Virtuoso 4.
For more information regarding Publishing 3rd Party stored procedures as Web Services see • Virtuoso Publishing 3rd Party Stored Procedures as Web Services Documentation • Virtuoso Publishing 3rd Party Stored Procedures as SOAP Services Tutorial Virtuoso 4.
3.3.1.3 Exercising Published Services 3.3.2 Web Services Composition from other Application Logic Sources Business logic written in Java or any of the Microsoft .Net languages can be hosted inside the Virtuoso process. This business logic can access Virtuoso's database and virtual database capabilities directly via an in-process client. This eliminates the gap between the application and database tiers in a three-tier architecture.
Figure 14 – Demo AUDIO_CASSETTE User Defined Type Step 3. Once the UDT has been defined, it can then be used in stored procedures, tables or views. For example, in the create table below Instead of specifying BookProductType as the data type you can specify DEMO..AUDIO_CASSETTE as show below in Figure 15 – Create Table Statement using UDT. Figure 15 – Create Table Statement using UDT CREATE TABLE DEMO..BOOK_VIEW_DETAILS (ProductID integer NOT NULL, BookProductType DEMO..AUDIO_CASSETTE ); Step 4.
Figure 16 – Demo Table BOOK_VIEW_DETAILS Figure 17 – Schema Object BOOK_VIEW_DETAILS Definitions New types can be further derived producing sub-types. User-defined types can include methods and constructors to create any potentially complicated system to house data as exactly required. Virtuoso automatically handles the mapping between the SQL type system and hosted language native types.
Figure 18 – Directory of Point.dll and Point.class Step 1. The first step is to create a piece of code or class in C#. the definition of the point class written in C#. Figure 111 shows Figure 19 - C# code Point.cs using System; [Serializable] public class Point { public Double x; public Double y; public Point_10 () { x = 0; y = 0; } public Point_10 (Double new_x, Double new_y) { x = new_x; y = new_y; } public Double distance (Point p) { Double ret; ret = Math.Sqrt ((p.x - this.x) * (p.x - this.x) + (p.
Figure 20 – Import Files Step 3. Type in the location and file name for the class. In this example, we type in C:/Program Files/OpenLink/Virtuoso 4.5/bin/Point.dll. Note 4 - Under this option, you can load as many modules as you want to load by selecting Add to List and then select Load all. Step 4. Once you have added the object, select Load Selected, which will register the Point class object as a UDT shown below in Figure 21 – Loading Modules and Figure 22 – Loading Hosted Modules.
restrictive by granting the module public access. The Security of a UDT is maintained through normal SQL GRANT and REVOKE statements via a simple extension. You can define the level of access to both native and externally hosted UDTs. Step 6. Once grants are applied, you can view the existing grants for all loaded modules as shown in Figure 24 – Existing Grants. These grants can be removed at anytime and redefined using this screen.
"new_y" double precision external type 'System.Double'), METHOD "distance" ("p" Point external type 'Point') returns double precision external type 'System.Double' external name 'distance' ; As seen in Figure 26 – Viewing Hosted Module, loaded Hosted Modules can be viewed at any time via the Administration Use Interface.
member (method) to calculate the distance between points. Note that "Point" class is computing the distance between two arbitrary points and the arbitrary values 1 & 2 as input parameters for the Stored Procedure "distance" whose definition is show below in Figure 28 – Distance Stored Procedure. Figure 28 – Distance Stored Procedure CREATE procedure clr..distance (in x1 integer, in y1 integer, in x2 integer, in y2 integer) returns float { return new DB.DBA.Point(x1, y1).distance (new DB.DBA.
Figure 29 – Testing CLR UDT and distance stored procedure Figure 30 - Testing the SOAP Operation, Distance 3.3.2.1.2 User Defined Types and Java Classes The steps used to create a hosted module in Java are the same as the CLR. However, in order to access the Java class instances they have to be defined as Virtuoso types using CREATE TYPE and specifying LANGUAGE JAVA. Figure 122 and 123 shows the definition of the Point class written in Java and the UDT definition in Virtuoso.
} Figure 32 – Defining the Create Type in Virtuoso for Java create type "Point" language JAVA external name 'Point' AS ( "x" double precision external name 'x' external type 'D', "y" double precision external name 'y' external type 'D' ) unrestricted CONSTRUCTOR METHOD "Point" ( "p1" double precision external type 'D', "p2" double precision external type 'D'), METHOD "distance" ("p1" "Point" external type 'LPoint;') returns double precision external type 'D' external name 'distance', ; More Information
3.3.2.2 .NET Assemblies 3.3.2.3 Scripting Languages When a page in PHP, PERL or Python is in an executable directory in the web server space, no special code or declaration is required as in the aforementioned Java or CLR examples. These languages will be executed when requested. There is however special Virtuoso SQL specific functions for accessing these languages from stored procedures.
3.3.2.4 Creating an Assembly for .Net In Figure 39 – Create Library, we have a create assembly example with the same class used in the CLR examples for .Net Figure 39 – Create Library CREATE LIBRARY "myPoint" as 'temp_dll_stor\\Point.dll') WITH PERMISSION_SET = UNRESTRICTED WITH AUTOREGISTER; 3.3.2.5 Sandboxes and Security Hosted .Net code can run in two modes: Restricted and unrestricted. 3.3.2.5.
3.3.3.2.1 ASP .Net Hosting The default the installed demo instance includes hosting of the IBuySpy Portal, which is an aspx-based application as seen below in Figure 40 – IBuySpy Portal You can set this up through the tutorial or browse directly to this demonstration by typing the URL on your own local installation or on OpenLinks online demo: http://localhost:8890/PortalCSVS/ on Windows or http://demo.openlinksw.com:8890/PortalCS on Linux Figure 40 – IBuySpy Portal 3.3.3.2.
4 Appendix 4.1 Demo and Northwind Database A number of the examples in this document reference the Virtuoso demo database, which is derived from Microsoft’s Northwind database ships with Virtuoso 4.5. In addition, where indicated other examples specifically use the Northwind database. This database can be obtained from Microsoft at http://www.microsoft.com/downloads/details.aspx?FamilyID=06616212-0356-46a08da2-eebc53a68034&displaylang=en 4.2 Industry Standards Support • Runtimes & Frameworks Microsoft .