Register external services on Petals binding components

Binding components can register external services to the JBI environment.

It is possible by deploying a service assembly on the JBI container. A service assembly is a zip archive which contains one or more service units. The structure of the service assembly is, a META-INF directory holding a "jbi.xml" descriptor. This descriptor describes all the service units to be deployed.

Each described service unit has to be placed at the root path of the service assembly archive. Service units must be zip or jar archives. A service unit contains one "*.wsdl" file which is in fact a WSDL file describing the new service to be deployed. It has also a "META-INF" directory holding "jbi.xml" which contains all information concerning the binding component whiwh will hold the new service.


| ''ServiceAssembly.zip''
| | META-INF | ''jbi.xml''
| |
| |''ServiceUnit1.zip'' | META-INF | ''jbi.xml''
| | | ''service1.wsdl''
| |''ServiceUnit2.zip'' | META-INF | ''jbi.xml''
| | | ''service2.wsdl''

To actually deploy a service assembly, you just copy this zip archive into the PETALS autodeploy directory. Then it will be extracted and for every service units mentionned in the service assembly description file, an deployment procedure will take place.

This procedure is:

  • The service unit manager of the binding component declared in the service unit jbi.xml description file is called.
  • This service unit manager will execute its ''init'' and ''start'' operations on the service unit.
  • During the start process, the "jbi.xml" file is read, the service qname, endpoint and interface names are parsed anda new endpoint is then activated according to these values.
  • The wsdl file is then stored, as a dom document in a map making correspondance between endpoints and service description files. When the binding component is asked for the service description of one of its activated endpoint, it transmits the document found in the service unit manager map.
The new service is now operational and working.

Deploy External Services

The way to register an external service with a binding component provided with Petals is always the same.

Registering handlers

Details here

Service Assembly

You need to deploy a new service unit, and in consequence to deploy a service assembly. A service assembly is a zip archive containing one or more service units and a ''META-INF'' directory containing a ''jbi.xml'' description file.

This file specifies all service units to be deployed.

<jbi version="1.0" xmlns='http://java.sun.com/xml/ns/jbi'
        xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
        <service-assembly>
                <identification>
                                <name>serviceAssembly</name>
                                <description>Service Assembly to deploy service unit to my binding component </description>
                </identification>
                <service-unit>
                        <identification>
                                <name>newService</name>
                                <description>Deploy new service</description>
                        </identification>
                        <target>
                                <artifacts-zip>serviceUnit.zip</artifacts-zip>
                                <component-name>MyBindingComponent</component-name>
                        </target>
                </service-unit>
        </service-assembly>
</jbi>

Here you see that the service assembly is named ''serviceAssembly'' and will deploy one service unit named ''serviceUnit''.

Service Unit

This service unit is contained is the zip file ''serviceUnit.zip'' which contains all needed information and file for the binding component to be able to deploy the new service.

Each service unit zip contains:

  • a ''META-INF'' directory holding a ''jbi.xml'' file
  • a ''.wsdl'' file containing the service description
The service unit jbi.xml file looks like this.

<jbi version="1.0" xmlns='http://java.sun.com/xml/ns/jbi'
        xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
        xmlns:petals-extensions='http://petals.objectweb.org/extensions'>
                <services binding-component="yes">
                        <provides interface-name="Foo" service-name="{http://some.name.space.com}FooService" endpoint-name="FooServiceEndpoint" />
                        <petals-extensions:type>external_service</petals-extensions:type>
                </services>
</jbi>

Here the component will find all information it needs to register the new service in the container : the service QName, its interface QName the service endpoint name and its type.

To deploy the service, copy the service assembly in the install directory. Each service unit will be intalled using the binding component service unit manager.

Now that your service is installed, invoking its endpoint will cause the binding component to handle the message. The business logic needed to transfer the call to the external endpoint is at your charge.

Note that requests for service description of an external service will be handled by binding component and the service description message will be sent.

Attached files

A sample service assembly archive , regrouping all information described above is available serviceAssembly.zip