Working with a Single EJB Object Instance
To obtain an EJB object, use a CreateEJB 2.1 or FetchEJB 3.0 adapter service. Then in a flow service in Designer you use the pipeline to pass the EJB obtained by a CreateEJB 2.1 or FetchEJB 3.0 execution to a subsequent InvokeEJB 2.1 or InvokeEJB 3.0 instance. By editing the inbound pipeline of the corresponding InvokeEJB 2.1 or InvokeEJB 3.0 service, you can map the Results array of the CreateEJB 2.1 or FetchEJB 3.0 instance to the EJB parameter of the corresponding InvokeEJB 2.1 or InvokeEJB 3.0 instance.
For example, a CreateEJB 2.1 or FetchEJB 3.0 adapter service, services.fetch.GetComplexTraderEJB, creates a single EJB instance and returns it as the first element of the Results array, which Designer places in the pipeline.
To then pass this value to the corresponding InvokeEJB 2.1 or InvokeEJB 3.0 adapter service, services.invoke.InvokeComplexBuy, insert a link from the Results array in the pipeline to the EJB parameter in the corresponding InvokeEJB 2.1's or InvokeEJB 3.0's input signature as shown in the figure below.
To insert the link, click
![](../ejb-webhelp/images/map_connect.gif)
on the input side of the Pipeline view. At run time, the link tells
Integration Server to assign the values in
Results to
EJB.
However, because the input is an array and the target destination parameter is a scalar, you need to indicate which array value to assign. To do this, open the Link Indices dialog box by selecting the link between the variables and clicking
![](../ejb-webhelp/images/indices_enabled.png)
on the Pipeline view toolbar.
The Link Indices dialog box appears indicating all the parameters at each end of the selected link. Use the Results parameter to specify which element of Results to assign. Note that the services.fetch.GetComplexTraderEJB service will always return exactly one EJB instance, placing the EJB instance in the very first element of the Results array. Therefore in this example, you would enter the value of “0” into the Results parameter.
For more information about mapping data in flow services, see the webMethods Service Development Help for your release.