Part 2: Komodo Editor
In the second part of the tour you will:
Before you can test and run the
Web service, you must make
sure that you have specified the correct Perl package for Web service support. For
this tour, you will use the SOAP::Lite module that is included with the
ActivePerl
distribution.
- Select Edit|Preferences|Web Services.
- From the Perl Web Services Module drop-down list, select
SOAP::Lite. Click OK.
View
Example
Top
Next, create a Perl file that you will use to test the Web service you added in
Part 1.
- Select File|New|New File.
- From the Categories list, select the Common folder.
- From the Templates list, select Perl.
- Click Open. A new file will open in the Editor Pane.
- Select File|Save As, name the file
WS_test.pl save the file in the
same directory as StockQuote_snippet.pl . Leave the file open for
use in the next example.
View
Example
Top
Now that you have created and saved a new file, you are ready to enter some code.
First, you will insert the Web
service code, and then you will add some additional code in order to test the Web
service.
- Position the cursor beneath the
use strict; line of code.
- On the Toolbox tab, right-click the Web service bookmark,
and select Insert Service Call. The WSDL service call will be
inserted in the Editor Pane.
- Move the cursor to the beginning of a new line, enter
print $St ,
and press CTRL+SPACE to invoke Komodo's
word completion
feature. The line will now appear as:
print $StockQuoteService
- Without leaving a space, type
-> after $StockQuoteService .
A pop-up displaying the "getQuote" method will be displayed.
View
Example
- Press the TAB key to invoke Komodo's
AutoComplete
feature. The line will now appear as:
print $StockQuoteService->getQuote
- Without leaving a space, type an opening parenthesis. Komodo will display a
CallTip
indicating that the argument for the "getQuote" method must be entered
as a string and will produce a result in the form of a floating-point number.
View
Example
- Immediately after the opening parenthesis, type "IBM", and
close the parenthesis.
Top
Before you move on to the next part of the tour, which involves creating an user
interface for the stock quote program, you will run the WSDL service call in Komodo
to ensure that it is getting the desired response from the
Web service.
- Click CTRL+F5 (or click the Go button on
the toolbar), and click OK. The response from the Web service
is sent to the Output Pane at the bottom of the Komodo workspace. The number
displayed should be between 50 and 100, which represents the value of a single
IBM share in US dollars.
View
Example
|