L. Finding Data

From SCOOP Wiki

Jump to: navigation, search

This lesson is designed for more advanced users or users that are interested in finding data in the SCOOP archive without the use of the SCOOP search engine interface. Whether this applies to you or not, look over the lesson to get a basic idea of what is going on behind the scenes. After looking over the lesson, you can then decide whether you should skip or complete this lesson.


Contents

Basic terminologies

Web server - Web server is a software that provides resources such as files, HTML pages upon request by a web user using Hyper Text Transfer Protocol(HTTP).Web servers often come with internet and intranet based utility programs for serving email, support for file transfers, and creating and publishing web pages. Apache is one such web server used in our experiments.

Web browser - Web browser is a software application that allows one to access information in the World Wide Web. Web browsers use HTTP protocol to make requests to web servers for a service.

SOAP - SOAP, the acronym for Simple Object Access Protocol is set of rules that govern the communication between two applications over internet. It is written in XML like language and remains an indispensable interoperable protocol for applications in different platforms. The communication is carried over HTTP.

SOAP server - SOAP server is software that listens for incoming SOAP messages and acts as a distributor and interpreter of SOAP documents.

SOAP client - SOAP client is program that creates an XML document containing the information needed to invoke remotely a method in a SOAP server for some service.

PERL - PERL, the acronym for Practical Extraction and Report Language is a high level scripting language used for processing text and many more. However, because of its strong text processing capability, it has remained a popular language for developing business logic at the webserver.

Short example of the usage of the above components

  • Type the following URL in the web browser.
  http://<IP Address of Appliance>/Catalog
  - "<IP Address of Appliance>" (Eg:192.168.174.134) is the machine that hosts the web server.
  - Catalog is a directory in the web server. 
  - HTML page that is shown is the index.html file present in the directory "catalog".

  • We find two kinds of searches here. Let us consider the example of searching the information about the storm present under the head "QUICK SEARCH BY STORM". Upon invoking the "Go" button after entering the name of the storm and the year it occurred in the textboxes provided, a script gets executed. The identity of the script and its location will be present in the index.html. This script collects the input which the user has provided through the web browser, prepares a SOAP query message containing the values and finally sends them to the SOAP server.
  • SOAP server receives the request, parse them to identify the application that can provide the service, invokes the application and collects the output from it. The collected output is then send to the SOAP client that initiated the request which then renders the output to the end user in the form of HTML page.

Accessing HTML and the script files in the appliance

The index.html and the scripts mentioned above can be accessed using one of the following methods

  • SAMBA
    • Type "file:\\<IP Address of Appliance>\griduser" in the address bar of Internet explorer:
    • This will open up an explorer window with files in the /home/griduser directory of the appliance.
    • Go to the "public_html/Catalog" directory.
    • The script files and index.html will be present here. These files can be opened and edited using any of the available editors(notepad/WordPad).
  • Modifying directly in the appliance
    • Log into the appliance.
    • Make sure that you are in the /home/griduser directory by simply typing in the command "cd" at the prompt.
    • Go to the public_html/Catalog by issuing the command "cd ./public_html/Catalog".
    • The index.html and the script files present in there can be edited by opening them using editors such as "vi".

Steps to follow while writing scripts that help to achieve the above mentioned operation

  • Include the package that provides HTTP support to SOAP in the following way.
       Use SOAP:: Transport::HTTP
       
  • Include the following package that contains methods to send SOAP query and receive them.
       Use SOAP::Lite
  • Include the optional package that is required when needed to parse the XML data received.
       Use XML::Parser
  • Retrieve the data input by the user using the method GetPost() of the WEB module.
  • Prepare the XML SOAP string to query and store it in a variable say "SOAPmessage".
  • Send the SOAP query using the following method.
       my($res) = SOAP::Lite
                -> uri ('SCOOPStormServices')
                -> proxy ("http://score.itsc.uah.edu/Storms/SCOOPStormServices.cgi")
                -> search (SOAP::Data->type (string => $SOAPmessage))
                -> result;
       Where uri() - specifies the unique identifier for a service
                proxy() - specifies the end point of the soap server
                search() - denotes the method to be invoked along with arguments
                res - stores the response
                
  • Parse the received output and provide the result back to the end user.

Example program (available at http://scoop.sura.org/services/catalog.html)

This demonstrates the way to send SOAP query and receive response

Include the necessary headers

    use SOAP::Transport::HTTP;

Fetch the argument passed

    $thing = shift or $thing = "all";

Forming SOAP query and passing it to the getlist() method. SOAP-XML query starts after "string =>" in the argument list of getlist() method

    $result = SOAP::Lite
            -> uri("http://score.itsc.uah.edu/SCOOPCatalogServices")
            -> proxy("http://score.itsc.uah.edu/Catalog/SCOOPCatalogServices.cgi")
            -> getlist(SOAP::Data->type(string => '<?xml version="1.0" encoding="UTF-8"?>
                      <SCOOPCatalogListRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                      xsi:noNamespaceSchemaLocation="http://score.itsc.uah.edu/services/catalog/SCOOPCatalogListRe quest.xsd"
                      item="' . $thing . '"/>'))
            -> result;

Print the results

    print $result;
    exit 0;



Story

Quick Links

Personal tools