Tutorial: Publishing a WPS service
The Open Geospatial Consortium, Inc. (OGC), Web Processing Service (WPS) specification is an international specification for serving and executing geospatial processing on the web. When a geoprocessing service is published with WPS capabilities, the data can be accessed by any client that supports WPS. If you're new to WPS and want to learn more about it before attempting this tutorial, see WPS services.
This tutorial walks you through the process of publishing a geoprocessing service to ArcGIS Server that can be accessed by WPS clients. To do this, you'll need to prepare a tool in ArcGIS for Desktop, run the tool and obtain a successful result, and then publish the geoprocessing result with the WPS capability enabled.
Before beginning this tutorial
If you've just installed ArcGIS Server, you need to complete some preparatory steps before you can connect to the server in ArcMap and publish services:
- For details on how to configure your ArcGIS Server site, see the Getting started after install section of this help system.
- To learn how to make the data referenced by your GIS resource available to the server, see the topic Making your data accessible to ArcGIS Server.
Preparing the geoprocessing tool in ArcGIS for Desktop
A geoprocessing service contains one or more tasks. A task is really no different than a geoprocessing tool in that it accepts parameters and returns results; it is a term that clients of ArcGIS Server use to describe routines that do work on a server and return results. For example, you might create a geoprocessing tool that delineates watersheds based on land-use and elevation data. This tool could then be published with the WPS capability enabled and consumed as a task in a WPS-compliant application on the web.
The topic Authoring geoprocessing tasks with ModelBuilder can help guide you through the items you should consider when you create your geoprocessing tool. Once you have a geoprocessing tool ready, move on to the next section.
Running the tool
Before you can publish, you'll need to execute the tool and obtain a successful geoprocessing result in the Results window. To do so, follow these steps:
- In the Catalog tree, double-click your geoprocessing tool.
- Enter the appropriate variables and click OK.
When the tool executes successfully, the Results window appears.
Publishing the result
With a successful geoprocessing result inside the Results window, you can now publish your geoprocessing tool as a geoprocessing service. During this process, you'll enable the WPS capability, which will make your geoprocessing service (and subsequent tasks) OGC WPS compliant.
- Right-click your geoprocessing result and choose Share As > Geoprocessing Service.
- In the Share as Service window, choose Publish a service. Click Next.
- In the Publish a Service dialog box, click Connect To ArcGIS Server to create a new connection to the server.
- In the Add ArcGIS Server window, choose Publish GIS Services. Click Next.
- For the Server URL, type the URL of the ArcGIS Server site you want to connect to. For example, http://myserver:6080/arcgis.
- From the Server Type drop-down list, choose ArcGIS Server.
- During the publishing process, a service definition file is created and temporarily stored locally on disk. When the publishing process completes, the service definition is uploaded to the server and the local file is deleted. For the purposes of this tutorial, accept the default staging folder and continue.
- If your server administrator has enabled security for your site, enter your User Name and Password. Click Finish.
- Optionally, in the Publish a Service window, enter a new name for the service. The name cannot be more than 120 characters long and may contain only alphanumeric characters and underscores. Click Next.
- By default, services are published to the root folder (root) of ArcGIS Server. Services can be organized into subfolders under the root folder. Choose the folder where you want to publish the service, or create a new folder to contain the service. Click Continue.
- The Service Editor displays. You'll use the Service Editor to choose what users can do with your geoprocessing service and take fine-grained control of how the server will expose your geoprocessing service. Click the Capabilities tab.
- By default, geoprocessing is enabled. Select WPS.
- In the left pane of the Service Editor, click WPS. Use this panel to choose how to configure the properties of your WPS service. By providing WPS service properties, clients can gain a better understanding of the service publisher.
- The URL field displays the URL clients use to access the WPS service. The URL will be formatted as follows: http://<server name>:<port number>/arcgis/services/<folder name (if applicable)>/<service name>/GPServer/WPSServer.Note:
Copy and save the WPS service URL. You will need it to perform additional steps in this tutorial.
- If you want to configure a WPS service with system-generated capabilities files, use the default Enter service properties below option. The Name, Title, and OnlineResource fields are automatically populated and should not be modified. Optionally, you can populate additional properties using the fields in the list. For more information, see Available WPS service properties.
- If you want to configure a WPS service to use external capabilities files, choose Use external capabilities files. To use this option, you must have already created a WPS capabilities file.
- Namespace and Prefix are unique properties that are used to differentiate your WPS processes from other WPS processes. These are populated automatically and should not be modified.
Tip:For tips and best practices on how to set geoprocessing service properties using the Service Editor, see geoprocessing service settings. For information on how to best configure your services for deployment, see Tuning and configuring services.
- The URL field displays the URL clients use to access the WPS service. The URL will be formatted as follows: http://<server name>:<port number>/arcgis/services/<folder name (if applicable)>/<service name>/GPServer/WPSServer.
- Click Analyze . This examines your result to see if it can be published as a WPS service to the server.Tip:
To give yourself more viewing area when configuring your WPS service, click the Collapse button at the top of the Service Editor.
- Fix any Errors in the Prepare window; this must be done before you can publish your result as a WPS service. Optionally, you can fix the warnings and informational messages to further improve the performance and appearance of your service. For more information about resolving these issues, see Analyzing your GIS resource.Note:
You can register folders and geodatabases with your ArcGIS Server site, thus ensuring that the server can recognize and use your data. If you proceed with the following steps, any data referenced by your tool originating from an unregistered folder or geodatabase will be copied to the server at the time that you publish. This is a precautionary measure to ensure that the server can access all the data used by the service. For full instructions on registering a folder or geodatabase with your ArcGIS Server site, see Registering your data with ArcGIS Server using ArcGIS for Desktop.
- Optionally, in the Service Editor, click Preview . This can give you an idea of how your tool dialog box will appear when viewed on the web.
- Once you've fixed the errors in your geoprocessing model, click Publish .
Consuming the WPS service
Once you have published a WPS service, it can be used in any client that supports WPS 1.0.0. A web browser is one of the simplest clients of a WPS service. You can request information through HTTP, and the responses or exceptions are returned through the browser.
Follow these steps to access WPS services through a web browser:
- Open a web browser.
- Perform the GetCapabilities and DescribeProcess requests as indicated in the following sections.
GetCapabilities
This request returns all metadata and processes available through the service in GML format. To use the GetCapabilities operation, copy and paste the WPS service URL into the address bar and add ?SERVICE=WPS&VERSION=1.0.0&REQUEST=GetCapabilities to the end of the URL.
URL example: http://myserver:6080/arcgis/services/my_wps/GPServer/WPSServer?SERVICE=WPS&VERSION=1.0.0&REQUEST=GetCapabilities
DescribeProcess
The response to a DescribeProcess request contains detailed information for a particular process offering, which basically describes the unique identifier of the process and the identifier, type, and schema of each mandatory or optional input/output parameter for the process. This information is necessary for a WPS client to issue subsequent Execute requests to do the actual geospatial processing. To use the DescribeProcess operation, copy and paste the WPS service URL into the address bar and add ?SERVICE=WPS&VERSION=1.0.0&REQUEST=DescribeProcess to the end of the URL.
URL example: http://myserver:6080/arcgis/services/my_wps/GPServer/WPSServer?SERVICE=WPS&VERSION=1.0.0&REQUEST=DescribeProcess&Identifier=output_feature_layer
Executing a WPS service process
To perform geospatial processing on the web, you can send an Execute request to the WPS service through a WPS client. An Execute request usually carries either the value or reference of each input/output parameter of the WPS process and also specifies how the result of the process should be sent back by the WPS service. The response to an Execute request contains the embedded result of the spatial processing and can be configured to return the results of recent spatial processing jobs.
Execute operations are typically invoked through an HTTP POST request in the WPS client. The following is a sample Execute request:
<wps:Execute xmlns:wps="http://www.opengis.net/wps/1.0.0" service="WPS" version="1.0.0" language="en-US">
<ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">SampleProcessId</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">Input_String</ows:Identifier>
<wps:Data>
<wps:LiteralData dataType="xs:string">abcdefg</wps:LiteralData>
</wps:Data>
</wps:Input>
</wps:DataInputs>
<wps:ResponseForm>
<wps:ResponseDocument storeExecuteResponse="true" lineage="true" status="false">
<wps:Output schema="http://www.w3.org/TR/xmlschema-2/#string" asReference="false">
<ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">Output_String</ows:Identifier>
</wps:Output>
</wps:ResponseDocument>
</wps:ResponseForm>
</wps:Execute>
For more information about WPS request operations and their parameters, see the OGC WPS 1.0.0 specification. Esri also maintains a Standards and Interoperability web page detailing its support for OGC services in ArcGIS.