SoaFaqUseExternalServiceUnit

<< CompApp/CASA FAQ

How to use external service unit in a composite application?

Contents



A service assembly can have connections across its boundary to endpoints of external service units within the same JBI run-time. In this example, the CASA editor is used to make a connection to an endpoint of an external service unit of another composite application.

Section 1, Set up

There is a bug in NetBeans 6.1 that causes the drag-n-drop of external service unit described in step 8 to fail. You can either:

  • use step 1 to update NetBeans to the latest trunk build

or

  • skip step 1, and in step 8 use alternative steps described in Section 5 to define the external service unit manually.

1. Install NetBeans 6.1.x update from trunk

The DnD of external SU feature was broken in NB6.1. A fix was checked in into NetBeans trunk in late April, see

You will need to use the NB trunk build to run this example. You can download the latest version from the following link:

NOTE: Please download and install the full NB version, e.g., netbeans-hudson-trunk-nnnn.zip

2. Download the sample test projects.

The enclosed zip file contains test projects used in this example. Please download it and unzip the content to a local directory.

There are four projects included in this example:

  • asyncService --- a BPEL project define an echo service
  • asyncServiceCA --- a composite application project for asyncService
  • asyncClient --- a BPEL project utilizes the echo service
  • asyncClientCA --- a composite application project for asyncClient

3. Start the NetBeans IDE

Starts the NetBeans IDE and load all four projects.


Section 2, Open and deploy the service composite application

4. Open asyncServiceCA project

Open service assembly of asyncServiceCA in CASA. It shows only a BPEL service unit without any connection.

File:AsyncServiceCA.gif The Service Composite Application

5. Start the GlassFish server

Start the GlassFish server from NetBeans services tab or from the command line.

6. Deploy asyncServiceCA project

Deploy the asyncServiceCA project to GlassFish. Open the JBI manager node to see the deployed service assembly (asyncServiceCA) and service unit (asyncServiceCA-asyncService).


File:ServiceSU.gif The Deployed Service Unit


Section 3, Open, edit, and deploy the client composite application

7. Open asyncClientCA project

Open service assembly of asyncClientCA in CASA. It shows a BPEL service unit and a SOAP wsdl port exposing the service.


File:AsyncClientCA.gif The Client Composite Application

8. Drag-n-Drop external service unit

Drag the external service unit (asyncServiceCA-asyncService) from JBI manager and drop it in the external module area of CASA.

NOTE: If you are using NetBeans 6.1, please skip this step and use alternative steps described in Section 5 to define the external service unit manually.


File:DndServiceSU.gif Adding a reference to an external service unit

9. Connect service unit endpoints

Connect the consume endpoint from the bpel service unit to the provide endpoint of the external service unit.


File:ConnectSU.gif Making a connection to an external service unit

10. Deploy asyncClientCA project

Deploy the asyncClientCA project to GlassFish. Open the JBI manager node to see the deployed service assembly (asyncClientCA ) and two service units (asyncClientCA-asyncClient and asyncClientCA-sun-http-binding).


File:DeploySAs.gif Deployed Service Assemblies


We now have two service assemblies deployed, asyncClientCA and asyncSeviceCA. There is a connection across the service assembly boundary from an endpoint of a service unit in asyncClientCA to an ednpoint of another service unit in asyncSeviceCA.


Section 4, Test the client composite application

11. Create a test case

Define a test case in asyncClientCA project using:

  • AsynchronousSampleClient.wsdl from asyncClient Source Packages
  • operationA from AsynchronousClientPortName

and, e.g., the following input.xml as the test message.


File:Testinput.gif Input test message

12. Run the test case

Run the test case and check the test output. It should echo input data as shown in the following output message:


File:Testoutput.gif Output test message



==

How to manually define an external service unit in a composite application?

In cases, when one does not have the access to deployed external service units directly using JBI manager, one can define external service units manually in CASA.

Section 5, manually define an external service unit

5-a. Drag-n-drop the external service unit palette item

Select the external service unit palette item from the CASA palette and drag-n-drop it in the external module area in CASA.


File:Casapalette.gif CASA Editor Palette

5-b. Drag-n-drop the provides endpoint palette item

Select the provides endpoint palette item from the CASA palette and drag-n-drop it in the external service unit defined in the last step.


File:DndExternal.gif Drag-n-drop external SU and endpoint

5-c, Define external endpoint properties

Select the external provides endpoint, so that endpoint properties are shown in the property panel. Most of them are undefined at this point.


File:EndpointProp.gif Edit external endpoint properties

5-d. Find external endpoint property values

The endpoint property values can be found in the jbi.xml of the external service unit. Open the jbi.xml in the service unit jar of the external service assembly to locate required endpoint property values for:

  • endpoint-name
  • interface-name
  • service-name


File:JbixmlSU.gif External SU jbi.xml

5-e. Edit the interface name

Click on the edit button in the Interface Name property and input the values copied from SU jbi.xml.

NOTE: you may need to define a new namespace if it is not already defined.


File:IntefaceName.gif Edit interface name

5-f. Edit the service name

Click on the edit button in the Service Name property and input the values copied from SU jbi.xml.

NOTE: you may need to define a new namespace if it is not already defined.


File:ServiceName.gif Edit service name

5-g. Edit the endpoint name

Click on the Endpoint Name property and input the values copied from SU jbi.xml.

5-h. Connect service unit endpoints

Connect the consume endpoint from the bpel service unit to the provide endpoint of the external service unit.


File:ConnectSU02.gif Making a connection to an external service unit

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo