SAGA D.C. GmbH SAGA.M31 - Galaxy - Create Web Services in 15 minutes   SAGA D.C. GmbH
Introduction

Any developer knows the pain associated with having to access data on various platforms: Databases, LDAP Directories, Mainframe Applications, Third Party Software and the list goes on. Every platform has its own access strategy that the developer needs to get familiar with, and as if this is not enough, she then needs to implements this into the programming language that she is currently working with. And if data access isnt enough, developers thesedays are faced with the task to move data from one platform to another. Now there is something to make this task easier, quicker and more reliable: SAGA.M31 - Galaxy

SAGA.M31 - Galaxy aims to give a uniform interface to data independent of where it comes from. It is a revolutionary new approach to Data Access that not only makes access simpler but also makes Data Migration a reality. This uniform data interface that Galaxy provides to the outside world is a Container and you will see how to make Containers later on. But Containers are just the start, SAGA.M31 - Galaxy provides these Containers via a Web Services (completer with WSDL & SOAP Request/Response) without any coding necessary. In fact, it is possible to make a Web Service in just 15 minutes!

Apart from the Web Service Interface, SAGA.M31 - Galaxy also has the following features:

Requirements

SAGA.M31 - Galaxy is an J2EE (Java 2 Enterprise Edition) Web Application that needs a J2EE Application Server (that must have a Servlet Container) to run in. Galaxy has been tested on the following Application Servers:

J2EE Application Servers need a version of the Java Runtime Environment (JRE). We recommend Version 1.4.x of the JRE for Galaxy. The newer Java 5 and versions older than 1.4.x are not supported.

Apart from this, Galaxy needs a MySQL Database that it can access. MySQL can be freely downloaded from: MySQL. We recommend Version 4.0.x Series of MySQL.

Download and Installation

The Galaxy package can be downloaded at Galaxy Website. The installation instructions are included within the package in a file called install.txt. Before installaing Galaxy ensure that you have:

SQL Connectors and Container Requests Tutorial Introduction

In this section, an SQL Connector will be created and Requests will be created to show how SQL Data can be included in a Container. An SQL Connector provides access to SQL data via the JDBC interface. Connectors provide two types of fields: Tables and Field/String data. In the following examples, we will create connector requests that return both Tables and Fields.

Database creation

In the MySQL database create a Database called TSC. This a database that will contain one tabled called addresslist. This table contains a list of users and their contact details that work in TSC Inc. The table creation SQL is contained in the file TSC_sample.sql. Run is SQL within the TSC database in MySQL and it will create the table and fill it with some values.

To work with databases other than MySQL you need to do the following:
Tomcat


Websphere
Consult the Websphere documentation and setup a JDBC data source.

The addresslist table has the following structure:

Name Type Description
ContactId String The unique id, which identifies the record
FirstName String The first name of the contact
LastName String The last name of the contact
Telephone String The contacts telephone number
Email String The contacts email address

SQL Connector Creation

On the Galaxy Menu, click on "Create Connector". From the drop down, select "SQL" and click "GO!". Name the connector as "SampleAppConnector" and fill in the values to match your database configuration (that containts the addresslist table) and click "Save".

SQL Request to get all Users

To make an SQL Request, From the Menu, click on "SQL Connector". This will take you to the home of the SQL Connector. Here you can:

Click on the "Add Query" in front of the SampleAppConnector.

The Query Creation is a 3 step process. In Step 1, you create the Query and test it. In this case, type the following Query: SELECT * FROM addresslist; and hit "Run Query". You should see all the values of this table.

The results should appear as shown below. The Checkbox "Result always tabular" is checked because this way the results will always be returned in a table. Without this checkbox checked, if the number of rows returned by a query is more than 1 then it is returned as a table, otherwise, it is returned as a list of fields. An example of this is shown in the second SQL Request that will be shown later in this document.

The "Limit" limits the number of rows that will be fetched from the database. If a query is poorly designed, then it is possible a very large data set will be fetched from the database. This may cause memory problems and hence the limit was placed. A Limit of 0 means that the all rows will be returned.

For the sake of this exercise, we will edit the query to return:

Edit the Query to be: SELECT ContactId, FirstName, LastName FROM addresslist; Now Run the query.

Click on the "Go To Next Step" button and we move to Step 2

In this step, we give names to the fields that this query returns. And if a query returns tables, then we also give a name to the table. In this case, type "Users TSC Inc." into the Table Name field. The rest of the names we will leave as is. Notice that there are Input Fields. We will cover Input Fields later in this document. Click on the "Go To Next Step" button and we move to Step 3.

In Step 3, we review our query, the output it provides and any input it takes. Once satisfied click on "Save Changes" and you will be taken to the page that shows all SQL Queries configured against this connector. Here you can click on "Show Fields" and it will show the fields for the query you just created.

Container that Provides all Users

We will now create a container that provides all users. Container creation has been previously been covered, so we will skip the details.

To Create Container click on "Create Containers" in the Menu. Fill in the data as shown below.

Click on "Next Step" to go to Step 2. Here you need to select the appropriate Connector from the "Fields in Connector" Drop Down. In this case, you select the "SampleAppConnector". For the moment, we only have this connector giving out a table. Click on the "Add" link for the "Users TSC Inc." field.

This field is now added to Container Output Fields. Will give this Field a new name in the Container: AllUsersTSC. We choose this name because it contains no spaces. This is necessary for the Version 2 XML Structure that is used in creating the WSDL for this container. In the Version 2 XML, the XML Tag's text is the Container Field name.

Click on "Next Step" to go to Step 3

Since this fields takes in no input Fields, there is nothing to do in this step. Click on "Next Step" to go to Step 4. In Step 4, we review our connector and Save the changes by clicking on "Save Changes". This will take up to the Container List Page

On the Container List Page, click on "Sample Run" against the "All Users TSC Inc." container. This will take you to the Galaxy Sample Request Page.

Select the V2 (Version 2) XML Structure and Hit "Fire"

Note the XML Structure and how it gives the table rows.

Connector Request With Input Fields

In this example, we will create an SQL Connector Request that takes in an Input Field and finally we will make a Container that will provide this information.

From the Menu select "SQL Connector" and on the SQL Connector Page, Click on "Add Query" against the SampleAppConnector. Type the following Query: SELECT * FROM addresslist where ContactId = '3'; and hit "Run Query".

Now we will make an Input Field from the WHERE clause of the SQL. We will turn the ContactId into an Input Field. We do this by replacing the '3' in the SQL by the following: #contactID#.This #inputParameter# notation is used to say that the inputParameter is something that will go into this SQL Query.

Replace the Query with the following: SELECT * FROM addresslist WHERE ContactId = '#contactID#'; and click on "Parse Query". By clicking on Parse Query, we are telling Galaxy that this query contains some input fields, so it needs to parse them. Galaxy then creates input fields out of these inputParameters. This is to let you test the query and give it some sample input date and run it. In out case, you can put 3 in the contactID field and click on "Run Query With Above Values". This will replace the #contactID# in the SQL with whatever you put in the field ('3' in this case).

Click on "Next Step" to go to Step 2. Here you can see that there is an input Field needed to satisfy this connector request. This means that if we create a Container that contains any of the output fields that this request provides, then we will also have an container input field that will map to the input field "connectorID" for this request.

Click on "Next Step" to go to Step 3 where we review out changes.

Container For User Details

We will now create a container that will provide the contact details of a user. Go to the Container Creation page and the fill in the data shown in the following screen shot and press "Next Step".

From the Fields for connector, choose the SampleAppConnector and you will the fields that we just created in the previous section. Add all the following fields as output fields to the container:

Click on "Next Step" to go to Step 3. Here you will see that to get the data you asked for in the previous step you need to provide some information: the ContactID. Click on "Add as New" and it will create a Container Input Field that will map to the ContactID Connector Input Field. We will give this field a new name: userID. Fill this in the Name field.

Click on "Next Step" to go to Step 4. Here you can review the Container.

Click on "Save Container" to save the changes. This will take you to the List Containers Page. Here you can click on "Sample Run" against the User Contact Details TSC Inc. Container. You will note that this container has in input field and this is shown. You will need to enter a "userID". Select the V2 XML and check the "Show XML Request/Response". Enter 3 in the text field and click on "Fire!."

The results shown are very similar to the original SQL Query that was used to create the connector request. The XML Request response should be as below

Galaxy XML Request Response Structures

Galaxy has 2 XML Request Response Structures:

Why 2? Well, the first one (Version 1 or V1 for short) was created before our current Web Services implementation. After creating our Web Services implemenation, we notices that the V1 XML Structure caused Web Services Interoprability problems between the J2EE and the .NET Platforms. Hense a new XML Request Response Structure was created: the Version 2 or V2 for short. The V2, though simpler than V1, makes it simpler to access the Web Services via the Microsoft Office XP Web Services Toolkit 2.0. This toolkit allows data from Web Services to be easily placed in Microsoft Office Documents. The main differences between them can be seen when you do the sample request on Containers and select the different XML Structures.

Web Services Interface

Galaxy has a Web Services interface that allows you to:

Galaxy uses the Document-Literal Style Web Services. We use this style of Web Service, again, to improve Interopribility between different platforms.

 
  » Imprint » Disclaimer » Terms » Contact » Privacy  
 
© 2006, SAGA D.C. GmbH - All rights reserved

Powered by SAGA.M31 - Galaxy -