• No results found

Learning More About the Web Services

In document Spectrum Technology Platform (Page 31-39)

The Map Tiling Service allows the hosting of multiple maps that can be used to generate the tiles. These named maps are located in one or more map repositories. Each map hosted by the Map Tiling Service can have a specific configuration that defines how the map will be used to create tiles.

The built-in pluggable caching mechanism is an important feature of the Map Tiling Service. When this caching is turned on, tiles are stored so serving of tiles to the client is both faster and less resource in- tensive. This also allows the pregeneration of tiles and pointing the Map Tiling Service to this cache.

Service URLs

The URL endpoint for the Map Tiling Service has the following general form: http://hostname[:portnumber]/rest/Spatial/MapTilingService

Documentation

To see the full documentation for the Map Tiling Service, refer to theMap Tiling Serviceguide. To walk through the steps for creating and using map tiles, seeMap Tilingin the How Do I? section.

Mapping Service

Description

The Mapping Service provides a simplified interface to perform Mapping Service rendering, themes, overlays, and conversions. The Mapping Service provides both simple operations that are more frequently used, or more complex operations that require higher levels of customization.

The Mapping Service provides operations that:

• list and get all maps, layers, styles, or tables in the repository

• conversion methods between real world coordinates, XY, and screen coordinates • screen calculations such as length

• navigation methods such as zoom, and pan • render maps and layers

• overlay, override, and theme maps

• customize your map with legends, watermarks, and other adornments.

In the past, mapping required the use of many map layers and map definitions to access data. With the addition of the table model and repository, data access and mapping is independent. The tables define the data access, and the repository takes care of the table management. Therefore, with the Mapping Service, you are able to render maps and perform mapping operations without the worry of where the data is located.

Service URLs

The URL endpoint for the REST implementation of the Mapping Service has the following general form: http://hostname[:portnumber]/rest/Spatial/MappingService

The URL endpoint for the SOAP implementation of the Mapping Service has the following general form: http://hostname[:portnumber]/soap/MappingService

The URL for the Mapping Service WSDL document has the following general form: http://hostname[:portnumber]/soap/MappingService?wsdl

The URL for the Mapping Service demo page has the following general form:

http://hostname[:portnumber]/Spatial/MappingService/DemoPage.html

Documentation

To see the full documentation for the SOAP implementation of the Mapping Service, refer to theMapping Service Reference.

To see the full documentation for the REST implementation of the Mapping Service, refer to theREST Interfacesguide.

Named Resource Service

Description

The Named Resource Service provides the ability to work with resources in the repository. It provides a set of common operations that you can use to add, list, update, delete, and search resources in the repository. The advantage of this is that you can administer the repositories resources at the service level, with a simple SOAP API that allows you to manage your content.

The Named Resource Service provides operations that:

• list all resources (or a subset) in the repository • add a resource to the repository

• modify a resource that exists in the repository • delete a resource from the repository

• read a resource from the repository to return the definition • search for resources in the repository

Service URLs

The URL endpoint for the Named Resource Service has the following general form: http://hostname[:portnumber]/soap/NamedResourceService

The URL for the Named Resource Service WSDL document has the following general form: http://hostname[:portnumber]/soap/NamedResourceService?wsdl

The URL for the Named Resource Service demo page has the following general form:

http://hostname[:portnumber]/Spatial/NamedResourceService/DemoPage.html

33 Getting Started Guide

Documentation

To see the full documentation for the Named Resource Service, refer to theNamed Resource Service Reference.

User Management Service

Description

The User Management Service provides a simplified interface to manage security for the repository, fo- cused on how to restrict who can access the resources in the repository. Setting security allows you to expose or restrict different resources (subsets of your data and resources) to different users or depart- ments. To enforce this, security has been added to Spectrum™Technology Platform that allows you to specify which users get to see what resources.

The Location Intelligence Module repository security is managed using an internal ACL (Access Control List). This allows you to specify which users are granted access to resources, as well as what operations are allowed on given resources. The operations for repository user management are performed using the User Management SOAP interface.

Service URLs

The URL endpoint for the User Management Service has the following general form: http://hostname[:portnumber]/soap/UserManagementService

The URL for the User Management Service WSDL document has the following general form: http://hostname[:portnumber]/soap/UserManagementService?wsdl

The URL for the User Management Service demo page has the following general form:

http://hostname[:portnumber]/Spatial/UserManagementService/DemoPage.html

Documentation

To see the full documentation for the User Management Service, refer to theUser Management Guide.

Catalog Service for the Web

Description

The Catalog Service for the Web (CSW) provides the ability to search, retrieve, and update collections of descriptive information (metadata) about geospatial data, services, and related resources. Catalogs are used to register metadata that conform to a specific information model or standard. You then have the ability to search for geospatial data and services in very efficient ways.

The CSW provides operations that: User Management Service

• describe the service capabilities

• describe the information models (schema) supported by the catalog • search within the catalog

• get records based on a particular ID • insert, update, or delete catalog entries • batch retrieval and conversion of metadata

The Catalog Service for the Web is anOGC-compliant web service.

Service URLs

The URL endpoint for the POST/GET implementation of the Catalog Service for the Web has the following general form:

http://hostname[:portnumber]/rest/Spatial/CSW

The URL endpoint for the SOAP implementation of the Catalog Service for the Web has the following general form:

http://hostname[:portnumber]/soap/CSWService

The URL for the Catalog Service for the Web WSDL document has the following general form: http://hostname[:portnumber]/soap/CSWService?wsdl

The URL for the Catalog Service for the Web demo page has the following general form: http://hostname[:portnumber]/Spatial/CSWService/DemoPage.html

Documentation

To see the full documentation for the Catalog Service for the Web, refer to theCatalog Service for the Web Reference Guide.

Web Feature Service

Description

The Web Feature Service is used for searching, obtaining metadata descriptions, querying, and filtering spatial data (feature types) at the service level. The XML interface and syntax follow the WFS 1.0.0 OGC specification. Both SOAP and HTTP POST/GET requests are supported. As a result, a standard compliant WFS client, such as MapInfo Professional, can access data by submitting an XML request through HTTP to display it on a map or to get vector geometries for calculations.

Use the Web Feature Service to help perform a search for features within a given distance from a point (or other type of geometry). For example, a real estate application determines a realistic value for a home by comparing the distance of it to numerous features, including railroad tracks, highways, shopping malls, and police stations. This application would call WFS to select a highway feature and a home (a point). The application would then calculate distance values for proprietary rating calculations. The Web Feature Service is anOGC-compliant web service.

35 Getting Started Guide

Service URLs

The URL endpoint for the Web Feature Service has the following general form: http://hostname[:portnumber]/rest/Spatial/WFS

Documentation

To see the full documentation for the Web Feature Service, refer to theWeb Feature Serviceguide.

Web Map Service

Description

The Web Map Service (WMS) allows software clients to reference map images over the Internet or a private intranet. The WMS implementation is based on the WMS 1.1.1 and 1.3.0 OGC specification. Using HTTP requests, the WMS provides georeferenced data to a client that displays this data as an image. Georeferenced data is information associated with maps that describe the real world extents of specific features and the projection upon which it is based.

The images can be provided as GIF, JPEG, PNG, and other image formats. The Web Map Service is anOGC-compliant web service.

Service URLs

The URL endpoint for the Web Map Service has the following general form: http://hostname[:portnumber]/rest/Spatial/WMS

Documentation

To see the full documentation for the Web Map Service, refer to theWeb Map Serviceguide. Web Map Service

7

Sample Applications

In this section we're going to bring together the concepts discussed in the previous sections to create both REST and SOAP client applications.

In this section:

REST Samples . . . .38

REST Samples

This section provides examples that show you how to make REST requests from client applications.

List the Named Tiles In the Repository

This web page uses a JavaScript call to the Map Tiling Service's REST interface to list the named tiles in the repository. The list of named tiles that is returned in the response is then displayed in a JavaScript alert box.

Here is the code:

<html> <body>

<script type="text/javascript"> function submitform() {

//Create an XMLHttpRequest object or try ActiveX var req;

if (typeof XMLHttpRequest != "undefined") {

req = new XMLHttpRequest(); }

else {

try {

req = new ActiveXObject("Msxml2.XMLHTTP"); }

catch (e) {

req = new ActiveXObject("Microsoft.XHTTP"); }

}

// populate the request, username and password

var reqString = document.getElementById('request').value; var userName = document.getElementById('user').value; var password = document.getElementById('password').value;

//Execute the REST request against a server secured with Basic Authentication

req.open("GET", reqString, false, userName, password); req.send();

//Display the response resp = req.response; alert(resp);

} </script>

<form action="javascript: submitform()">

User: <input type="text" name="User" id="user" value="admin"/> &nbsp; Password: <input type="password" name="Password" id="password" value="admin"/><br />

Request: <input type="text" name="request" id="request"

value="http://MyServer:8080/rest/Spatial/MapTilingService/mapList.json"/><br />

<input type="submit" value="Submit" /> </form>

</body> </html>

List the Named Maps In the Repository

This Java application calls the Mapping Service's REST interface to list the named maps in the repository. The list of named maps that is returned in the response is then output at the command line.

Here is the code:

public static void main(String[] args) {

java.io.InputStream is = null;

try {

// Create the REST request URL

String serverUrl = "http://MyServer:8080/rest/Spatial/MappingSer- vice/maps.json";

java.net.URL url = new java.net.URL(serverUrl);

java.net.HttpURLConnection conn = (java.net.HttpURLConnection)url.open- Connection();

String user = "user"; String password = "pass";

// Credentials need to be a base64 encoded string of the nature "user:pass"

String credentials = user + ":" + password;

byte[] encodedBytes = org.apache.commons.codec.binary.Base64.encode-

Base64(credentials.getBytes());

String base64EncodedString = new String(encodedBytes);

// Apply the authorization header - a string of nature "Basic <base64EncodedCredentialsString>"

String authHeader = "Basic" + " " + base64EncodedString; conn.addRequestProperty("Authorization", authHeader);

// Get response for the request is = conn.getInputStream();

java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutput- Stream();

org.apache.commons.io.IOUtils.copy(is, bos); is.close();

// Display the response

System.out.println(new String(bos.toByteArray())); } catch (Exception e) { System.out.println(e.getMessage()); 39 Getting Started Guide

In document Spectrum Technology Platform (Page 31-39)

Related documents