ECE355 Web Services Samples

For Java Web Services Developer's Pack, v1.6

  1. Samples Overview
  2. Required Software
  3. Service Registry
  4. What is included?
  5. Running  sample programs in eclipse
  6. References

 

  1. Samples Overview

The sample java classes provided here allow you to publish web services to a registry, query this registry for web services, and delete an object from the registry.

They are based on the sample java applications included in the WSDP 1.6 bundle, and documented  in The Java Web Services Developer Pack 1.6 Tutorial, specifically Chapter 8, section "About the examples".

One of the project requirements is than, when a soft phone call is placed, a web service will be invoked if there is a web service associated with the callee in the registry. These samples are provided to allow you to publish  the web services for a user(callee) , and to illustrate the code needed to query for existing web services for a callee, from the sip proxy, when a request to start a soft phone call is received.

The RegistrySample.jar file contains an eclipse project that you will  import into the eclipse workspace. You can then execute each sample application from within eclipse.

 

  1. Required Software

Java WSDP 1.6 Bundle

Application Server

http://java.sun.com/j2ee/1.4/download.html#sdk  

Tomcat for WSDP (needed if you are running  the Service Registry locally)

See The Java Web Services Developer Pack 1.6 Tutorial, section "Required Software", in Chapter "About this Tutorial" , for more  information on Required Software.

These samples access the web registry implementation that is included in the WSDP 1.6 bundle - The Service Registry.  You can connect to the Service Registry running in the UNIX system in campus, or to a Service Registry running in your own machine. If you are running the Service Registry in your own machine you will also need to install a special version of Tomcat for WSDP.

The  examples in the Java WSDP are distributed with a build file for Ant, a portable build tool contained in the Java WSDP. We have instead setup a project in eclipse to run the samples so you can ignore the references to Ant and Ant build files that you will find in the documentation.

 

  1. Service Registry

The sample programs connect to the Service Registry to publish or access web services.

The section "Setting Up a JAXR Client", in Chapter 8 of The Java Web Services Developer Pack 1.6 Tutorial describes the steps to start the registry and get access to  the registry.

You will need to create a user in the Service Registry, with  the User Registration Wizard of the Web Console that is part of the Registry software. For this project we will not be using  security certificates so you can ignore all references to security certificates when you are creating a user thru the Web Console.

You will specify your user name and password for some of the JAXR client example programs, along with information about the location of your certificate.

Web Console

To start the Web Console, type the following URL into a web browser:

http://hostname:port/soar/registry/thin/browser.jsp
 

The default value for the port during the Service Registry installation is 8080.

hostname can be localhost if you are connecting to the Service Registry locally in your machine,

or www.ece.uwaterloo.ca if you are connecting to the Service Registry installed on campus.

 

JAXRExamples.properties

You will need to edit the file JAXRExamples.properties  included in RegistrySample.jar to specify the URL of the registry, the user id and password to access the registry, and the data for your organization (for the ECE355 project your organization is the same as your teamid), and services provided by the organization.

Parameters query.url and publish.url

If you are connecting to the Service Registry in campus use:

query.url=http://www.ece.uwaterloo.ca:8080/soar/registry/soap
publish.url=http://www.ece.uwaterloo.ca:8080/soar/registry/soap

If you are connecting to the Service Registry in your own machine use:

query.url=http://localhost:8080/soar/registry/soap
publish.url=http://localhost:8080/soar/registry/soap

Refer to The Java Web Services Developer Pack 1.6 Tutorial, chapter 8, section "About the examples" for more info on the JAXRExamples.properties file.

 

  1. What is included?

    4.1 Java classes

The table below summarizes the java classes included in the samples.

File name  Description
JAXRPublishOrg.java  Publish an organization.

Adds an organization to the registry. Data about the organization is specified in JAXRExamples.properties.

JAXRDelete.java Deletes an object from the registry.

The urn (service registry object id)  of the object  is specified as a parameter to this java application.

 

JAXRPublishService.java Publish a service for a given organization.

Adds a service to the registry. The urn (service registry object id)  of the organization that provides the service is specified as a parameter to this java application.

Data about the service is specified in JAXRExamples.properties.

WebServicesQuery.java Helper class to query services for a given organization.


Finds services offered by an organization.

Method executeQuery takes as a parameter a name pattern, and finds the services offered by organizations that match this name pattern.
The information on the services found is returned as a collection of
ServiceInfo objects. Only services with wsdl info are included in the results.
 

WSQueryClient.java Sample client to WebServicesQuery.java.
ServiceInfo.java Class representing the service information obtained from a query

        4.2 Other files

 JAXRExamples.properties

This files contains property values neeeded to access the Service Registry, and data used by the sample programs.

You will need to edit the file JAXRExamples.properties  included in RegistrySample.jar to specify the URL of the registry, the user id and password to access the registry, and the data for your organization (for the ECE355 project your organization is the same as your teamid), and services provided by the organization.

Refer to The Java Web Services Developer Pack 1.6 Tutorial, chapter 8, section "About the examples" for more info on the JAXRExamples.properties file.

 MyHelloService.wsdl

JAXRPublishService.java  adds this sample wsdl file to the Service Registry as a new object when adding a new service for an organization.

  1. Running  sample programs in eclipse

The  examples in the Java WSDP are distributed with a build file for Ant, a portable build tool contained in the Java WSDP. We have instead setup a project in eclipse to run the samples therefore  you can ignore the references to Ant and Ant build files that you will find in the documentation.

The RegistrySample.jar file contains an eclipse project that you will  import into the eclipse workspace. You will also need to add libraries (.jar)  to the project and setup some parameters for the run configurations before you can run the java applications.

Here are the steps to follow:

  1. Create a new java project in eclipse, ie. ece355-registry-samples.
  2. Import into this project all files in RegistrySample.jar
  3. Edit the project properties and add to the classpath the all .jar files in wsdp-home\registry\lib and app-server-home\lib .

wsdp-home is the directory where you installed wsdp , ie.C:\Sun\jwsdp-1.6

app-server-home\lib is the directory where you installed wsdp , E:\Sun\AppServer

  1. Setup run configuration parameters for each java application.
  1.  You need to enter the following in the VM arguments for each run configuration:

          -Dorg.apache.commons.logging.Log="org.apache.commons.logging.impl.SimpleLog"

-Dorg.apache.commons.logging.simplelog.log.org.freebxml.omar="warn"

 

  1. Some java applications require Program arguments when the application is run. You will need to specify these parameters in the run configuration.

The table below shows the sample applications and the program arguments required.

Application name Program argument
JAXRPublishService.java The service registry object id (urn) of the organization providing the service.

For example,  urn:uuid:b13926da-f3f7-4cf1-946d-e86572080681

JAXRDelete.java The service registry object id (urn) of the object to be  deleted.
WSQueryClient.java Organization full name or name pattern.

If you specify "ECE355" - it will query for all services where the name includes the string  "ECE355".

 

  1. References

The Java Web Services Developer Pack 1.6 Tutorial,  http://java.sun.com/webservices/docs/1.6/tutorial/doc/index.html.