Web Services

You can access Web services in your WaveMaker Studio application by importing the service into the application and then creating Service Variables. REST, SOAP and RSS Web services are supported. This section contains the following topics:

About Web Service Types

You can import the following types of Web services in your WaveMaker Studio application:

  • SOAP services. SOAP (Simple Object Access Protocol) is a standard XML protocol for exposing and calling Web services. A SOAP service is described by a Web Services Definition Language (WSDL) document, often available through a URL from the service itself.
  • REST Services. A REST (Representational State Transfer) Web Service is comprised of resources accessed through unique URLs (requests) and returned as XML responses. An XML Schema typically defines the structure of those XML responses. In order to add a REST service to a WaveMaker Studio application, you need a WSDL document describing the service.
  • RSS Feeds. RSS (Really Simple Syndication) defines services that provide periodically-updated lists of items. Many Web sites now provide a syndication feed that news readers and blog summaries can subscribe to.

Importing and Calling a SOAP Service

In order to import a SOAP service into your WaveMaker Studio application, you need the WSDL (.wsdl) file that describes the service. For SOAP services, WSDL files are provided by the service creator.

Once you have located the WSDL file follow these steps to import the SOAP service, by following these steps:

  1. Choose the Web Service Import option in the Create menu in the Main Menu bar.
    webServicesCreate.png
  2. The Import Web Services dialog appears.
  3. From the Service Type drop-down menu, select SOAP.
  4. For the WSDL Path field, click the Browse button and browse to the location of the .wsdl file (you need a copy of the .wsdl file on the local machine).
  5. Click the Import button. WaveMaker Studio imports the .wsdl file.
The new service is displayed in the Web Service editor. In this editor, available Web services are listed along the left side of the editor. The selected service is displayed on the right side of the editor.

In the list of Web Services on the left side of the Web Service Editor, click to expand the service. This shows all the service operations along with their inputs and outputs. You can bind these inputs and output to components in the Page Designer.

The Web Service Editor also displays the .wsdl file for the service. You cannot edit the .wsdl file here and we recommend that you do not edit it at all. If you do need to edit the .wsdl file (to change the service URL for example) find it in the service sub-directory under the directory for your project and edit it there. Delete the service from your application and re-import it using the same service name.

Importing and Calling a REST Service

These instructions tell you how to import a REST service for which you have a WSDL or WADL file. If you don't have a WSDL or WADL file that defines the service, you can generate one using the REST (Build-A-Service) option. See REST Build-A-Service) for instructions.

To import a REST service for which you have a WSDL or WADL file, follow these steps:

  1. Choose the Web Service Import option in the Create menu in the Main Menu bar.
    webServicesCreate.png
  2. The "Import Web Services" dialog appears.
  3. From the Service Type drop-down menu, select REST.
  4. For the WSDL/WADL Path field, click the Browse button and browse to the location where you saved that file.
  5. Click the Import button. WaveMaker Studio imports the service.
The new service is displayed in the Web Service editor. In this editor, available Web services are listed along the left side of the editor. The selected service is displayed on the right side of the editor.

In the list of Web Services on the left side of the Web Service Editor, click to expand the service. This shows all the service operations along with their inputs and outputs. You can bind these inputs and output to components in the Page Designer.

The Web Service Editor also displays the WSDL/WADL file for the service. You cannot edit the WSDL/WADL file here and we recommend that you do not edit it at all. If you do need to edit the WSDL/WADL file (to change the service URL for example) find it in the service sub-directory under the directory for your project and edit it there. Delete the service from your application and re-import it using the same service name.

REST Build-A-Service

You use Build-A-Service when you are importing a REST service for which you do not already have a WSDL or WADL file that defines the service. Build-A-Service builds a REST service definition for you, so that WaveMaker Studio can consume the REST service.

There are two ways you can use Build-A-Service:

  • Usually the publisher of a REST service provides information on the input and output of the REST service. You can use that information to build a REST service definition using Build-A-Service (Build a REST service).
  • Another way to build a REST service definition is to populate the service definition from a Sample Call (Populate from a Service Variable).

Populate from a Service Variable

To build a REST service by populating from a Service Variable, follow these steps:

  1. Choose the Web Service Import option in the Create menu in the Main Menu bar.
    webServicesCreate.png
  2. The "Import Web Services" dialog appears.
  3. From the Service Type drop-down menu, select REST (Build-A-Service) .
  4. Click on the Populate From Sample Call button.
  5. Type in the URL that you would use to access the REST service. For example:
    http://examplesvc.kapow.net/technoratisearchfirstpageresult.xml?company=ibm
  6. Click on the Test button. If you do not see a response in the "Response" window, check your URL and try again. If you still have a problem, check to make sure the service is currently up.
  7. Click on the Populate button. The Build-A-Service fields in the "Import Web Service" dialog are automatically populated.
  8. Click on the Import button.
The new service is displayed in the Web Service editor. In this editor, available Web services are listed along the left side of the editor. The selected service is displayed on the right side of the editor.

In the list of Web Services on the left side of the Web Service Editor, click to expand the service. This shows all the service operations along with their inputs and outputs. You can bind these inputs and output to components in the Page Designer.

The Web Service Editor also displays the WSDL/WADL file for the service. You cannot edit the WSDL/WADL file here and we recommend that you do not edit it at all. If you do need to edit the WSDL/WADL file (to change the service URL for example) find it in the service sub-directory under the directory for your project and edit it there. Delete the service from your application and re-import it using the same service name.

Build a REST service

Here's an example of how to build a REST service by entering information manually:

  1. Choose the Web Service Import option in the Create menu in the Main Menu bar.
    webServicesCreate.png
  2. The "Import Web Services" dialog appears.
  3. From the Service Type drop-down menu, select REST (Build-A-Service) .
  4. In the Service Name field, enter:
    YahooSearch
  5. In the Operation Name field, enter:
    search
  6. In the Service URL field, enter the URL for the REST service. For example:
    http://search.yahooapis.com/WebSearchService/V1/webSearch
  7. In the same way, add another input with name "query" and type "string"
  8. Back in the "Web Service Properties" area, click on the Add Input Parameter String to URL button.
  9. Click the Refresh button.
The new service is displayed in the Web Service editor. In this editor, available Web services are listed along the left side of the editor. The selected service is displayed on the right side of the editor.

In the list of Web Services on the left side of the Web Service Editor, click to expand the service. This shows all the service operations along with their inputs and outputs. You can bind these inputs and output to components in the Page Designer.

The Web Service Editor also displays the WSDL/WADL file for the service. You cannot edit the WSDL/WADL file here and we recommend that you do not edit it at all. If you do need to edit the WSDL/WADL file (to change the service URL for example) find it in the service sub-directory under the directory for your project and edit it there. Delete the service from your application and re-import it using the same service name.

Importing and Calling RSS Feeds

RSS (Really Simple Syndication) Feeds are services that provide periodically-updated lists of items. Many Web sites now provide a syndication feed that news readers and blog summaries can subscribe to. This section explains both how to create the feed service and how to call it:

Creating the Feed Service

  1. Choose the Web Service Import option in the Create menu in the Main Menu bar.
    webServicesCreate.png
  2. The "Import Web Services" dialog appears.
  3. From the Service Type drop-down menu, select Feed.
  4. Click the Import button.
  5. The new Feed service appears in the Services list on the left side of the Service editor. You specify the Feed URL as an input to a Service Variable so you do not need to define it in advance.
The fact that the feed URL is a service input allows you to bind the URL input to a widget such as a text editor or grid row. This gives you a lot more flexibility than you would have if the URL were a static part of the service configuration.

Calling the Feed and Displaying the Results

Once you create a feed service, you can call it in your application by creating a Service Variable. Use a DataGrid widget to display the results. For example:

  1. First create a new RSS Feed Service, called FeedService. (Creating the Feed Service explains how to create the service.)
  2. In the Component Tree, create a new Service Variable (Creating a Service Variable). Set the Service Variable's properties as follows:
    service
    : FeedService
    operation
    : getFeed
    autoUpdate
    : true (checked)
  3. Optionally, set name and any other properties as you like.
  4. In the Property Tree, under "Properties" select input(getFeedInputs). In the Property Editor the feedURL property appears.
    servicesSetFeedURL.png
  5. Click the circle icon next to the feedURL (data binding) property.
  6. Click the Bind button to complete the configuration.
  7. To display the results of the feed, you can use a DataGrid. In the Page Designer, drag a DataGrid widget from the Palette and drop it on the Page.
  8. In the Property Editor, click the circle icon for the dataSet property. The bind dialog again appears. Under "Bind Sources" expand the Service Variable you created for the Feed and select the entries object.
    feedGridBind.png
  9. Click the Bind button to complete the Service Variable configuration.
View the feed results in the Page Designer with LiveLayout (Live Layout) or by running the project.

      Share/Bookmark
© 2010 WaveMaker Software™ All Rights Reserved.