Komodo User Guide

Web Services

New to Web Services?
Check out the Python Tutorial

Web services are software modules with a programmatic interface exposed over the Internet. Published Web services can be invoked by other applications (even other Web services) that reside anywhere on the Internet.

Komodo's Web services bookmark functionality enables you to keep a library of your favorite Web services, and to easily use them in your Perl, Python or PHP programs. When you add a Web service bookmark, Komodo uses the WSDL protocol to dynamically extract the description of the Web service and update the Web Services Library section of the Komodo Help System.

Web service language support is only available for Perl, Python and PHP in this release of Komodo. To use Web services with Perl and Python, ActivePerl and / or ActivePython must be installed on your system.

Configuring Web Service Support

Web service support is configured through Komodo's Preferences. Use the Web Services preference page to configure service support, default support modules and proxy locations.

Adding Web Service Bookmarks

Web Service Bookmarks are links to your favorite Web services on the Internet. By maintaining a library of bookmarks, it is fast and easy to add a Web service reference to a Perl, Python or PHP program. When you add a Web service bookmark, an entry describing the service will be created in the Web Services Library section of the Komodo Help system.

Web service bookmarks can be added from the Toolbox, the Project Manager pane or the Web Services Bookmark Manager dialog.

  • Drag and Drop: drag and drop a WSDL URL from a browser address bar or editor onto the Toolbox, onto a Project, or onto a folder in the Toolbox or a Project.
  • Toolbox: right-click in the Toolbox pane and select Add New WebService. To add a Web service to an existing folder, right-click the folder, or drag and drop a Web service onto a folder.
  • Project Manager: right-click a project or folder in the Project Manager pane and select Add New WebService.
  • Web Services Bookmark Manager: open the dialog by selecting Tools | Web Services | Manage Bookmarks. Click the Add button to add a new Web service bookmark.

The Add Bookmark dialog is the same regardless of whether it was invoked from the Project Manager, the Toolbox or the Bookmark Manager. It consists of the following components:

  • Url: enter (or copy and paste) the URL of the web service.
  • Suggest: the "Suggest" button will perform a WSDL (Web Service Description Language) query on the Web service in the URL field, and attempt to fill in the Name, Description and Object Name fields.
  • Name: enter the name of the Web service in this field. If you used the Suggest button, this field will be automatically filled in by the name extracted from the WSDL description of the Web service. The value in this field will be displayed in the Name list in the Project Manager and Toolbox, and in the Bookmark Manager
  • Description: for reference, enter a description of the Web service in this field. If you used the Suggest button, this field will be automatically filled in by the description extracted from the WSDL description of the Web service (if the WSDL contains a description).
  • Object Name: the value in this field will be used as the variable name when the Web service is used in a Perl, Python or PHP program. Ensure that the Object Name conforms to the language's variable naming conventions. If you used the Suggest button, the Object Name will become, by default, the same as the Name of the Web service.
Top

Using Web Services

To insert a Web service into the current file that is opened in the editor, invoke it from one of the places where the Web service bookmark is stored:

  • From the Project Manager or the Toolbar: double-click the Web service bookmark to insert it in the current program in the editor pane.
  • From the Web Services Bookmark Manager: select the Web service bookmark from the list and click the Insert button.

When a Web service is inserted into your program, Komodo will automatically alter the program to provide support for the Web service.

Perl and Web Services

When a Web service is inserted into a Perl program, Komodo performs the following actions:

  • "use" statement: the statement "use SOAP::Lite;" or "use WebService;" (depending on the Web Service Preferences setting) is added at the top of the program, beneath any other "use" statements.
  • object creation: the Web service URL will be placed in an object; the Web service's Object Name will be used as the variable name.
  • AutoComplete: a list of methods contained in the web service object will pop up when the object is used in the following format:
    $WebServiceObject->
  • Call Tips: a list of parameters for the Web service methods will pop up when the object is used in the following format:
    $WebServiceObject->method(

Python and Web Services

When a Web service is inserted into a Python program, Komodo performs the following actions:

  • "import" statement: when a Web service in inserted into a Python program, the statement "import webservice" is added at the top of the program, beneath any other "import" statements.
  • object creation: the Web service URL will be placed in an object; the Web service's Object Name will be used as the variable name.
  • AutoComplete: will list the methods for the Web service object.
  • Call Tips: will list parameters for the Web service's methods.

PHP and Web Services

When a Web service is inserted into a PHP program, Komodo performs the following actions:

  • require_once statement: when a Web service in inserted into a PHP program, the statement "require_once("webservice.php")" is added at the top of the program, beneath any other "require_once" statements.
  • object creation: the Web service URL will be placed in an object; the Web service's Object Name will be used as the variable name.
  • AutoComplete: will list the methods for the Web service object.
  • Call Tips: will list parameters for the Web service's methods.
Top

Managing Web Service Bookmarks

Managing within the Project Manager or Toolbox

When Web service bookmarks are assigned to the Project Manager or the Toolbox, you can access common functions by right-clicking the Web service bookmark and selecting the desired function from the context menu.

  • View WSDL: use this option to load the WSDL XML file in the Komodo editor pane.
  • Edit Service: use this option to edit the bookmark. See Adding Web Service Bookmarks for a description of the fields.
  • Generate Proxy: use this option to generate a Perl module from the WSDL. This is only an option when using Web services within Perl programs.
  • Service Help: use this option to display the relevant Web Services Library page in the Komodo User Guide.
  • Remove: select this item to remove the Web service bookmark from the project or the Toolbox. The bookmark will still be available in the Web Services Bookmark Manager dialog (Tools | Web Services | Manage Bookmarks). To permanently delete the bookmark, use the Web Services Bookmark Manager dialog, as described below.

Managing via the Web Services Bookmark Manager Dialog

Use the Web Services Bookmark Manager dialog to perform maintenance tasks on Web service bookmarks, such as adding, editing or deleting bookmarks. To open the Web Services Bookmark Manager dialog, select Tools | Web Services | Manage Bookmarks.

To add a new bookmark: click the Add button. See Adding Web Service Bookmarks for instructions on adding bookmarks. To add a bookmark in a folder, first create the folder by clicking the folder icon, then double-click the folder to open it, then add the bookmark.

To delete a bookmark: select the bookmark from the list, then click the Delete button. Deleting a bookmark from the Web Services Bookmark Manager dialog will also delete the related Web Services Library page in the Komodo User Guide.

Find on Web: ASPN, the ActiveState Programmer Network, maintains a directory of sites that list Web services. Click the Find on Web button to view this page.

To view the properties of a bookmark: select the bookmark in the list. The bookmark properties will be displayed on the right side of the dialog. The following options are available within the bookmark Properties section of the dialog:

  • Edit: click this button to modify the Properties of the Web service bookmark. See Adding Web Service Bookmarks for a description of each field.
  • Help: click this button to display the relevant Web Services Library page in the Komodo User Guide.
  • Refresh WSDL: click this button to

Generate Proxy: use this option to generate a Perl module from the WSDL. This is only an option when using Web services within Perl programs.

Add to Toolbox: click this button to add the Web service bookmark to the Toolbox for quick access.

Insert: click this button to insert this Web service into the current file in the editor. See Using Web Services for a description of this function.

Top