Oracle Portal-to-Go Implementation Guide Release 1.0.2.2 A86635-02 |
|
This document provides walkthroughs for implementing Portal-to-Go services. Topics include:
The following walkthroughs provide step-by-step instructions for creating and distributing mobile services with Portal-to-Go. In the walkthroughs, you create services based on the Web Integration adapter and the SQL adapter. At the end of each walkthrough, you test your development using a device emulator.
These walkthroughs familiarize you with the Portal-to-Go tools, including the Web Integration Developer and the Service Designer, and how they enable you to create mobile services.
Before you begin the walkthroughs, make sure that you correctly install and configure the Portal-to-Go server. Also, you must complete the client installation on your development environment.
In this walkthrough, you create a Portal-to-Go Web service. First, you use the Web Integration Developer to map the elements of a sample Web page, quote.yahoo.com, to input and output parameters. You then use the Service Designer to create a Portal-to-Go service that retrieves stock quotes based on the mapping.
For more information on using the Web Integration Developer, see the Portal-to-Go Web Integration Developer User's Guide.
This walkthrough guides you through the following tasks:
Follow these steps to create a Web page mapping, or Web Integration Definition Language (WIDL) file, using the Web Integration Developer.
Open the source page in the Web Integration Developer as follows:
http://quote.yahoo.com
The Web Integration Developer retrieves the page, parses it, and adds it to the Document Browser (in the left frame). For this example, the Document Browser shows the following items:
Next, generate a WIDL file from the source page as follows:
In this Field... | Type... |
---|---|
Interface |
|
Service |
|
The input variables defined in this WIDL service have the same names as those specified in the HTML form. You can edit the input binding to make these names more meaningful as follows:
ReportType
and press Enter.
CoSymbol
and press Enter.
The output defined by this service extracts all elements from the document returned by the Web page. To extract just the stock quotes to pass back to the client application, you can edit the output binding:
CurrentPrice
in the New Variable dialog and click OK. The CurrentPrice
variable now appears in the variable list.
To test the WIDL file in the Web Integration Developer:
Publishing a WIDL interface makes it accessible to Web Integration services that you create in the Service Designer.
You must have administrator authority on the Web Integration Server to perform this procedure. When you publish an interface, the services in that interface are added to those already on the Web Integration Server. If you create a service with the same name as an existing service, the existing service is overwritten.
Follow these steps to publish your WIDL file (StockInfo) to the Web Integration Server.
host_name:port
The Web Integration Developer copies the interface to the selected package on the Web Integration Server and notifies you that the interface is successfully published. Assuming the package is enabled, the services in this interface are immediately available for execution.
After creating the WIDL service, you create a Portal-to-Go master service based on the WIDL service. You can create Portal-to-Go services using the Service Designer. The Service Designer is a visual tool for creating and managing Portal-to-Go objects.
To start the Portal-to-Go Service Designer, from the Start menu, point to the Oracle for Windows NT menu item. Click Portal-to-Go, then Service Designer.
When the Service Designer starts, the Log In dialog appears. Use the Log In dialog to connect the Service Designer to the Portal-to-Go repository that you want to develop. The Log In dialog enables you to select a server name that you have already used, or to enter a new server name.
To connect to the Portal-to-Go repository from the Log In dialog:
Note: The Service Designer displays an Error dialog for invalid entries. By clicking the Show Details button, you can view the Java runtime exception details. |
Using the Service Designer, create the master service for the StockInfo WIDL file by following these steps:
StockInfo
. This is the name of the WIDL interface you created in "Task 1: Creating the WIDL File in the Web Integration Developer."
CoSymbol
parameter.
This creates the master service Stock Quotes in the Portal-to-Go repository. You can now create aliases to make the master service available to users.
To add a master service alias in the service tree, you first create a new folder in the service tree and then add an alias to the master service in this folder. Follow these steps to create an alias for the master service Stock Quote in the service tree:
CoSymbol.
This creates an alias object in the Portal-to-Go repository. Aliases, like master services, have input parameters. You can use the input parameters of an alias to override any input values specified by the master service. For this walkthrough, you use the default settings provided by the master service.
Now you create a user group and then a user.
First, you create an overall folder which will later contain a unique "root folder" for each user that you create. Each "root folder" will have the same name that you used to name the user. You can call the overall folder anything you like that is meaningful to you, keeping in mind that this folder will contain the root folders for all the users. In our example, the overall folder is called "Users Home." Create this folder in the Service Trees node of the repository tree in the left frame.
The root folder of a particular user contains the services (including aliases, master services, and folders) which the specified user can access.
One benefit is that if you have many users, you can create an overall folder for each grouping of users. For example, using the label "Users Home" as an illustration, you can create "Users Home A" for all users whose name starts with A, "Users Home B" for users whose name starts with B, and so on. In this fashion, grouping the users' root folders within higher-level folders minimizes the number of objects that are displayed in the Service Designer's tree view. (For performance reasons, the default view in the Service Designer's tree view does not display more than 100 objects of any type.)
Second, you create a user group.
Finally, you create the user and add the user to a group.
To create the overall folder for the users' root folders (using "Users Home" as an example):
The folder named "Users Home" now appears under Service Trees in the repository tree.
To create a user group:
This creates a user group called MySampleGroup in the repository.
To create the user:
Sam
.
welcome
.
welcome
.
This action creates a user folder named "Sam" under the overall folder named "User's Home." You will see the user folder for Sam when you expand the User's Home node in the tree view.
To make the service you created available to a group of users:
This makes the service available to all users in the group MySampleGroup. In "Task 8: Testing the Service", you test this service as the user Sam.
In this walkthrough, you test your Portal-to-Go service using the Personalization Portal and a phone simulator. For more information on the Personalization Portal, see Chapter 7, "Rebranding the Personalization Portal".
Log on to the Personalization Portal to view the service you created. To access the Personalization Portal:
http://
PTGServer.
domain/panama/server/papz/login.jsp
In this Field... | Type... |
---|---|
Username |
|
Password |
|
The services available to the user Sam appear in the left frame.
Portal-to-Go retrieves and displays the current price of the stock.
You can use any WML- or HDML-based phone simulator to test the service. If you do not already have one, download and install a simulator. If you are working behind a firewall, you must configure the proxy server settings in the simulator before using it to access external sites.
Follow these steps to test the service from a phone simulator.
http://
PTGServer.domain/panama/server/papz/
alias for the oracle.panama.ParmImpl servletThis is the URL of the device portal for your Portal-to-Go installation.
Portal-to-Go retrieves and displays the current price of the stock.
In this walkthrough, you create a Portal-to-Go service based on the SQL adapter. You create a service that checks the current time from the system table DUAL and displays it to the user.
Before you begin the walkthrough, make sure you can access a Portal-to-Go server from your development environment. Start the Service Designer, as described in Step 1 of the Web Integration walkthrough, and follow these steps:
select sysdate from dual
jdbc:oracle:thin:@
host_name:
port:
SID
You can now test the service from a simulator, as described in steps 5 through 8 of the Web Integration service walkthrough.
Chained services link services to each other in a sequential way so that each chained service is dependent for input on the service that immediately precedes it. Chained services are needed for Web sites which require the user to interact with a Web page to access the rest of the content on the Web site. For example, the first Web page prompts the user for a username and password before the user can access the form on the second page, which then produces the information on the third page. Chaining one service (Service A) to another service (Service B) works in such a way that when the Output Binding of Service A completes successfully, it chains to the Input Binding of Service B.
The chained service you build in this walkthrough illustrates a typical use of chained services. Based on the Yahoo finance site, the chained service you build in this section allows the user to enter a stock ticker symbol, receive the current stock quote, select details, and receive detailed information about the stock, such as a chart. The first service requests that the user enter a stock ticker symbol. It returns the current quote for that stock. When the user clicks on Details and selects Charts, the second service returns the chart for that stock.
You should become familiar with a site you want to base a service on by first opening it in a browser. Opening the site and viewing its HTML source code lets you become familiar with the structure of a site. In a browser, open the Yahoo site for getting stock quotes:
http://quote.yahoo.com
The query form on this page takes a stock's ticker symbol. It returns that stock's current quote.
This walkthrough assumes that you are familiar with the basic steps required to create a Web service in the Oracle Web Integration Developer. If you are not, complete the Web Integration walkthrough in "Creating a Web Service" before attempting to follow this walkthrough.
This walkthrough does not include error checking. Usually, you would add error catching logic to the service.
The overall interface name for the chained services in this walkthrough is YahooFinance. The first service in the chain sequence is called Quote. This service prompts the user for a stock ticker symbol (such as, ORCL) and returns the stock quote. The following steps provide a basic method for creating the first service in the chain.
http://quote.yahoo.com
Two nodes appear in the document browser, Document and FirstForm.
In this Field... | Type... |
---|---|
Interface |
|
Service |
|
This walkthrough takes you through the steps to build the second service, named Detail, in the chained service YahooFinance. While you can create chained services using separate interfaces, in this walkthrough you add the second service to the YahooFinance interface.
The Detail service takes the stock quote as input and returns stock charts.
Create the second service as follows:
http://finance.yahoo.com
In this Field... | Type... |
---|---|
Interface |
|
Service |
|
Publish the new service to the WIDL server, as described in "Task 2: Publishing the WIDL Interface to the Web Integration Server."
The new Master Service is YahooFinance. It points to the interface YahooFinance; it includes the two chained services Quote and Detail. To add this service to the Portal-to-Go repository, start the Service Designer and follow these steps:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:apply-templates select="ServiceRequest/Result/AdapterResult"></xsl:apply-templates> </xsl:template> <xsl:template match="AdapterResult"> <SimpleResult> <SimpleMenu> <SimpleMenuItem> <xsl:attribute name="target">___REQUEST_NAME__?PAservicepath=___SERVICE_URL_ENC__ &PAsection=Detail&s2=<xsl:value-of select="symbol"></xsl:value-of></xsl:attribute> <xsl:value-of select="symbol"></xsl:value-of> <!-- this xsl:text is just for beautifying the output --> <xsl:text> - </xsl:text> <xsl:value-of select="price"></xsl:value-of> <!-- this xsl:text is just for beautifying the output --> <xsl:text> - </xsl:text> <xsl:value-of select="change"></xsl:value-of> </SimpleMenuItem> </SimpleMenu> </SimpleResult> </xsl:template> </xsl:stylesheet>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:apply-templates select="ServiceRequest/Result/AdapterResult"></xsl:apply-templates> </xsl:template> <xsl:template match="AdapterResult"> <SimpleResult> <SimpleContainer> <SimpleText> <SimpleTextItem> <xsl:value-of select="opened"></xsl:value-of> </SimpleTextItem> <SimpleTextItem> <xsl:value-of select="range"></xsl:value-of> </SimpleTextItem> <SimpleTextItem> <xsl:value-of select="volume"></xsl:value-of> </SimpleTextItem> <SimpleTextItem> <xsl:value-of select="annualrange"></xsl:value-of> </SimpleTextItem> <SimpleTextItem> <xsl:value-of select="pe"></xsl:value-of> </SimpleTextItem> <SimpleTextItem> <xsl:value-of select="mktcap"></xsl:value-of> </SimpleTextItem> </SimpleText> </SimpleContainer> </SimpleResult> </xsl:template> </xsl:stylesheet>
|
Copyright © 2000 Oracle Corporation. All Rights Reserved. |
|