Migrating Java WS Core from GT4.0

Java WS Core Framework has been updated to use the final version of the WSRF/WSN and WS Addressing specifications. This document provides an overview of the changes and provides a link to the specifications.

[Note]Note

Features that are new in the final specification have not been implemented, only the features from the previous specification have been ported.

1. Updating higher level services

The following is a suggested approach to updating the higher level services:

1.1. WSDL changes

The specification WSDL names and namespace have changed. The section WSDL Files and Namespace Changes provides a mapping from old WSDL file names and namespaces to the new equivalent. All operations in the old specification are in the new specification, so no other WSDL change should be needed.

If your service uses compact and schema directories, ensure that the new WSDLs are correctly written and deployed in schema.

1.2. Stub generation

The old targets for stub generation can be used as is. Ensure that modified WSDLs have been deployed to GLOBUS_LOCATION before you run the targets.

1.3. Service, client and test code changes

Some class and package names have changed. There is minimal change in the core infrastructure API, but the addressing package has been moved from org.apache to org.globus.

The section Package and class name changes provides a table with some mappings from old to new class names. Note this does not cover all cases, but the most commonly used code.

For changes to features and sample code, refer to the section on Code change details. The section discusses changes per feature and should provide details on how to edit your code.

Also, Constant changes provides information on some constants that have changed.

You should not have to change anything in your Ant build files or deployment infrastructure.

For samples, you can look at counter service.

2. Code change details

2.1. WS Addressing

The Apache WS Addressing project is being archived. So the code base has been moved to the Globus repository and has been checked into wsrf/java/lib-src/ws-addressing. The library now has org.globus package names and guarantees support only for the final version of the WS Addressing specification.

One of the key changes in the specification is that Reference Parameters are used now rather than Reference Properties. Java WS Core adds and expects EPR key information in Reference Parameters element now.

2.2. Faults

Unlike the old specification, fault cause consists of a single BaseFaultType, rather than an array of BaseFaultType. The FaultHelper utility has been modified to handle this. Now when a fault cause is added, the helper class walks through the chain of fault causes to find one without a fault cause set and then sets the new cause. Higher level services can continue to use the same API as before and faults should get serialized and deserialized correctly.

If in your testing, you look for a specific error code in a Fault Cause, it is not an array anymore. You will need to walk though the chain of fault causes. An example of such a test is testTargetedXPathQueryInvalidRP() in org.globus.wsrf.impl.properties.QueryResourcePropertiesTests.java.

2.3. Lifetime

The new specification allows SetTerminationTime to have either an xsd:dateTime or xsd:duration. Java WS Core currently does not support duration and only uses the xsd:dateTime value set in the request. A bug in Axis ends up with SetTerminationTime data binding having a contructor that takes two parameters.

2.4. Properties

None of the new methods in the final specification have been implemented; only a minor change in schema, which is taken care of in the providers and Simple* implementations.

2.5. Subscribing to notifications

  • A new data type Filter has been defined, which is used to provide subscription information, including the Topics to subscribe to.

  • Currently we only support TopicExpressionType and hence FilterType is expected to have just one element.

  • SubscribeSubscriptionPolicy: the only piece we used before was useNotify. As per latest specification, that is default. If useRaw is set in subscription policy a UnsupportedPolicy fault will be thrown, any other policy set will cause a UnrecogonizedPolocy fault.

  • Example subscription request:

         Subscribe request = new Subscribe();
         request.setConsumerReference(consumerEPR);
         TopicExpressionType topicExpression = new TopicExpressionType();
         topicExpression.setDialect(WSNConstants.SIMPLE_TOPIC_DIALECT);
         topicExpression.setValue(Counter.VALUE);
         MessageElement element = 
                (MessageElement)ObjectSerializer
                .toSOAPElement(topicExpression, WSNConstants.TOPIC_EXPRESSION);
         FilterType filter = new FilterType();
         filter.set_any(new MessageElement[] { element });
         request.setFilter(filter);

2.6. Unsubscribing notifications

Destroy was used in the old code to remove notification subscription, Unsubscribe should be used now.

 SubscriptionManager subscriptionPort =
                subscriptionManagerLocator.getSubscriptionManagerPort(
                    subscriptionEPR);

...

subscriptionPort.unsubscribe(new Unsubscribe());

2.7. Consuming notifications

  • Notify message has changed and a new utility has been added to take care of deserialization of the message:

    import org.globus.wsrf.encoding.DeserializationException;
    import org.globus.wsrf.utils.NotificationUtil;
    import org.oasis.wsrf.properties.ResourcePropertyValueChangeNotificationType;
    
    // Notification callback
    public void deliver(List topicPath, EndpointReferenceType producer,
                        Object message) {
    
        
        ResourcePropertyValueChangeNotificationType changeMessage
                            = null;
        try {
             changeMessage = NotificationUtil.getRPValueChangeNotification(message);
       } catch (DeserializationException e) {
            // handle exception
       }

  • ResourcePropertyValueChangeNotificationType API has getNewValues() and getOldValues() instead of getNewValue() and getOldValue().

2.8. Subscription Manager Service

This is not relevant, unless you want to write a new subcription manager and not use the one in Core.

The recent specification defines two port types for subscription manager: one with pause/resume and another without. To maintain previous functionality, the default subscription manager service provided in Core uses the pause-able subscription manager port type.

  • GetRP - Required

  • Destroy - Required

  • SetTerminationTime - Not required

  • Required resource properties:

    • consumer reference

    • filter type

    • subscription policy

    • creation time

The BaseSubscriptionProvider and PausableSubscriptionProvider cover all the required functionality.

(Refer to Subscribing to Notification section above for more details on what is supported)

2.9. Resources that support Subscription

The interface org.globus.wsrf.Subscription has been split into two. A new interface, PausableSubcription has been introduced in the same package and contains the method for pause/resume functionality. By default, subscription support in Core uses the PausableSubcription interface only.

If pause/renew capability is required, resources need to implement PausableSubscription instead of Subscription. If you are looking to maintain old functionality, change to PausableSubscription.

3. WSDL files and namespace changes

3.1. WSDL files and namespace changes

All WSRF/WSN and WSA namespaces have changed. The file names have also changed, but they have been updated in the same directory. This table shows the mapping from old filenames and namespaces to the new ones.

Table 1. Mappings for existing WSDL files and namespaces

Old WSDL files and namespacesNew WSDL files and namespaces

3.2. New additional schema and WSDLs

A WS Resource specification had been added. ResourceUnknown and ResourceUnAvailableFaultType are defined in this namespace, instead of multiple definitions in lifetime and resource in the old specification.

Table 2. New WSDL files and namespaces

FilenameNamespace
wsrf/compact/wsrf/resource/r-2.xsdhttp://docs.oasis-open.org/wsrf/r-2
wsrf/compact/wsrf/resource/rw-2.wsdlhttp://docs.oasis-open.org/wsrf/rw-2

4. Package names and class name changes

This section describes package name changes and equivalent classes.

Table 3. Package names and class name mappings

No.Old nameNew Name
1

org.oasis.wsrf.lifetime.ResourceUnknownFaultType
org.oasis.wsn.ResourceUnknownFaultType
org.oasis.wsrf.properties.ResourceUnknownFaultType

org.oasis.wsrf.resource.ResourceUnknownFaultType

All these faults have been moved to a single common namespace and hence one package.
2

org.oasis.wsn.TopicPathDialectUnknownFaultType

org.oasis.wsn.TopicExpressionDialectUnknownFaultType

Equivalent as per new specification.
3

org.apache.axis.message.addressing.Address

org.globus.axis.message.addressing.Address

Moved over Apache addressing code to Globus repository and namespace.
4

org.apache.axis.message.addressing.EndpointReference

org.globus.axis.message.addressing.EndpointReference

Moved over Apache addressing code to Globus repository and namespace.
5

org.apache.axis.message.addressing.EndpointReferenceType

org.globus.axis.message.addressing.EndpointReferenceType

Moved over Apache addressing code to Globus repository and namespace.
6

org.apache.axis.message.addressing.ReferencePropertiesType

org.globus.axis.message.addressing.ReferenceParametersType

Moved over Apache addressing code to Globus repository and namespace. Reference parameters are now used to store resource key information.
7

org.globus.axis.message.addressing.AttributedURI

org.globus.axis.message.addressing.AttributedURIType

API has changed here. There is no direct to set port, schema, etc. Use getValue() and change the URI that is returned.
8

org.globus.wsrf.impl.notification.PauseSubscriptionProvider

org.globus.wsrf.impl.notification.PausableSubscriptionProvider

Refer to notes on Subscription Manager [link me].

5. Constant changes

Table 4. New WSDL files and namespaces

Old constantNew constant
WSNConstants.TOPICWSNConstants.TOPIC_SET
WSNConstants.TOPIC_EXPRESSION_DIALECTSWSNConstants.TOPIC_EXPRESSION_DIALECT