ICT336 title
Murdoch University logo

Laboratory Week 11 - SOAP Service


Learning Objectives:

  1. Learn to implement and use a simple SOAP service.

Required Reading:

Lectures: Week 10 lectures.

Access to Software:

All required software is available on gryphon.murdoch.edu.au. External students may download the required Perl module SOAP::Lite and install it on your own machine.

Instructions:

In the following exercises, replace all occurences of "15678" with the port number you have been assigned in week 2's lab.

  1. The following instructions make use of files and scripts available in the unit coordinator's directory (~hiew/examples/soap/) on gryphon. Use the command "cp" to copy the file over to your work directory on gryphon. Eg.

    gryphon:~> mkdir ~/labwk11
    gryphon:~> cp ~hiew/examples/soap/* ~/labwk11

  2. Start the Echo.pl server using the port number your are assigned:

    gryphon:~/labwk11> perl Echo.pl 15678
    Starting SOAP server on URL: http://gryphon:15678/

  3. Start another ssh session to gryphon. Run the echoString.pl client to

    gryphon:~/labwk11> perl echoString.pl http://gryphon.murdoch.edu.au:15678
    Sent 'Hello', received 'Hello'

  4. View the SOAP request and response messages. To do so, copy echoString.pl to a new file echoStringTrace.pl. Edit the code for echoStringTrace.pl and change the line

    use SOAP::Lite ;

    to

    use SOAP::Lite +trace;

    Use echoStringTrace.pl to do step (3). You will see a trace of all SOAP::Lite methods invoked by the client. In the data for the method "SOAP::Transport::HTTP::Client::send_receive" are the HTTP messages sent and received by the client, that contains the SOAP messages in XML.

    To ease your viewing the SOAP messages, there is a script filterTrace.pl that extracts the relevant lines in the trace and formats the output for printing. You can use the filter script by piping the standard error from (3) to the script, as follows:

    gryphon:~/labwk11> perl echoStringTrace.pl http://gryphon.murdoch.edu.au:15678 |& perl filterTrace.pl | more

    The redirection symbol |& (vertical bar followed by AND) means pipe standard error in the C-Shell you are using on gryphon.

Exercises:

  1. Change Echo.pl service above so that it echoes the uppercase of all strings it receives. Use echoString.pl to test the results.

  2. Add a new operation to the Echo service, so that there are two distinct operations, one that echoes strings in uppercase, and another that echoes strings in lowercase. Change your client to test each operation.

  3. (Fault detection; the importance of the namespace)

    What is the namespace for this service?

    Change the namespace used by the client to "http://soapinterop.org/version2/". What fault does the service respond with? Is this a reasonable for the service to respond with a change like this for the client? Using echoStringTrace.pl, identify the parts of the SOAP response that the fault information is contained in.

  4. (Service Description and Discovery)

    If you were developing a service like Echo.pl, and you made the changes in exercises 1-3 above, how so you notify all clients using your service that the service have changed, and what those changes are? Is it possible?

    [Keep this question in mind. We will return to this question in exercise 3 in week 12's lab.]

  5. (Exporting existing services through SOAP)

    Make the functionality available in get_url.pl from week 4's lab so it is available as a SOAP service. What this means is that any program on the Internet can invoke what get_url.pl can do by sending the URL a SOAP request. Currently get_url.pl can only be used by a person sitting in front of a command line typing in commands and parameters. Create a SOAP service so that programs anywhere on the Internet can use it as well.

  6. (Exporting existing services through SOAP)

    Make the functionalities available your webclient.pl from assignment 1 so that they available as SOAP services. What this means is that any program on the Internet can invoke what you have implemented in your webclient.pl by sending the parameters through a SOAP request. Currently your webclient.pl can only be used by a person sitting in front of a command line typing in commands and parameters. Create a SOAP service so that programs anywhere on the Internet can use it as well.

    For example, allow a SOAP client to send you a URL and strings to be filtered. Your service should return the result subject to the filter rules as required in assignment 1.

    Think about the simplest way you can complete this, with as little changes to your webclient.pl as possible.

Assessable Tasks:

Exercises 1-4.

Internal students should demonstrate to your tutor by executing your scripts with your tutor present. This can be done in weeks 11, 12 or 13.

External students should submit the scripts and sample runs during the deadline as indicated in the Study Schedule.

H.L. Hiew
Unit Coordinator


Document author: H.L. Hiew, Unit Coordinator
Last Modified: Thursday, 13-May-2004 01:52:10 MST
Disclaimer & Copyright Notice © 2004 Murdoch University
This document is relevant for semester 1, 2004 only