Integration developer tasks
Since iPhone applications normally transfer data over cellular networks, message payloads need to be as small as possible. For that reason, XML messages are discouraged and JSON over HTTP is encouraged. Using the new JSON over HTTP binding in WebSphere Integration Developer, exposing such a service is straightforward. In this section, you will modify the provided iPhoneServicesModule to provide a JSON over HTTP binding to the OrganizationInterface.
- Create a new workspace in WebSphere Integration Developer. Import the iPhoneServicesModule project interchange file in iPhoneServicesModule.zip that you downloaded in the Integration developer prerequisites section. Also, when you import in WebSphere Integration Developer, select Other -> Project Interchange. See Figure 1.
- Once imported, open the assembly diagram. The assembly diagram
contains the OrganizationInterfaceImpl Java™ component
that implements the OrganizationInterface (Figure 2). The
Organization Interface contains one method, employeeSearch,
which takes in a SearchCriteriaBO and outputs a PageOfEmployeeBO
containing all employees that match the search criteria. The
actual employee lookup is trivial in this tutorial. The code
simply outputs two records with the employee name set to the
fullName attribute in SearchCriteriaBO. Take some time to
familiarize yourself with the module.
Figure 1. Incomplete iPhoneServicesModule
Figure 2. Incomplete assembly diagram
- Open the assembly diagram.
- Right-click the OrganizationInterfaceImpl Java component and select Generate Export -> HTTP Binding.
- In the dialog that pops up:
- Change the Context path to
- Press the Select button next to the Default data format.
- In the “Data Transformation Configuration” dialog, select the UTF8JsonDataHandler inside the JSON category and click Finish.
- Press the Select button next to the Function selector.
- In the “Function Selector Configuration” dialog, select the HTTP function selector based on URL and HTTP method and click Finish.
- Click OK in the “Configure HTTP Export Service” dialog.
- Change the Context path to
- Click the newly generated export and change the name to
- Save your changes to the assembly diagram (Figure 3).
- You can learn more about the various function selectors in
Prepackaged HTTP function selectors.
Figure 3. Complete Assembly diagram
- Click the OrganizationInterfaceMobile export and take a
moment to look over its properties in the Properties view (Figure
Figure 4. Properties view
In this section, you will make sure that all methods on the service interface transport input and output business objects (BOs) as JSON objects.
- In the Properties view of OrganizationInterfaceMobile, click Advanced configuration.
- You see a method type of GET already defined in the HTTP Method
Settings tab. Remove the GET, and add a POST method instead. Full
JSON objects will be sent as input in the body of the POST,
instead of sending request parameters in a GET method (Figure 5).
Figure 5. HTTP Method settings
- Go to the “Method Bindings” section and click the only method on the interface – employeeSearch.
- Notice that the Native method is set to
/OrganizationInterfaceImplMobile/employeeSearch@GET. Remove that entry.
- Add the entry
- Click the Data Serialization tab and change the Input data format and Output data format to UTF8JsonDataHandler by choosing UTF8JsonHandler inside the JSON category of the “Data Transformation Configuration” dialog. This defines the input and output BO format as JSON. This step is optional since the default data format on the binding is set to UTF8JsonDataHandler.
- Click the HTTP Method Settings tab and remove the GET method type.
- Save your changes to the assembly diagram.
In this section, you will test the OrganizationInterfaceMobile export you created.
- Right-click OrganizationInterfaceMobile in the assembly diagram and select Test component from the menu.
- The employeeSearch operation is selected, and you see the searchCriteriaBO input BO in the “Initial request parameters” section.
- Enter the following values in the searchCriteriaBO, as shown in
Figure 6. The values state that you want to find all employees
named “John Doe”, and that you want the first page of results (for
example, zero indexed). You also do not want more than 10 rows per
page, and the results are sorted in ascending order by division
(for example, division is the only sortable column in this
- order = ASC
- rowsPerPage = 10
- pageIndex = 0
- fullName = John Doe
Figure 6. Test input BO
- Click Invoke in the Events section and click the Continue button - the green circle with the white triangle. This will start up WebSphere Process Server V6.2 at the local host test environment server and execute the employeeSearch service method. Please be patient as this may take some time.
- Notice that the return is a PageOfEmployeeBO containing an array
of two EmployeeBOs (Figure 7).
Figure 7. Test output BO
This section describes the information that an iPhone developer will require to create an Objective-C proxy client to call the employeeSearch service.
- Provide the OrganizationInterface.wsdl file. This file will be
used to create matching operations, as well as input and output
BOs for the client. In this case, a simple image of the interface
is enough (Figure 8).
Figure 8. OrganizationInterface
- Provide details of each BO. In our case, we have three BOs, and images of each will suffice.
- Click the OrganizationInterfaceMobile export in the assembly diagram and go to the Properties view.
- In the Properties view, click the Summary section.
- Provide the table that maps the Method name to the Endpoint
Figure 12. Service Endpoint URLs
- Provide the WebSphere Process Server server address that the
iPhone developer can use to call the service. For instance, the
developer ends up calling:
Your URL may be different if you configured WebSphere Process Server to use a different port.