N. America: (800)876-3101 | World: +44 (0) 1-344-386-367

Data Aggregation Web Services

Data Integration Suite XQueryWebService Framework

XQueryWebService is a framework that allows you to expose an XQuery as a Web service. XQueryWebService is a Java servlet tested on numerous Java servlet containers like Apache Tomcat, JBoss, IBM WebSphere, and BEA WebLogic, the XQueryWebService framework simplifies the design and implementation of Web service applications.

Each XQuery exposed as a Web service provides a single operation; this operation is expressed in the query body through a function that takes the name of the XQuery file without the extension. For example, the file emp.xquery provides the emp operation. Parameters (external variables) expressed in the XQuery, if any, are reflected in the operation’s prototype.

Click here to learn more about the Data Integration Suite XQueryWebServiceFramework.

XQueryWebService Framework Architecture Overview

Let's take a look at the XQueryWebService framework architecture before getting into more of the details.

A high-level illustration of the XQueryWebService framework architecture shows all the pieces at work to expose an XQuery as a Web service:

 

 

To start, an HTTP request is submitted to a Web server — a Tomcat Web Server in this case. The URL used to invoke the Web service takes the following form:

http://examples.xquery.com/employee-lookup/emp.xquery?id=A-C71970F

Where:

  • http://examples.xquery.com/employee-lookup/emp.xquery is the location of the XQuery Web service. The Web service was created by saving an XQuery to the /employee-lookup folder where the Tomcat Web Server is running.
  • id=A-C71970F is a parameter passed to the XQuery. The variable that takes this parameter is defined in emp.xquery:

declare variable $id as xs:string external;
<root>{
   for $employee in collection("employee")/employee
   where $employee/emp_id = $id
   return $employee
}</root>

The query body is just a single FLWOR (For each, Let, Where, Order by, Return) expression.

When the XQuery processing is finished, it returns a value using HTTP response, as shown in the following illustration:

 

 

Most of the work performed by the Web service takes place in the DataDirect XQueryWebService servlet, a close-up of which is shown here:

 

 

The browser (or an application) submits the Web service request using SOAP or HTTP GET for the XQuery stored on the Web server. Next, DataDirect XQuery unpacks the Web service request and binds its parameters, if any, to the XQuery. In our example, the parameter passed with the Web service request is an ID. The XQuery is then executed and its result (an XML document) is returned to the client.

 

Email Print Share

Download Data Integration Suite

Data Integration Webinar

Web Services and Data Integration Across Heterogeneous Data Sources

Data Integration White Paper

Taming Data Chaos: Simplifying Data Integration

Taming Data Chaos

Product Review - Data Integration Suite

Video Systems Journal takes a look at Data Integration Suite.

VSJ Review

Spotlight - What's New

Data Integration Suite Release 6.0 - New and Enhanced EDI Standard Support