SyntaxHighlighter

Friday, March 11, 2011

How to register Java RMI services into jUDDI

The UDDI v3 specification speaks about 5 UDDI transport tModels to define the type of protocol a binding of a service is using.

11.3.3 UDDI HTTP Transport
11.3.4 UDDI SMTP Transport
11.3.5 UDDI FTP Transport
11.3.6 UDDI Fax Transport
11.3.7 UDDI Telephone Transport

The jUDDI project is adding out-of-the-box support for RMI. For an application written in Java we think it makes sense to support Java specific transports and starting at with the jUDDI-3.1 release we will support two more Transports: rmi and jndi-rmi, where the jndi-rmi transport is a special version of the rmi transport (We'll come back to that later).

Introduction

In UDDI, tModels are used to establish the existence of a variety of concepts and to point to their technical definitions. Transport tModels are referenced by service bindings to describe the type of transport used to invoke the service, either when other parts of the technical fingerprint (other tModels referenced in the same bindingTemplate) do not specify the transport used by the particular service binding, or when the service provider wants to explicitly call out the transport in the technical fingerprint so as to enable discovery. Transport tModels are frequently coupled with other tModels that describe more completely what the service does. For example, the RMI Transport tModel may be coupled with the SOAP Protocol tModel to indicate that a Web service communicates using SOAP over RMI. The RMI Transport tModel provides a means for designating that services transport messages using the RMI protocol.

Design Goals

The RMI Transport tModel is provided to enable discovery of services that transport messages using the RMI protocol. This tModel can be used alone to provide a technical fingerprint for simple services that are accessed through HTTP when they might otherwise not have a tModel to reference in their bindingTemplates, or it can be used in conjunction with other protocol tModels to indicate the applicable transport when other parts of the technical fingerprint are ambiguous or silent with respect to the transport to use.

UDDI RMI Transport tModel Definition

Name: uddi-org:rmi
Description: A Java service that uses RMI transport
UDDI Key (V3): uddi:uddi.org:transport:rmi
Evolved V1,V2 format key: N/A
Categorization: transport
UDDI RMI Transport

UDDI RMI Transport tModel Structure

<tModel
 tModelKey="uddi:uddi.org:transport:http">
  <name>uddi-org:rmi</name>
  <description>Java RMI based service registered to the Java Registry</description>
  <overviewDoc>
    <overviewURL useType="text">
      http://juddi.apache.org/docs/3.0/userguide/html/chap-root_seed_data.html#sect-rmi
    </overviewURL>
  </overviewDoc>
  <categoryBag>
    <keyedReference keyName="uddi-org:types:transport"
      keyValue="transport"
      tModelKey="uddi:uddi.org:categorization:types"/>
   </categoryBag>
</tModel>


UDDI RMI Transport Example of use
The following is a typical bindingTemplate for a simple service that references the RMI Transport tModel:

<bindingTemplate bindingKey="uddi:...." serviceKey="uddi:....">
  <description xml:lang="en">Buy from Bigfoot Breweries over
    the Web</description>
  <accessPoint useType="endpoint"
    rmi://hostname:1099/shopService
  </accessPoint>
  <tModelInstanceDetails>
    <tModelInstanceInfo
      tModelKey="uddi:uddi.org:transport:rmi />
  </tModelInstanceDetails>
</bindingTemplate>


UDDI JNDI-RMI Transport tModel Definition

Name: uddi-org:jndi-rmi
Description: A Java service that uses JNDI-RMI transport
UDDI Key (V3): uddi:uddi.org:transport:jndi-rmi
Evolved V1,V2 format key: N/A
Categorization: transport
UDDI RMI Transport

UDDI JNDI-RMI Transport tModel Structure

<tModel
tModelKey="uddi:uddi.org:transport:jndi-rmi">
<name>uddi-org:jndi-rmi</name>
<description> A Java RMI based service registered to a JNDI Registry </description>
<overviewDoc>
<overviewURL useType="text">
http://juddi.apache.org/docs/3.0/userguide/html/chap-root_seed_data.html#sect-jndi-rmi
</overviewURL>
</overviewDoc>
<categoryBag>
<keyedReference keyName="uddi-org:types:transport"
keyValue="transport"
tModelKey="uddi:uddi.org:categorization:types"/>
</categoryBag>
</tModel>


UDDI JNDI-RMI Transport Example of use
The following is a typical bindingTemplate for a simple service that references the JNDI-RMI Transport tModel. Optionally an InitialContext can be provided in the instanceParms, which should be used by the client at runtime to lookup the service as registered in that JNDI (somecontext/shopService) in this case:

<bindingTemplate bindingKey="uddi:...." serviceKey="uddi:....">
  <description xml:lang="en">Buy from Bigfoot Breweries over
    the Web</description>
  <accessPoint useType="endpoint"
    jndi-rmi://somecontext/shopService
  </accessPoint>
  <tModelInstanceDetails>
    <tModelInstanceInfo
      tModelKey="uddi:uddi.org:transport:jndi-rmi />
<instanceParms>
        <![CDATA[
        <?xml version="1.0" encoding="utf-8" ?>
        <initialContextInfo>
            <contextProperty name="java.naming.factory.initial"
value="org.jnp.interfaces.NamingContextFactory"/>
  <contextProperty name="java.naming.provider.url"
value="jnp://localhost:1099"/>
<contextProperty name="java.naming.factory.url.pkgs"
value="org.jboss.naming:org.jnp.interfaces"/>
        </initialContextInfo>
        ]]>
  </tModelInstanceDetails>
</bindingTemplate>


Other UDDI registries will also be able to store RMI based services, as long as you add the
'uddi:uddi.org:transport:rmi' and 'uddi:uddi.org:transport:jndi-rmi' tModels.

Cheers,
--Kurt