Running Oracle Spatial Web Services

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:

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.

Back to Topic List

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.

 

Back to Topic

Create the Feature Type

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

 

Back to Topic

Run the WFS Relational Demo

The WFS relational-based demo presents the processing of the following WFS request types, for the relational-based feature type:

 
 
 

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
./compileAndRunClient.sh runwfsrel

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.

 

Back to Topic

View the Request and Response XML Examples

The input/output file contents as per the feature type are described below:

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:

 

Back to Topic

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:

 
 
 

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.

 

Back to Topic

View the Request and Response XML Examples

The input/output file contents as per the feature type are described below:

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.

 

Back to Topic

Drop the Feature Types

1.

To drop the relational feature type, enter the following commands:

cd $CLIENT_DIR/src/sql
sqlplus / AS SYSDBA

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
./compileAndRunClient.sh runwfsdt

 

3.

Stop the OC4J server. Enter the following commands:

cd <Jdev directory>/bin
./oc4j -shutdown -port 23791 -password admin

 

Back to Topic

Perform the following steps:

Back to Topic List

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.sql
The 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       

 

Back to Topic

Run the CSW Demo

The CSW demo presents the processing of the following CSW request types:

 
 
 

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

 

Back to Topic

View the Request and Response XML Examples

The input/output file contents as per the CSW request types are described below:

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:

 

Back to Topic

Drop the Record Types

1.

To drop the CSW record type (java oracle.spatial.ws.admindemo.CSWAdminDemo
dropRecordType
), enter the following commands (where $CLIENT_DIR is the client directory that has this demo's src/ content):

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

 

Back to Topic

Back to Topic List

Perform the following steps:

Back to Topic List

Update and Run the olscreate.sql Script

1.

Locate the following files:

- src/sql/olslocut.dmp
- src/sql/olscreate.sql

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.

 

Back to Topic

Update the test.java File

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);
myPort.setPassword("welcome");

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.

Back to Topic

Compile and Run Code

The OpenLS-based demo presents the processing of the following OpenLS request types:

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.

 

Back to Topic

Run the OpenLS SQL Demos

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:

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

 

Back to Topic

Back to Topic List

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

Back to Topic List

Move your mouse over this icon to hide all screenshots.