This tutorial describes how to use the demo files for Oracle Spatial Web Services such as Web Feature Service (WFS), Catalog Services for the Web (CSW), and Open Location Services (OpenLS).
Approximately 30 minutes
This tutorial covers the following topics:
Overview | ||
Prerequisites | ||
Running the Web Feature Service (WFS) Demos | ||
Running the Catalog Services for the Web (CSW) Demos | ||
Running the Open Location Services (OpenLS) Demos | ||
Summary |
Place the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: This action loads all screenshots simultaneously, so response time may be slow depending on your Internet connection.)
Note: Alternatively, you can place the cursor over an individual icon in the following steps to load and view only the screenshot associated with that step. You can hide an individual screenshot by clicking it.
In the tutorial, "Installing
and Configuring Spatial Web Service in OC4J," you performed steps to install
and configure Spatial Web Service in Oracle Application Server Containers for J2EE. In this
tutorial, you will use the supplied demo files for Oracle Spatial Web Services
such as WFS, CSW, and OpenLS.
Before you perform this tutorial, you should:
Complete the tutorial Installing and Configuring Spatial Web Service for OC4J. |
Perform the following steps:
Populate the Relational and Document-Based Feature Type
1. |
From your terminal window, enter the following commands: cd $CLIENT_HOME/src/sql
sqlplus / as sysdba
Here, $CLIENT_HOME is the directory location where you extracted the wsclient.jar file.
|
|
2. |
To populate the relational feature type, enter the following SQL script: @wfsrelmd.sql The wfsrelmd.sql script creates users, tables, and indexes; grants privileges; and executes some PL/SQL procedures. The following screenshot shows only a part of the output.
|
|
3. |
To populate the document-based feature type, enter the following SQL script: @wfsdocmd.sql The wfsdocmd.sql script also creates users, tables, and indexes; grants privileges; and executes some PL/SQL procedures. The following screenshot shows only a part of the output.
Quit SQL Plus.
|
1. |
To create the feature type (java oracle.spatial.ws.admin demo.WFSAdminDemo SampleFeature ./data/datafeatures.xsd ./data/fd_sample.xml create), enter the following commands: cd $CLIENT_DIR/src ./compileAndRunClient.sh runwfsct Here, CLIENT_DIR is the path where you extracted the src folder.
|
|
2. |
In a new terminal, start the OC4J server. Enter the following commands: cd <jdevhome directory>/bin ./oc4j -start
|
The WFS relational-based demo presents the processing of the following WFS request types, for the relational-based feature type:
GetCapabilities | ||
DescribeFeatureType | ||
GetFeature | ||
Transaction, with a subelement specifying the transaction type: |
||
Insert |
||
Update | ||
Delete |
When you run the WFS demo, the WFS server sequentially processes the inputs and generates the outputs. The input files are wfsrel_01.xml, wfsrel_02.xml, and so on until wfsrel_22.xml. The input XML files, wfsrel_*.xml files, are included in the wsclient.jar file and can be accessed from the $CLIENT_HOME/src/data folder. The generated output files are wfsrel_01.log, wfsrel_02.log, and so on until wfsrel_22.log. Perform the following steps to run the WFS demo.
1. |
To run the relational WFS demo, enter the following commands (where $CLIENT_DIR is the client directory that has this demo's src/ content): cd $CLIENT_DIR/src/data cp wfsMapFile_rel.txt wfsMapFile.txt
|
|
2. | Then, run the WFS demo
(java oracle.spatial.ws.svrproxy.TestWFS wfs_rel_user wfs_rel_user) as follows:
cd $CLIENT_DIR/src The src/data/wfsrel_*.xml files will be accessed when you run the ./compileAndRunClient.sh runwfsrel command. The corresponding output files are generated in the src/data directory as the wfsrel_*.log files. The following screenshots show the complete output in parts.
|
View the Request and Response XML Examples
The input/output file contents as per the feature type are described below:
Input | Output | ||
GetCapabilities | wfsrel_12.xml is an example of the GetCapabilties request. | wfsrel_12.log displays the capabilties response, which outlines the capabililties of the WFS Server. | |
DescribeFeatureType | wfsrel_11.xml and wfsrel_20.xml are examples of the DescribeFeatureType request, which requests to describe the structure of a feature type. | wfsrel_11.log and wfsrel_20.xml displays the structure of the feature type. | |
GetFeature | wfsrel_01.xml, wfsrel_02.xml, and so on until wfsrel_10.xml, wfsrel_13.xml, and wfsrel_19.xml are examples of the GetFeature request, which queries for feature instances satisfying a filter criteria. | wfsrel_01.log, wfsrel_02.log, and so on until wfsrel_10.log, wfsrel_13.log, and wfsrel_19.log are results of the query, showing feature instances, which satisfied the corresponding filter criteria. | |
Transaction: Insert | wfsrel_14.xml, wfsrel_17.xml, and wfsrel_21.xml are examples of the Inserting feature instance. | wfsrel_14.log, wfsrel_17.log, and wfsrel_21.log displays the output of the WFS Server in response to the Insert request. | |
Transaction: Delete | wfsrel_16.xml, wfsrel_18.xml, and wfsrel_22.xml are examples of the Deleting feature instance. | wfsrel_16.log, wfsrel_18.log, and wfsrel_22.log displays the output of the WFS Server in response to the Delete request. | |
Transaction: Update | wfsrel_15.xml is an example of the Updating feature instance. | wfsrel_15.log displays the output of the WFS Server in response to the Update request. |
In the following table, examine wfsrel_01.xml and its corresponding output, wfsrel_01.log. As mentioned, wfsrel_01.xml is an example of the GetFeature request. The input files are shipped inside wsclient.jar. All output files are generated in the $CLIENT_HOME/src/data directory when you ran the demo. If you want to examine other inputs and its corresponding outputs, you can access them in the $CLIENT_HOME/src/data directory.
1. |
Examine the input XML, wfsrel_01.xml file, as shown in the following screenshot: The corresponding output, wfsrel_01.log, is shown in the screenshot below:
|
Run the WFS Document-Based Demo
The WFS document-based demo presents the processing of the following WFS request types, for document (external XSD)based feature type:
GetFeature | ||
Transaction, with a subelement specifying the transaction type: |
||
Insert |
||
Update | ||
Delete |
When you run the WFS document-based demo, the WFS Server sequentially processes the inputs and generates the outputs. The input files are wfsdoc_01.xml, wfsdoc_02.xml, so on until wfsdoc_20.xml. The input xml files, wfsdoc_*.xml files, are included in the wsclient.jar file and can be accessed from the $CLIENT_HOME/src/data folder. The generated output files are wfsdoc_01.log, wfsdoc_02.log, and so on until wfsdoc_20.log. Perform the following steps to run the WFS document-based demo.
1. |
To run the document-based WFS demo, enter the following commands (where $CLIENT_DIR is the client directory that has this demo's src/ content): cd $CLIENT_DIR/src/data cp wfsMapFile_doc.txt wfsMapFile.txt
|
|
2. |
Then, run the document-based demo (java oracle.spatial.ws.svrproxy.TestWFS wfs_doc_user wfs_doc_user) as follows: cd $CLIENT_DIR/src
./compileAndRunClient.sh runwfsdoc
The following screenshots show the complete output in parts.
|
View the Request and Response XML Examples
The input/output file contents as per the feature type are described below:
Input | Output | ||
GetFeature | wfsdoc_02.xml, wfsdoc_03.xml, wfsdoc_04.xml, wfsdoc_05.xml, wfsdoc_07.xml, wfsdoc_12.xml, wfsdoc_14.xml, wfsdoc_16.xml, wfsdoc_18.xml, and wfsdoc_20.xml are examples of the GetFeature request, which queries for feature instances satisfying a filter criteria. | wfsdoc_02.log, wfsdoc_03.log, wfsdoc_04.log, wfsdoc_05.log, wfsdoc_07.log, wfsdoc_12.log, wfsdoc_14.log, wfsdoc_16.log, wfsdoc_18.log, and wfsdoc_20.log are results of the query, showing feature instances, which satisfied the corresponding filter criteria. | |
Transaction: Insert | wfsdoc_01.xml, wfsdoc_09.xml are examples of Inserting feature instance | wfsdoc_01.log and wfsdoc_09.log display the output of the WFS Server in response to the Insert request. | |
Transaction: Delete | wfsdoc_08.xml, wfsdoc_19.xml are examples of Deleting feature instance | wfsdoc_08.log and wfsdoc_19.log display the output of the WFS Server in response to the Delete request. | |
Transaction: Update | wfsdoc_06.xml, wfsdoc_10.xml, wfsdoc_11.xml, wfsdoc_13.xml, wfsdoc_15.xml, wfsdoc_17.xml are examples of Updating feature instance | wfsdoc_06.log, wfsdoc_10.log, wfsdoc_11.log, wfsdoc_13.log, wfsdoc_15.log, and wfsdoc_17.log display the output of the WFS Server in response to the Update request. |
In the table below, examine wfsdoc_06.xml and its corresponding output, wfsdoc_06.log.
The input files are shipped inside wsclient.jar. All output files are generated in the $CLIENT_HOME/src/data directory when you ran the demo. If you want to examine other inputs and its corresponding outputs, you can access them in the $CLIENT_HOME/src/data directory.
1. |
Examine the wfsdoc_06.xml input file. As mentioned, wfsdoc_06.xml is an example of the Transaction: Update request.
|
|
2. |
The following screenshot shows the response, the wfsdoc_06.log file.
|
1. | To drop the relational feature type, enter the following commands: cd $CLIENT_DIR/src/sql Run the SQL*Plus script: drprelmd.sql. @drprelmd.sql Quit SQL*Plus.
|
|
2. | To drop the document-based feature type, enter the following commands: cd $CLIENT_DIR/src
|
|
3. |
Stop the OC4J server. Enter the following commands: cd <Jdev directory>/bin ./oc4j -shutdown -port 23791 -password admin
|
Perform the following steps:
Populate and Create the Record Type | ||
Run the CSW Demo | ||
View the Request and Response XML Examples | ||
Drop the Record Types |
Populate and Create the Record Type
1. |
Populate the record type for the CSW demo by entering the following commands (where $CLIENT_HOME is the client directory that has this demo's src/ content): cd $CLIENT_HOMR/src/sql sqlplus / as sysdba @cswmd.sqlThe cswmd.sql script creates users, tables, and indexes; grants privileges; and executes some PL/SQL procedures. The screenshot below shows only a part of the output. Quit SQL*Plus.
|
|
2. |
To create the type, use the Java class oracle.spatial.ws.admindemo.CSWAdminDemo createRecordType, as follows: cd $CLIENT_HOME/src ./compileAndRunClient.sh runcswct
|
|
3. |
In a new terminal window, start the OC4J server. Enter the following commands: cd <jdevhome directory>/bin ./oc4j -start
|
The CSW demo presents the processing of the following CSW request types:
GetCapabilities | ||
DescribeRecord | ||
GetRecords | ||
GetDomain | ||
GetRecordById | ||
Transaction, with a subelement specifying the transaction type: |
||
Insert |
||
Update | ||
Delete |
When you run the CSW demo, the CSW server sequentially processes the inputs and generates the outputs. The input files are csw_01.xml, csw_02.xml, and so on until csw_36.xml. The input XML files, csw_*.xml files, are included in the wsclient.jar file and can be accessed from the $CLIENT_HOME/src/data folder. The generated output files are csw_01.log, csw_02.log, and so on until csw_36.log. Perform the following steps to run the CSW demo.
1. |
To run the CSW demo (java oracle.spatial.ws.svrproxy.TestCSW csw_user csw_user), enter the following commands (where $CLIENT_HOME is the client directory that has this demo's content): cd $CLIENT_HOME/src ./compileAndRunClient.sh runcsw
|
View the Request and Response XML Examples
The input/output file contents as per the CSW request types are described below:
Input | Output | ||
GetCapabilities | csw_10.xml is an example of the GetCapabilties request. | csw_10.log displays the capabilties response, which outlines the capabililties of the CSW Server. | |
DescribeRecord | csw_09.xml is an example of the DescribeRecord request, which requests to describe the structure of a record type. | csw_09.log displays the structure of the record type. | |
GetRecords | csw_02.xml,
csw_03.xml, and so on until
csw_07.xml, csw_19.xml,
csw_21.xml, csw_22.xml,
csw_24.xml, csw_28.xml,
csw_30.xml, csw_32.xml,
csw_34.xml, and csw_36.xml
are examples of the GetRecords request, which queries for record instances
satisfying a filter criteria. |
csw_02.log,
csw_03.log, and so on until
csw_07.log, csw_19.log,
csw_21.log, csw_22.log,
csw_24.log, csw_28.log,
csw_30.log, csw_32.log,
csw_34.log, and csw_36.log
are results of the query, showing record instances, which satisfied the
corresponding filter criteria. |
|
GetDomain | csw_11.xml is an example of the GetDomain request, which is used to obtain run-time information about the range of values of a request parameter. | csw_11.log is the response to the GetDomain request. | |
GetRecordById | csw_08.xml is an example of the GetRecordById request, which queries for record instances based on its Identifier. | csw_08.log are results of the query, showing record instances, which satisfied the corresponding query criteria. | |
Transaction: Insert | csw_01.xml, csw_12.xml, csw_18.xml, csw_20.xml, csw_23.xml, and csw_25.xml are examples of Inserting a record instance. | csw_01.log, csw_12.log, csw_18.log, csw_20.log, csw_23.log, and csw_25.log display the output of the CSW server in response to the Insert request. | |
Transaction: Delete | csw_13.xml and csw_35.xml are examples of Deleting a record instance. | csw_13.log and csw_35.log display the output of the CSW server in response to the Delete request. | |
Transaction: Update | csw_14.xml, csw_15.xml, csw_16.xml, csw_17.xml, csw_26.xml, csw_27.xml, csw_29.xml, csw_31.xml, and csw_33.xml are examples of Updating a record instance. | csw_14.log, csw_15.log, csw_16.log, csw_17.log, csw_26.log, csw_27.log, csw_29.log, csw_31.log, and csw_33.log display the output of the CSW server in response to the Update request. |
In the table below, examine csw_08.xml and its corresponding output, csw_08.log. The input files are shipped inside wsclient.jar. All output files are generated in the $CLIENT_HOME/src/data directory when you ran the demo. If you want to examine other inputs and its corresponding outputs, you can access them in the $CLIENT_HOME/src/data directory.
1. |
Examine the csw_08.xml input file. As mentioned, csw_08.xml is an example of the GetRecordById request.
|
|
2. |
The corresponding output file, the csw_08.log file is shown below:
|
1. |
To drop the CSW record type (java
oracle.spatial.ws.admindemo.CSWAdminDemo cd $CLIENT_HOME/src ./compileAndRunClient.sh runcswdt
|
|
2. |
Stop the OC4J server. Enter the following commands. cd <Jdev directory>\bin ./oc4j -shutdown -port 23791 -password admin
|
Perform the following steps:
Update and Run the olscreate.sql Script | ||
Compile and Run Code | ||
Run the OpenLS SQL Demos |
Update and Run the olscreate.sql Script
1. |
Locate the following files: - src/sql/olslocut.dmp Edit olscreate.sql. Enter the following commands: cd $CLIENT_HOME/src/sql gedit olscreate.sql
|
|
2. |
In the olscreate.sql file, change several occurrences of "connect user/password" to specify a desired username and password. For this tutorial, change the system and mdsys password to oracle. Note: For Presentation Service and Route Service the insert(...) and assign_acl(...) statements need to be updated to point to the correct Route Server, and MapViewer URLs. If you have access to an Oracle Location Service, you can set up and access these URLs and then run the OpenLS SQL demos for the Presentation service and Route Service demos. Oracle Location Service will provide capability to process Routing and Mapping requests. For more details about Oracle Route Server, refer to the chapter on Routing Engine in the Oracle Spatial Developer's Guide. For more details about Oracle MapViewer, click the following link: http://www.oracle.com/technology/software/products/mapviewer/index.html If you don't have access to Oracle Location Service, you cannot run the OpenLS SQL demos for Presentation Service and Route Service. So you need not make any changes to the insert into and assign_acl statements mentioned below. But you can still run the OpenLS SQL demos for Directory service, and Geocoding service. Change the following: Server URL definitions in statements that INSERT INTO the mdsys.OpenLSServices table: For Location Utility Service and Directory Service, you can keep the URL as http:localhost. For Presentation Service and Route Service, the URL should point to the correct Route Server and MapViewer URLs. Therefore, change it only if you have access to Oracle Location Service. In dbms_network_acl_admin.drop_acl('xxx.xml'), you can leave it as is for this tutorial. Change the URL in access control list (ACL) definitions (the assign_acl statement)) to the URLs you chose in the INSERT INTO statements for the Presentation Service and Route Service. Change this only if you have access to Oracle Location Service.
|
|
3. |
In SQL*Plus, run the olscreate.sql script. sqlplus / as sysdba
@olscreate.sql
The screenshot shows only a part of the output.
Quit SQL*Plus.
|
1. |
In the $CLIENT_DIR/src/oracle/spatial/ws/svrproxy/Test.java file, do the following: Change the URL (localhost, port) in: myPort.setEndpoint("http://localhost:8888/SpatialWS-SpatialWS-context-root/SpatialWSSoapHttpPort"); Note: For the tutorial, you may keep it as "localhost:8888". Edit occurrences of the following to specify an appropriate username and password: myPort.setUsername(user); Because you have already created users SpatialWsUser0 ... SpatialWsUser3, you might not need to make any changes. Also, note that some of the tests perform loops, for performance measurements. |
The OpenLS-based demo presents the processing of the following OpenLS request types:
GeocodeRequest | ||
PortrayMapRequest | ||
DetermineRouteRequest | ||
DirectoryRequest |
When you compile and run the OpenLS Java demo, it makes a SOAP call to execute Directory Service requests, and generates Directory Service responses.
Perform the following steps to run the OpenLS demo.
1. |
In a new terminal window, start the OC4J server. Enter the following commands: cd <jdevhome directory>/bin ./oc4j -start |
|
2. |
Compile and run code. For a sample YP request (Linux systems): cd $CLIENT_HOME/src
./compileAndRunClient.sh runyp
The following screenshot shows only a part of the output.
|
For OpenLS, there is a SQL interface as well as a SOAP interface (which has already been demonstrated in the previous steps).
The input files are olsloc_01.sql, olsdir_02.sql, olsdir_03.sql, and so on until olsdir_11.sql, olsmap_02.sql, olsmap_03.sql, and olsroute_01.sql. The input files are included in the wsclient.jar file and can be accessed from the $CLIENT_HOME/src/data folder. The outputs can be generated as the corresponding log files (olsloc_01.log, olsdir_02.log, olsdir_03.log, and so on until olsdir_11.log, olsmap_02.log, olsmap_03.log, and olsroute_01.log) by executing SQL*Plus from $CLIENT_HOME/src/data.
The input/output file contents as per the OpenLS request types are described below:
Input | Output | ||
GeocodeRequest | olsloc_01.sql
is an example that requests from Geocode two addresses in San Francisco. |
olsloc_01.log is the response containing the geocoded latitude/longitude along with the address. | |
PortrayMapRequest |
olsmap_02.sql and
olsmap_03.sql are examples to request maps, by size and file format,
for bounding boxes or center point Note: In order to execute these inputs |
olsmap_02.log and olsmap_03.log are responses to the map requests. | |
DetermineRouteRequest |
olsroute_01.sql is an
example request for a route, including route geometry, between two addresses.
Based on the route geometry, directory requests can be performed, subsequently. Note: In order to execute these inputs |
olsroute_01.log is the response to the route request. | |
DirectoryRequest |
olsdir_02.sql, olsdir_03.sql,
and olsdir_04.sql are examples
of querying businesses/points of interest within a country, state, city,
olsdir_05.sql, olsdir_06.sql,
olsdir_07.sql, olsdir_08.sql,
olsdir_09.sql, and
olsdir_11.sql are examples that add categorization
|
olsdir_02.log, olsdir_03.log, and olsdir_04.log display a list of businesses satisfying the query criteria.
olsdir_05.log, olsdir_06.log, olsdir_07.log, olsdir_08.log, olsdir_09.log, and olsdir_11.log display a list of businesses satisfying the query criteria. olsdir_10.log displays list of businesses satisfying the query criteria. |
To generate olsloc_01.log and olsmap_02.log files, perform the following:
1. |
Enter the following commands: cd $CLIENT_HOME/src/data sqlplus mdsys/oracle spool olsloc_01.log @olsloc_01.sql spool off As mentioned in the table above, olsloc_01.sql is an example that requests from Geocode two addresses in San Francisco. You can view the spooled output log file, olsloc_01.log, from the $CLIENT_HOME/src/data directory. The screenshot shows only a part of the output.
|
|
2. |
Similarly, you can run olsmap_02.sql, which is an example of the PortrayMapRequest request type. You can run this only if you have access to Oracle Location Service and you provided its URL in the olscreate.sql script. The screenshot shows the content of the olsmap_02.log file. Similarly, you can run all the other input SQL files such as olsroute_01.sql (only if you have access to Oracle Location Service), or olsdir_03.sql files and generate the corresponding output files.
|
|
3. |
Stop the OC4J server. Enter the following commands: cd <Jdev directory>\bin ./oc4j -shutdown -port 23791 -password admin
|
In this tutorial, you learned how to:
Run the Web Feature Service (WFS) Demos | ||
Run the Catalog Services for the Web (CSW) Demos | ||
Run the Open Location Services (OpenLS) Demos |