GT 4.0 Samples for Java WS Core

1. Counter Sample

Using counter-client.

1.

Change to $GLOBUS_LOCATION directory:

 $ cd $GLOBUS_LOCATION
2.

Start the container by running:

 $ bin/globus-start-container -nosec
3.

In another window, run:

 $ bin/counter-client -s http://localhost:8080/wsrf/services/CounterService

As a result you should see something like the following:

 $ bin/counter-client -s http://localhost:8080/wsrf/services/CounterService
   Counter service: http://localhost:8080/wsrf/services/CounterService
   Got notification with value: 3
   Counter has value: 3
   Got notification with value: 13

Please note if secure container is used (started without the -nosec argument) please make sure to pass the correct service url (https protocol, right port number) to counter-client and add the -z argument at the end of the command line. For example:

 $ bin/counter-client -s https://localhost:8443/wsrf/services/CounterService -z none

The -z none option disables client-side authorization. By default the client performs host authorization and if the server is not running with host credentials the client authorization will fail. Also, the server must be properly configured to authorize the client. Please see the security documentation for details.

Using counter-create, counter-add clients.

1.

Change to the $GLOBUS_LOCATION directory:

 $ cd $GLOBUS_LOCATION
2.

Start the container by running:

 $ bin/globus-start-container -nosec
3.

In another window, run:

 $ bin/counter-create -s http://140.221.36.11:8080/wsrf/services/CounterService > epr

If successful, a new counter resource will be created and the endpoint information of that resource will be saved in a file called epr. The epr file can be passed to a number of the basic wsrf-* and wsn-* clients using the -e option.

Please note if the secure container is used (started without the -nosec argument) to make sure to pass the correct service url (https protocol, right port number) to counter-create and add the -z argument to the command line. For example:

 $ bin/counter-create -s https://localhost:8443/wsrf/services/CounterService -z none > epr
4.

In the same window, run (a couple of times):

 $ bin/counter-add -e epr 2

As a result you should see something like the following:

 $ bin/counter-add -e epr 2
   2          
 $ bin/counter-add -e epr 2
   4

Please note that if secure container was used you might need to add the -z argument to the command line. For example:

 $ bin/counter-add -e epr -z none 2

2. Management Sample

The ManagementService sample service allows the users to view and dynamically modify the WSDD properties of a given service. The WSDD information of a given service is exposed as resource properties. In this example, we will be removing the QueryResourceProperties operation provider from the ContainerRegistryService.

Please note that the changes made to the services via the ManagementService are not permanent.

1.

Change to the $GLOBUS_LOCATION directory:

 $ cd $GLOBUS_LOCATION
2.

Start the container by running:

 $ bin/globus-start-container
3.

In another window, run:

 $ bin/wsrf-query -z self -s https://localhost:8443/wsrf/services/ManagementService \
    -k {http://axis.org}ServiceName ContainerRegistryService

As a result you should see something like the following:

<ns1:ServiceWSDD xmlns:ns0="http://xml.apache.org/axis/wsdd/" 
                  xmlns:ns1="http://xml.apache.org/axis/wsdd/">
 <ns1:loadOnStartup>true</ns1:loadOnStartup>
 <ns1:providers>GetRPProvider</ns1:providers>
 <ns1:providers>GetMRPProvider</ns1:providers>
 <ns1:providers>QueryRPProvider</ns1:providers>
 <ns1:handlerClass>org.globus.axis.providers.RPCProvider</ns1:handlerClass>
 <ns1:className>org.globus.registry.RegistryService</ns1:className>
 <ns1:allowedMethodsClass>org.globus.core.registry.RegistryPortType</ns1:allowedMethodsClass>
 <ns1:scope>Application</ns1:scope>
 <ns1:wsdlFile>share/schema/core/registry/registry_service.wsdl</ns1:wsdlFile>
 <ns1:provider>Handler</ns1:provider>
</ns1:ServiceWSDD>

The above command queries the ManagementService and returns the WSDD information of the ContainerRegistryService.

4.

To demonstrate that the ContainerRegistryService supports the QueryResourceProperties operation run the following command:

 $ bin/wsrf-query -z self -s https://localhost:8443/wsrf/services/ContainerRegistryService

As a result you should see something like the following (a list of <ns1:Entry>):

<ns0:RegistryRP xmlns:ns0="http://www.globus.org/namespaces/2004/06/registry">
 <ns1:Entry>
 ...
 </ns1:Entry>
 <ns1:Entry>
 ...
 </ns1:Entry>
</ns1:RegistryRP>

5.

Next, create an in.xml file with the following contents:

<ns1:doc xmlns:ns1="http://xml.apache.org/axis/wsdd/">
 <ns1:providers>GetRPProvider</ns1:providers>
 <ns1:providers>GetMRPProvider</ns1:providers>
</ns1:doc>

Then run the following command:

 $ bin/wsrf-update-property -z self -s https://localhost:8443/wsrf/services/ManagementService \
    -k {http://axis.org}ServiceName ContainerRegistryService in.xml

The above command updates the providers resource property of the ContainerRegistryService resource of ManagementService. That results in the QueryRPProvider provider to be removed from the operation provider list of the ContainerRegistryService.

6.

Now perform the query operation again:

 $ bin/wsrf-query -z self -s https://localhost:8443/wsrf/services/ContainerRegistryService

Since the operation provider for the QueryResourceProperties operation was removed the above command should generate the following error message:

Error: java.lang.Exception: [CORE] Operation 'QueryResourceProperties' defined
in wsdl but it's not implemented in the 'ContainerRegistryService' service.

You can add the QueryResourceProperties operation provider by adding the <ns1:providers>QueryRPProvider</ns1:providers> entry to the in.xml file and running the command in step 5 again.