Example: Developing reports from web service data source

This example details how to use web service as a data source to create reports.

Setting up the web service connection

  1. Open an existing catalog.
  2. In the Data tab of the Catalog Browser, select any data source contained in it, click the New Data Source button on the toolbar, then in the New Data source dialog, specify the name of the data source as Medicare Providers, select the Web Service connection type and click OK.
  3. In the Web Service Data Source dialog, check the URI radio button, and then type the URI string: http://www.webservicex.net/medicareSupplier.asmx?WSDL in the text field to get the WSDL file.
  4. Keep default settings for other options in the dialog, and then click OK.

Adding a table to the web service connection

  1. Locate the Tables node in the web service connection, right-click it and select Add Table from the shortcut menu.
  2. In the Add Table dialog, select GetSupplierByZipCode from the Operation Name drop-down list.
  3. In the Input Message column, select zip, then in its value column, click and select <Add Parameter...> from the drop-down list.
  4. In the Create Parameter dialog, input pZipCode as the parameter name in the Name text field.
  5. Select Type-in Parameter from the Value Setting drop-down list.
  6. Set the data type of the parameter value to String from the Value Type drop-down list.
  7. In the Value List box, click to a value line, double-click in it and then type in 85226.
  8. Repeat the above step to add three more values one by one: 80027, 20878, 20874.
  9. In the Options box, enter Type a zip code as the prompting text.
  10. Click OK to return to the Add Table dialog.

  11. Click OK to add the table to the web service connection.

Building a query based on the table

  1. Locate the Queries node in the web service connection, right-click it and select Add Query from the shortcut menu.
  2. Specify the query name as MedicareProvider in the Input Query Name dialog, then click OK.
  3. In the Query Editor window, click Query > Add Table on the menu bar.
  4. In the Add Table dialog, select GetSupplierByZipCodeResponse_SupplierDataLists_SupplierDatas_SupplierData in the Tables box, and click the Add button.
  5. Click Done, the selected table will be displayed in the Query Editor window. Select all the columns in the table by selecting the * checkbox.
  6. Click OK to save the query and leave the window.

Developing a report based on the query

  1. In JReport Designer, click File > New > Page Report on the menu bar.
  2. In the New Page Report dialog, clear the Report Title text box, and select Banded from the layout box, then click OK.
  3. In the Table Wizard, select the query MedicareProvider in the data source Medicare Provider in the Data screen.
  4. In the Display screen, from the Resources box, add the following fields one bye one: SupplierNumber, CompanyName, City and Description.
  5. Click Next to go to the Group screen, add the field Zip as the group by field.
  6. Click Finish to create the report.
  7. Right-click the BandedHeader panel and select Hide from the shortcut menu to hide it from view. Repeat to hide the GroupFooter, BandedPageFooterand BandedFooter panel in the same way.
  8. Click File > Save on the menu bar to save the report as MedicareProviderInfobyZip.cls.
  9. Click the View tab to preview the report. The Enter Parameter Value dialog appears.

  10. Type a zip code or select the one you want from the drop-down list, and then click OK. The report will be displayed according to your selected parameter value. For example, specify the zip code as 20878, then the report will be displayed as follows, showing information for zip code 20878 only: