ECE355 Web Services Samples

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

 

Samples Overview

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

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.

Required Software

Java WSDP 1.6 Bundle

http://java.sun.com/webservices/download/webservicespack.html 

Application Server

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

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

http://java.sun.com/webservices/containers/tomcat_for_JWSDP_1_5.html
 

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

This 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.

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

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.

the query.url property should be set to : http://www.ece.uwaterloo.ca:8080/soar/registry/soap

the publish.url property should be set to : http://www.ece.uwaterloo.ca: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.

Files included in RegistrySample.jar

 

 

 

 JAXRPublishOrg.java

Used to publish an Organization.  The
JAXRPublishService.java

 WSQueryClient.java
ServiceInfo.java
WebServicesQuery.java

 

JAXRDelete.java

JAXRExamples.properties
MyHelloService.wsdl

WSQueryClient.java
ServiceInfo.java
WebServicesQuery.java

File name  Description
JAXRPublishOrg.java  Publish an organization
JAXRPublishService.java Publish a service for a given organization
WebServicesQuery.java Helper class to query services for a given organization
WSQueryClient.java Sample client to WebServicesQuery.java
ServiceInfo.java Class representing the service information obtained from a query

Setting up the samples 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 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