This getting started guide shows how to install Jbi4Ejb and a sample service assembly in ServiceMix. This component has been tested with servicemix-3.1-incubating.
A binding component using Jbi4Ejb exposes on the internal BUS an external service provided by a Stateless Session EJB.
Thus the integration scenario is shown in the following figure:
To work, Jbi4Ejb needs the jdk's tools.jar in the component classpath. You can put this jar file in the <SERVICEMIX_HOME>/lib/optional.
Download Jbi4Ejb and copy it into <SERVICEMIX_HOME>/install.
A service assembly is a deployable item that configures one or more endpoint inside a JBI ESB. We are going set up a configuration that take an EJB service and expose it a SOAP/HTTP Webservice. The configuration is shown in the following figure:
The Jbi4Ejb component is used to create an internal (i.e. visible inside the ESB) endpoint. This internal endpoint is then used to create an external endpoint with the servicemix-http Binding Component. The http component will proxy the incoming externall calls to the internal endpoint exploiting the JBI routing mechanisms.
A Service Assembly (SA) is a zip file containing one or more Service Unit (SU) file, each Service Unit defining one or more endpoint. We need two endpoint so we're going to configure two SUs:
A Jbi4Ejb service unit must have the layout:
+- <SERVICE_WSDL.wsdl> +- META-INF/ +- jbi.xml
where:
The SERVICE_WSDL.wsdl can be generated using the Netbeans plug-in or the command-line tool. This WSDL is extended using the Jbi4Ejb extensions (see the WSDL Extensions guide for the details ) which express:
For example, the WSDL can have this form:
<?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://complex.test14.imolinfo.it" xmlns:tns="http://complex.test14.imolinfo.it" xmlns:imolaejb="uri://schemas.imola.it/jbi/wsdl-extensions/ejb/" (...) <wsdl:types> (...) </wsdl:types> <wsdl:message name="getUserProfileResponse"> (...) </wsdl:message> <wsdl:portType name="<SERVICE_INTERFACE>"> (...) </wsdl:portType> <wsdl:binding name="TestComplexSessionRemoteBinding" type="tns:TestComplexSessionRemote"> <imolaejb:binding> <imolaejb:orb> <imolaejb:property name="org.omg.CORBA.ORBClass" value="com.ibm.CORBA.iiop.ORB"/> </imolaejb:orb> </imolaejb:binding> (...) </wsdl:binding> <wsdl:service name="<SERVICE_NAME>"> <wsdl:port name="<ENDPOINT_NAME>" binding="tns:TestComplexSessionRemoteBinding"> <imolaejb:address name="corbaname:iiop:127.0.0.1:2809/NameServiceServerRoot#ejb/TestComplexSessionBean" localizationType="corbaname"/> </wsdl:port> </wsdl:service> <imolaejb:types> <imolaejb:serialVersionUID className="it.imolinfo.test14.complex.UserProfile" UID="8891581763048162223"/> <imolaejb:serialVersionUID className="it.imolinfo.test14.complex.UserProfileException" UID="-5706164759540452783"/> </imolaejb:types> </wsdl:definitions>
The jbi.xml must have the following content:
<?xml version="1.0" encoding="UTF-8"?><jbi xmlns="http://java.sun.com/xml/ns/jbi" version="1.0"> <services xmlns:Jbi4Ejb-test="<SERVICE_NAMESPACE>" <provides endpoint-name="<ENDPOINT_NAME>" interface-name="ns1:<SERVICE_INTERFACE>" service-name="ns1:<SERVICE_NAME>"/> </services> </jbi>
This configuration specify that the Service Unit is a Binding Component.
Zip all the files in the specified layout and name the archive Jbi4EjbSU.zip.
A http service unit has the following layout:
+- xbean.xml +- META-INF/ +- jbi.xml
where:
the xbean.xml has the following format:
<?xml version="1.0"?> <beans xmlns:http="http://servicemix.apache.org/http/1.0" xmlns:ejb_urn="<SERVICE_NAMESPACE>"> <http:endpoint service="ejb_urn:<SERVICE_NAME>" endpoint="<SERVICE_NAME>JBIPort" role="consumer" locationURI="http://localhost:8192/Service/<SERVICE_NAME>" defaultMep="http://www.w3.org/2004/08/wsdl/in-out" soap="true" /> </beans>
where:
Zip all the files in the specified layout and name the archive HttpSU.zip.
The service assembly is unit of deployable configuration in JBI, in our example it has the following layout:
+- Jbi4EjbSU.zip +- HttpSU.zip +- META-INF/ +- jbi.xml
where:
The jbi.xml has the following format as described in the JBI Specification:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <jbi xmlns="http://java.sun.com/xml/ns/jbi" version="1.0"> <service-assembly> <identification> <name><SA_NAME></name> <description><SA_DESCRIPTION></description> </identification> <service-unit> <identification> <name><SU1_NAME></name> <description><SU1_DESCRIPTION></description> </identification> <target> <artifacts-zip>Jbi4EjbSU.zip</artifacts-zip> <component-name>Jbi4Ejb</component-name> </target> </service-unit> <service-unit> <identification> <name><SU2_NAME></name> <description><SU2_DESCRIPTION></description> </identification> <target> <artifacts-zip>HttpSU.zip</artifacts-zip> <component-name>servicemix-http<</component-name> </target> </service-unit> </service-assembly> </jbi>
where:
Notice that the BC filenames (Jbi4EjbSU.zip and HttpSU.zip) are specified with the respective component (Jbi4Ejb and servicemix-http). Zip all the files in the specified layout and name the archive HttpToEJBSA.zip (the archive name is not important).
Copy the created service assembly in <SERVICEMIX_HOME>/deploy.