CTserver Web Services

Web services available at the CTserver site

Web services are remote procedures that communicate with internet clients using XML over HTTP. Web services are somewhat simpler for clients to utilize then their CORBA-based equivalents and may be easily consumed from standard applications like Microsoft Office, and from python-, PHP- or javascript-based web clients.

We have implemented web services that (1) retrieve thermodynamic properties of minerals and mineral reactions utilizing the internally consistent database of Berman (1988), that (2) compute thermodynamic properties of other phases and solutions in the CTserver phase library, that (3) perform calculations utilizing the H2O-CO2 silicate liquid solubility model of Papale et al. (2006), and that (4) perform calculations using the Fe-Ti two-oxide geothermobarometer of Ghiorso and Evans (2008).

The web services available at this site are based on the SOAP message passing protocol. We utilize a Tomcat server that listens for requests on port 8080 at ofm-research.org.

Web services are defined in terms of a web service description language (WSDL) , which is equivalent to a CORBA IDL description of server functions.

Documentation:

Further documentation on CTserver phase library web services

The software design adopted for our distributed computing infrastructure at CTserver is multileveled. The lower most level consists of modularized C++ classes that each compute the thermodynamic properties of a single phase or solution. These C++ classes are compiled into a library of functions, which may be thought of as the primary phase library. A CORBA-based client does not interact with this library, but instead establishes contact with a middle layer of CORBA-aware server software (also written in C++) that processes requests, calls upon functions in the primary phase library, and delivers results back to the client. The CORBA IDL describes functions that exist in the CORBA-server middle layer. Our CTserver phase library web services rely upon the same primary phase library that is utilized by the CORBA-server middle layer, but the intermediate software layer in this case is written in Java with C++ native methods that call upon functions in the primary phase library classes. The WSDL describes functions that exists in the Java middle layer. This middle layer is installed in the Axis (SOAP) extension of the Tomcat server.

All of the phases and solutions defined in the primary phase library are accessible as web services. Extensive documentation is provided for the C++ classes in the primary phase library at this link. Phases and solutions whose thermodynamic properties are provided by the CTserver phase library web services are listed here.

How to call web services from your web page

The simplest method to access a web service on the CTserver site is to construct a URL that the Tomcat web server will translate into an appropriate SOAP compatible XML document and automatically forward this document to the server application that it manages. The response from this request will be returned as a SOAP-compatible XML document to the browser. For example, in the CTserver phase library, there is a method named phaseNumber that retrieves the total number of phases known to the server. This is a useful method because with this information, clients can call other methods defined in the WSDL and iterate through all the known phases retrieving names, formulas, number of thermodynamic components, etc. The call to the phaseNumber method requires no arguments and is constructed as:

http://www.ofm-research.org:8080/axis/services/phases?method=phaseNumber

Paste this URL into the browser's address window and type a <return>. You should see the response displayed in a new window. This response might just be the number 124 in a browser like Safari that is not XML aware, or it might be a more complete representation of the SOAP message, as in an XML-compatible browser like Firefox.

Method calls that require arguments may also be defined with a URL. For example,

http://www.ofm-research.org:8080/axis/services/phases?method=phaseName&in0=3

retrieves the name of the phase whose index is 3 (indices start at 0 in the CTserver phase library).

An even more complex example is illustrated by retrieving thermodynamic properties of a Berman (1988) database phase using our berman web services. To do this for almandine garnet at 1213 K and 1100 bars, which has index number 3 in the Berman database tables (see table of indices for Berman phases), the URL construction is:

http://www.ofm-research.org:8080/axis/services/berman?method=calculateTP&in0=3&in1=1213&in2=1100

If you try pasting this URL into the address field of the Safari browser and type a <return>, the output will not look very meaningful, because the browser has not formatted the resulting stream of characters into the 11 quantities returned by the method. Try the same think in Firefox and you will see a nicely formatted XML response that is parsed correctly for all 11 returned quantities.

For any serious use of these services in a web page, the SOAP calls should be constructed using a scripting language, such as PHP, python, or javascript. The application we have developed for the web services found on the Berman Thermodynamic Database page uses server-side PHP to form the SOAP request and interpret the response. The PHP code required to execute the berman web service example given above would be written:

<?php 
  try {
	$client = new SoapClient("http://www.ofm-research.org:8080/axis/services/berman?wsdl");
  } catch (SoapFault $exception) {
    echo $exception;
  }
  try {
	$result = $client->calculateTP(3, 1213, 1100);
  } catch (SoapFault $exception) {
    echo $exception;
  }
?>

The result of the calculation is returned in an array of length 11, given above as the PHP variable "$result." Individual elements ($result[0], $result[1], ..., $result[10]) contain thermodynamic properties as documented in the WSDL. These properties may be output to the web page using PHP print commands (i.e., echo).

We would appreciate hearing from users regarding CTserver web services. We would especially like to hear about applications developed with python, javascript, or other tools, including Microsoft™ Office. Please let us know what you do with these services and how useful they are to your research and educational activities.

How to call web services from Microsoft Excel

If you have access to either Microsoft™ Excel for Windows XP (Excel 2002) or Excel 2003, running under Windows 98, ME, NT, XP, 2000, or Windows Server 2003, you may choose to access the web services provided by at this site using a Visual Basic macro. To do so you must first install one of the following optional Excel components:

depending on the version of Excel or Office that you have running on your machine. Note that the web services toolkit libraries are only available for Excel running under Microsoft Windows. Instructions for setting up web service access are included in the toolkit documentation available at the Microsoft site. The WSDL description file for any web services provided by OFM Research may be downloaded from the URL:

http://www.ofm-research.org:8080/axis/services/SERVICE?wsdl

where SERVICE should be replaced with the appropriate service descriptor: berman, oxideGeothrm, papale, or phases.

A working example of how our "Fe-Ti oxide geothermometer" web service is utilized as a function call in an Excel workbook may be downloaded from this link.

A working example of how our "mixed H2O-CO2 fluid solubility in silicate liquids" web service is utilized in an Excel workbook may be downloaded from this link.

Execution of web services within Excel workbooks requires an active internet connection. Firewall or Windows security settings may interfere with the performance of workbook functions. If you develop examples of Excel workbooks that utilize our web services, we would be interested in receiving copies of your work.