Lab 4: Compositing Web Services

Goals:

  • Giving an insight into advanced techniques for compositing web services

Presenter Notes

Schedule of This lab

2:10 — 2:40
Part I: Asynchrony
2:50 — 4:30
Part II: A SOAP Router
4:00 —
Part III: Using BEPL

Presenter Notes

Part I: Asynchrony

Key feature for application performance

assets/timeline.png

Presenter Notes

Running the Service

  • include Apache CXF in you project
  • run deepthought.soap.server.ServiceServer for SOAP services
  • run deepthought.jms.server.JMSServiceServer for the JMS service

Presenter Notes

Running Wireshark to Catch Messages

assets/capture.png

Presenter Notes

Running Wireshark to Catch Messages

assets/capture2.png

Presenter Notes

Reading the Conversation

Running deepthought.soap.client.SyncServiceClient

assets/conversation.png

Presenter Notes

Matching the code (Consumer)

public static void main(String args[])

  DeepThought d = getService();

  //The service call and response handling
  // are done by the following line
  String response = d.computeAnswer();

  System.out.println("The answer is: " + response);
  System.out.println("Shutting down...");

Presenter Notes

Matching the code (Service)

@WebService
public class DeepThoughtImpl implements DeepThought {
    @Override
    public String computeAnswer() { //Handle the query
        try {
            Thread.sleep(10000); //Wait for 10 seconds
        }
        catch (InterruptedException e) { }

        return "42"; //Return the result
    }

Presenter Notes

Exercises

Do the same analysis for the other clients.

Compare what the benefits/inconvenients of each approaches are.

Presenter Notes

Part II: Service Routing

Implement a service router capable of redirecting a message to different versions of a service by inspecting a SOAP message header.

Presenter Notes

CXF Interceptors

In the Apache CXF Framework, each message is handled by an interceptor chain before it is delivered to a service.

Each interceptor in the chain can do whatever it wants with the message. This includes parsing the message, logging it, validating WS-Security headers, etc.

Interceptors are divided up into phases.

Presenter Notes

CXF Incoming Phases

RECEIVE
Transport level processing
*_STREAM
Stream level processing/transformations
READ
This is where header reading typically occurs.

Refer to the documentation for more details.

Presenter Notes

Exercises

A partial Interceptor that routes messages is provided.

You need to register it, and to complete its implementation.

See the assignment for details.

Presenter Notes

Part III: BEPL

WS-BEPL is language for specifying executable web-services-based workflows.

Presenter Notes

BEPL Setup

Apache ODE can execute WS-BPEL processes.

It can be installed as a war file on top of Apache Tomcat.

The assignment contains instructions on how to setup these tools.

Note that the BPEL designer of Eclipse is already installed.

Presenter Notes