< Previous | Next >

Create the StockQuoteService interface

Create the StockQuoteService interface. This is the interface that you can use to connect your web client to the mediation module.

The StockQuoteService interface will have a getQuote operation. The data that is sent and received by the getQuote operation will be contained in business objects. We will create the interface and business objects in the resources library, so that they can be used by other modules in the future.

The getQuote operation will be used to send the request for a stock quote. The operation will send the request data as a business object named StockQuoteRequest that contains the fields symbol and customerID. The operation will receive the response data as business object named StockQuoteResponse that contains the fields value and qualityOfService.

Follow these instructions to first create the business objects, and then the service interface:

  1. In the Business Integration view, select Resources, right-click and choose New > Business Object.
  2. In the New Business Object wizard, type StockQuoteRequest in the Name field. Click Finish.
  3. In the Business Object Editor that is now opened, click the Add a field to a business object button Add attribute button. A field named field1 is created.
  4. Rename field1 to symbol by clicking on the name to enter input mode.
  5. Click the Add a field to a business object button Add field button to add another field. Rename the field to customerID. Save the new business object.
    StockQuoteRequest business object
  6. Right-click Data, and choose New > Business Object to create another business object.
  7. In the New Business Object Wizard, type StockQuoteResponse. Click Finish.
  8. In the Business Object Editor, click the Add a field to a business object buttonAdd attribute button. An attribute named field1 is created. Rename field1 to value. Click string and select float from the data type list.
  9. Add another field. Rename the field to qualityOfService. Save the new business object.
    StockQuoteResponse business object
  10. In the Business Integration view, select Resources, right-click and choose New > Interface.
  11. In the New Interface wizard, type StockQuoteService in the Name field. Click Finish.
  12. In the Interface Editor that is now opened, click the Add Request Response Operation icon.. An operation named operation1 is created, with an input and an output. Rename operation1 to getQuote.
  13. Rename input1 to request. Click input1, select it, and type request.
  14. Click on the request input's type ("string") and in the resulting Data Type selection dialog, select Browse. Select StockQuoteRequest as the type and click OK.
  15. Rename output1 to response. Click output1, select it, and type response.
  16. Change the output's type to StockQuoteResponse . Save the interface.
This is what the interface that you created should look like in the interface editor.
StockQuote Sample: Create an Interface
< Previous | Next >