Oracle9i Application Server Wireless Edition Implementation Guide Release 1.1 Part Number A86699-01 |
|
This document describes how to create Oracle9i Application Server Wireless Edition services. Each section of this document presents a different topic. These sections include:
The following walkthroughs provide step-by-step instructions for creating and distributing mobile services with the Wireless Edition. In these walkthroughs, you create services based on the Wireless Edition adapters. At the end of each walkthrough, you test your development using a device emulator.
These walkthroughs familiarize you with the Wireless Edition tools, including the Personalization Portal, the Master Service Creation Wizard, the Service Designer, and the Web Integration Developer and how they enable you to create mobile services.
Before you begin the walkthroughs, make sure that you correctly install and configure the Wireless Edition server. Also, you must complete the client installation on your development environment.
To start the Wireless Edition Service Designer, from the Start menu, point to the Oracle for Windows NT menu item. Click Wireless Edition, 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 Wireless Edition 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 Wireless Edition 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. |
Each section of the walkthrough describes a task needed to complete the creation of a service. These sections include:
In this step, you create a user group and then a user. Using the Service Designer, 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 use the Personalization Portal to create a both user group and a user
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:
To create the user:
Once you have created both the group and the user, you are ready to create service using the Wireless Edition adapters.
In this walkthrough, you use the Master Service Creation Wizard to create a Wireless Edition service based on the SQL adapter. You create a service that checks the current time from the system database and displays it to the user.
Before you begin the walkthrough, make sure you can access a Wireless Edition server from your development environment running the Service Designer.
Start the Service Designer and follow these steps:
jdbc:oracle:thin:@host_name:port:SID
Oracle.jdbc.driver.oracle.driver
)
Query
.
select sysdate from dual;
Using the Service Designer, you can make a master service accessible to a user by placing it in a service tree that a user owns or can access.
.
This creates an alias object in the Wireless Edition 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.
You use the Service Designer 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 Section 9.3.4, you test this service as the user 1234.
In this walkthrough, you test the Wireless Edition service, SQL Time, using a browser and a phone simulator. Testing the service on a browser gives you a similar result to testing it on the phone simulator.
Testing the Service on a Browser
Log on to a browser to view the service you created. To access the browser:
http://9iASWEServer.domain/ptg/rm
The Wireless Edition retrieves and displays the current system time.
You can use any phone simulator (for example, WML, HDML, CHTML) to test SQL Time. 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://9iASWEServer.domain/ptg/rm
This is the URL of the device portal for your Wireless Edition installation.
The Wireless Edition retrieves and displays the current system time.
Now that you have created a simple service, you can extend the functionality of the SQL adapter by creating a PL/SQL service. This walkthrough demonstrates how to pass parameters with PL/SQL using the Wireless Edition variables. Specifically, you use the sample PL/SQL package, demo_proc.sql (see Section 9.4.1), to create a service that allows you to enter a manager ID (the input_manager_id function
in the demo_proc.sql package) that gets passed to the PL/SQL package's employee_list
function using the Wireless Edition variables p_manager_id
, p_empno
, and p_serv
.
After you have created this service, you then make it available to a group by creating an alias. Lastly, you test this service using the Personalization Portal and a phone simulator.
Before you begin this walkthrough, you must load the following PL/SQL package, demo_proc.sql using such database tools as SQL*Plus. For example, you use the SQL*Plus command to load the package:
sqlplus demo/demo SQL>@demo_proc SQL>
The demo_proc.sql package is as follows:
CREATE OR REPLACE PROCEDURE demo_proc p_serv IN INTEGER DEFAULT 0, p_empno IN INTEGER DEFAULT 0, p_manager_id IN INTEGER DEFAULT 0) AS v_first_name employee.first_name%TYPE; v_last_name employee.last_name%TYPE; v_manager_id employee.manager_id%TYPE; v_employee_id employee.employee_id%TYPE; BEGIN dbms_output.enable(20000); IF (p_serv = 0) THEN GOTO input_manager_id; elsif (p_serv = 10) THEN GOTO employee_list; elsif (p_serv = 20) THEN GOTO options; elsif (p_serv = 30) then goto job_id; elsif (p_serv = 40) then goto manager_id; END IF; <<input_manager_id>> dbms_output.put_line('<SimpleResult><SimpleContainer>'); dbms_output.put_line('<SimpleForm target="___REQUEST_NAME__?PAoid=__PAoid__ &p_serv=10">'); dbms_output.put_line('<SimpleFormItem name="p_manager_id" title="Enter ID" format="N*M">Enter ID:</SimpleFormItem>'); dbms_output.put_line('</SimpleForm>'); dbms_output.put_line('</SimpleContainer></SimpleResult>'); GOTO fin; <<employee_list>> select employee.first_name, employee.last_name INTO v_first_name, v_last_name FROM employee where employee.manager_id = p_manager_id; dbms_output.put_line('<SimpleResult><SimpleContainer>'); dbms_output.put_line('<SimpleMenu title="EmpID First Last">'); FOR i IN (select employee_id, first_name, last_name from employee where manager_ id = p_manager_id) LOOP dbms_output.put_line('<SimpleMenuItem title="Employees" target="___REQUEST_ NAME__?PAoid=__PAoid__&p_serv=20&p_empno='||to_char(i.employee_ id)||'">Employee '||i.employee_id||' is '||v_first_name||' '||v_last_name||' </SimpleMenuItem>'); END LOOP; dbms_output.put_line('</SimpleMenu>'); dbms_output.put_line('</SimpleContainer></SimpleResult>'); GOTO fin; <<options>> dbms_output.put_line('<SimpleResult><SimpleContainer>'); dbms_output.put_line('<SimpleMenu title="Request '||p_empno||'">'); dbms_output.put_line('<SimpleMenuItem target="___REQUEST_NAME__?PAoid=__PAoid_ _&p_serv=30&p_empno='||p_empno||'">Update Salary</SimpleMenuItem>'); dbms_output.put_line('<SimpleMenuItem target="___REQUEST_NAME__?PAoid=__PAoid_ _&p_serv=40&p_empno='||p_empno||'">Update Manager ID</SimpleMenuItem>'); dbms_output.put_line('</SimpleMenu>'); dbms_output.put_line('</SimpleContainer></SimpleResult>'); GOTO fin; <<job_id>> select employee.last_name INTO v_last_name FROM employee where employee_id = p_ empno; update employee set salary = 100 where employee_id = p_empno; commit; dbms_output.put_line('<SimpleResult><SimpleContainer>'); dbms_output.put_line('<SimpleText wrapit="true" title="Changed to 100">'); dbms_output.put_line('<SimpleTextItem>Employee '||p_empno||' '||v_last_name||' salary changed </SimpleTextItem>'); dbms_output.put_line('</SimpleText>'); dbms_output.put_line('<SimpleHref type="options" title="Prev" target="___ REQUEST_NAME__?PAoid=__PAoid__"/>'); dbms_output.put_line('</SimpleContainer></SimpleResult>'); GOTO fin; <<manager_id>> dbms_output.put_line('<SimpleResult><SimpleContainer>'); dbms_output.put_line('<SimpleText wrapit="true" title="Changed to 7788">'); dbms_output.put_line('<SimpleTextItem>Employee '||p_empno||' manager changed </SimpleTextItem>'); dbms_output.put_line('</SimpleText>'); dbms_output.put_line('<SimpleHref type="options" title="Prev" target="___ REQUEST_NAME__?PAoid=__PAoid__"/>'); dbms_output.put_line('</SimpleContainer></SimpleResult>'); GOTO fin; <<fin>> null; END demo_proc; / show errors;
The PL/SQL package, demo_proc.sql, shows how the Wireless Edition, using PL/SQL, passes variables to update a table.
Using a mobile phone, a manager accesses a list of employees and then updates the salary of an individual employee. To begin the process, the manager requests the service on the mobile phone. (The service is the name of the Wireless Edition alias created using the Service Designer. For more information, see Section 9.4.3.)
The first screen of the service requests the manager's ID. After the manager enters this value, the service presents the manager with a screen that lists the employees that report to the manager.
The manager selects Employee List and the manager ID queries the database for all employees who report to that manager (for example, employees who have been assigned that manager ID). The service retrieves a list of employees. The manager then selects an individual employee from this list. A screen then appears, presenting the manager with a menu with options to update the employees's salary or the manager's ID. The manager then chooses the option to update the employee's salary. The manager decides to increase the selected employee's salary by $100 and enters 100.
In demo_proc.sql, Wireless Edition defines the user-input variables as p_serv
, p_empno
, and p_manager
as follows.
CREATE OR REPLACE PROCEDURE demo_proc p_serv IN INTEGER DEFAULT 0, p_empno IN INTEGER DEFAULT 0, p_manager_id IN INTEGER DEFAULT 0)
These variables are defined using the Master Service Creation Wizard. For more information, see Step 3e under Section 9.4.2. The variable p_serv
defines the code branches in this PL/SQL package as follows:
IF (p_serv = 0) THEN GOTO input_manager_id; elsif (p_serv = 10) THEN GOTO employee_list; elsif (p_serv = 20) THEN GOTO options; elsif (p_serv = 30) then goto job_id; elsif (p_serv = 40) then goto manager_id; END IF;
The variable p_serv
navigates the above menu list by invoking the URL appropriate to the input value. For example, when a user selects the employee list, p_serv
is passed in as 10, which invokes the URL containing the list of employees through the following function, which defines the target URL.
target="___REQUEST_NAME__?PAoid=__PAoid__&p_serv=10">'
Note:
Three separate underscore marks (_ _ _) must both precede and follow the |
The target URL function passes variables from one page or screen to another from one page or screen to the next using &
, the equivalent to the "&" in the URL.
The following string is an example of how to write the Wireless Edition XML document from PL*SQL.
dbms_output.put_line('<SimpleResult><SimpleContainer>');
For more information on the Wireless Edition DTD (SimpleResult
DTD), see the Oracle9i Application Server Wireless Edition Developer's Guide.
Invoke the Master Service Creation Tool as you did in Section 9.3.1, "Task 1: Using the Master Service Creation Wizard".
jdbc:oracle:thin:@host_name:port:SID
Oracle.jdbc.driver.oracle.driver
)
PL/SQL
from the drop-down menu.
BEGIN demo_proc(:p_serv, :p_empno, :p_manager_id);END;
Note:
The Value field in the Input Parameters screen sets default parameters such as 0. For example, setting |
Next you can make a master service accessible to a user by placing it in a service tree that a user owns or can access.
Click the Input Parameters tab in the right frame and select the User Customizable check box for PLSQL Test.
To make PLSQL Test available to a group:
This makes the service available to all users in the group MySampleGroup.
In this walkthrough, you test the Wireless Edition service, PLSQL Test, using a browser and a phone simulator. Testing the service on a browser will produce the same results as testing it using a phone simulator.
Log on to the Personalization Portal to view PLSQL Test. To access the browser:
You can use any phone simulator (for example, WML, HDML, CHTML) to test PLSQL Test. 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://9iASWEServer.domain/ptg/rm
This is the URL of the device portal for your Wireless Edition installation.
In this walkthrough, you create a Wireless Edition service based on the URL adapter, which allows applications to invoke other URLs and pass in arguments. In addition the URL adapter enables the following functions:
The URL adapter is well suited for developers wishing to build a wireless Web site or internet application using only Java servlets and JavaServer Pages (JSPs).
This walkthrough uses a sample Java package that shows how to embed SimpleResult DTD. The JAVA program in the section is an example.
Before you create the master service, you must build the following JAVA program.
import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.Enumeration; import java.util.StringTokenizer; import java.util.Properties; import java.util.Date; public class CompanionServer extends HttpServlet { String directory = ""; static String version = "v1.0"; static String servletname = "/cmp/go"; Properties properties; public void init (ServletConfig config) throws ServletException { super.init(config); return; } public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String state = req.getParameter("state"); PrintWriter o = res.getWriter(); if (state == null) { res.setContentType("text/xml"); print_default(req, res, o); } else if (state.equals("menu")) { res.setContentType("text/xml"); print_menu(req, res, o); } else if (state.equals("form")) { res.setContentType("text/xml"); print_form(req, res, o); } else if (state.equals("text")) { res.setContentType("text/xml"); print_text(req, res, o); } else if (state.equals("test")) { res.setContentType("text/xml"); print_test(req, res, o); } else if (state.equals("param")) { res.setContentType("text/xml"); print_parameters(req, res, o); } else { res.setContentType("text/xml"); // ERROR: unknown application state print_error(o, "unknown application state [get]["+state+"]"); } return; } void print_default (HttpServletRequest req, HttpServletResponse res, PrintWriter o) throws ServletException, IOException { String server = req.getServerName(); int port = req.getServerPort(); print_header(o); o.println ("<SimpleText><SimpleTextItem>Click GO! to Start</SimpleTextItem></SimpleText>"); o.println ("<SimpleHref target=\"___REQUEST_NAME__?PAoid=__PAoid__ &URL=http://" + server + ":" + port + servletname + "?state=menu\" title=\"GO!\" type=\"accept\"/>"); print_footer(o); return; } void print_parameters (HttpServletRequest req, HttpServletResponse res, PrintWriter o) throws ServletException, IOException { print_header(o); { Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); String[] value = req.getParameterValues(name); for (int i = 0; i < value.length; i++) { o.println ("<SimpleText>"); o.println ("<SimpleTextItem title=\"" + name + "\">"); o.println (value[i]); o.println ("</SimpleTextItem>"); o.println ("</SimpleText>"); } } } print_footer(o); return; } void print_header(PrintWriter o) throws ServletException, IOException { o.println ("<SimpleResult><SimpleContainer>"); return; } void print_footer(PrintWriter o) throws ServletException, IOException { o.println ("</SimpleContainer></SimpleResult>"); return; } void print_error(PrintWriter o, String e) throws ServletException, IOException { print_header(o); o.println ("<SimpleText><SimpleTextItem title=\"Error\">"); o.println (e); o.println ("</SimpleTextItem></SimpleText>"); print_footer(o); return; } void print_menu (HttpServletRequest req, HttpServletResponse res, PrintWriter o) throws ServletException, IOException { String server = req.getServerName(); int port = req.getServerPort(); print_header(o); o.println ("<SimpleMenu title=\"Menu\">"); o.println ("<SimpleMenuItem target=\"___REQUEST_NAME__?PAoid=__PAoid__ &URL=http://" + server + ":" + port + servletname + "?state=text&item=ONE\">"); o.println ("Choice 1"); o.println ("</SimpleMenuItem>"); o.println ("<SimpleMenuItem target=\"___REQUEST_NAME__?PAoid=__PAoid__ &URL=http://" + server + ":" + port + servletname + "?state=text&item=TWO\">"); o.println ("Choice 2"); o.println ("</SimpleMenuItem>"); o.println ("<SimpleMenuItem target=\"___REQUEST_NAME__?PAoid=__PAoid__ &URL=http://" + server + ":" + port + servletname + "?state=text&item=THREE\">"); o.println ("Choice 3"); o.println ("</SimpleMenuItem>"); o.println ("</SimpleMenu>"); print_footer(o); return; } } void print_text (HttpServletRequest req, HttpServletResponse res, PrintWriter o) throws ServletException, IOException { String sitem = req.getParameter("item"); String server = req.getServerName(); int port = req.getServerPort(); print_header(o); o.println("<SimpleText title=\"Result\">"); o.println("<SimpleTextItem>" + sitem + "</SimpleTextItem>"); o.println("</SimpleText>"); o.println ("<SimpleHref target=\"___REQUEST_NAME__?PAoid=__PAoid__ &URL=http://" + server + ":" + port + servletname + "?state=menu\" title=\"Menu\" type=\"accept\"/>"); print_footer(o); return; } }
The example presents URLs as menu items using Wireless Edition DTD, enabling users to select another URL or application. The target URL, defined by the following function, is the entry point to call the servlet.
target=\"___REQUEST_NAME__?PAoid=__PAoid__&URL=http://" + server + ":" + port + servletname + "?state=menu\">Menu</SimpleHref>"
The target URL function allows applications to invoke a URL. In addition, the target URL function passes arguments from one URL or application to another using the &
, the equivalent to the "&" in the URL.
The o.println
function defines the output as SimpleResult DTD as follows:
o.println ( <SimpleText><SimpleTextItem>Click GO! to
start</SimpleTextItem></SimpleText>");
To run the Java example with your web server:
companion.properties=C:\Apache\ JServ 1.1.1\servlets\companion.properties
Table 9-2 Servlet Parameters
Invoke the Master Service Creation Tool as you did in Section 9.3.1, "Task 1: Using the Master Service Creation Wizard".
Next you can make a master service accessible to a user by placing it in a service tree that a user owns or can access.
To make URL Example available to a group:
This makes the service available to all users in the group MySampleGroup.
In this walkthrough, you test the Wireless Edition service, URL Example, using a browser and a phone simulator.
Log on to a browser to view URL Example. To access the service:
http://9iASWEServer.
domain/ptg/rm
You can use any phone simulator (for example, WML, HDML, CHTML) to test Geocoder. 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://9iASWEServer.domain/ptg/rm
This is the URL of the device portal for your Wireless Edition installation.
In this walkthrough, you create a Wireless Edition service based on a spatial adapter, the Geocoder. In addition, you make this service location-dependent using the Region Modeling Tool.
Invoke the Master Service Creation Tool as you did in Section 9.3.1, "Task 1: Using the Master Service Creation Wizard".
Next you can make a master service accessible to a user by placing it in a service tree that a user owns or can access.
To make Geocoder available to a group:
This makes the service available to all users in the group MySampleGroup.
In this walkthrough, you test the Wireless Edition service, Geocoder, using a Web browser and a phone simulator.
Log on to a browser to test the Geocoder service. To access the URL:
You can use any phone simulator (for example, WML, HDML, CHTML) to test Geocoder. 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://9iASWEServer.domain/ptg/rm
This is the URL of the device portal for your Wireless Edition installation.
You can create your own spatial adapters using the Service Designer.
Note: You can create another spatial adapter, such as the yellow page adapter, by following the steps described in this section. |
In this walkthrough, you create a Wireless Edition 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 Oracle9i Application Server Wireless Edition service that retrieves stock quotes based on the mapping.
For more information on using the Web Integration Developer, see the Oracle9i Application Server Wireless Edition Developers's Guide.
This walkthrough devotes a section to each task associated with creating a master service. These sections include:
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 master service based on the WIDL service. You can create Wireless Edition services using the Service Designer. The Service Designer is a visual tool for creating and managing Wireless Edition objects.
To start the Service Designer, from the Start menu, point to the Oracle for Windows NT menu item. Click Wireless Edition, 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 Wireless Edition 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 Wireless Edition 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. |
In this walkthrough, you use the Master Service Creation Wizard to create a Wireless Edition service StockInfo WIDL based on the Web integration adapter. You create a service that displays the current stock price after you enter a valid stock ticker symbol (for example, ORCL).
Before you begin the walkthrough, make sure you can access a Wireless Edition server from your development environment running the Service Designer.
Start the Service Designer and follow these steps:
StockInfo
. This is the name of the WIDL interface you created in Section 9.8.1
CoSymbol
parameter.
This creates the master service Stock Quotes in the Oracle9i Application Server Wireless Edition repository. You can now create aliases to make the master service available to users, assign the service to the group, and test it.
Using the Service Designer, you can make a master service accessible to a user by placing it in a service tree that a user owns or can access. To create an alias for the service Stock Quotes:
.
This creates an alias object in the Wireless Edition 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.
You use the Service Designer 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 Section 9.8.7, you test this service as the user 1234.
In this walkthrough, you test the Wireless Edition service, Stock Quotes, using a browser and a phone simulator.
Log on to a browser to test the service. To access the URL:
http://9iASWEServer.domain/ptg/rm
The Wireless Edition retrieves and displays the current stock price.
You can use any phone simulator (for example, WML, HDML, CHTML) to test Stock Quotes. 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://9iASWEServer.domain/ptg/rm
This is the URL of the device portal for your Wireless Edition installation.
The Wireless Edition retrieves and displays the current price of the stock.
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 user name 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 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 Section 9.8.2
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 Wireless Edition repository, start the Service Designer and follow these steps:
Start the Service Designer and follow these steps:
<xsl:stylesheet version="1.0" 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 version ="1.0" 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>
An External Link is a Wireless Edition service that points to an external resource. The external resource is typically a Web page that serves content in a format supported by the target device. When an end user sets an external link, it appears as a menu selection in the device portal.
The Wireless Edition does not process the content of the external link target. As a result, external link services are not available to all targeted devices, as are other Wireless Edition services.
In this walkthrough, you will create an external link using the Service Designer.
To create an external link in the Service Designer:
|
Copyright © 2001 Oracle Corporation. All Rights Reserved. |
|