Tutorial: Publishing additional services for printing
There may be occasions when you need to publish additional services for web printing, beyond the PrintingTools service included with ArcGIS for Server. For example, you could create a new service and configure it to point at your own folder of map layouts. Or you could publish one freely available service while making a more advanced service available for a fee.
To make your own service for printing, you need to publish a geoprocessing service with the Export Web Map tool. This tutorial will guide you through the process.
Registering your layout templates folder with ArcGIS for Server
During this tutorial, you will work with a folder of ArcMap documents (MXDs) that you have prepared with different layouts to be used for web map printing. This is your layout templates folder.
If your layout templates folder is currently on the server or accessible by the server, you should register the folder with ArcGIS for Server. See Registering your data with ArcGIS Server using ArcGIS for Desktop to learn how to register a folder with the server.
If you cannot get your layout templates folder onto the server or into a location accessible by the server, do nothing. The layout templates folder will be copied to the server at the time you publish the service, thereby ensuring the server can see the folder. Although this option is easier to configure, it takes more steps to update your layout templates in the future.
Preparing and publishing the service
The first step in publishing is to run the Export Web Map tool with the default values you want for your service. You will then publish the tool result as a geoprocessing service.
- In ArcCatalog or the Catalog window in ArcMap, navigate to Toolboxes > System Toolboxes > Server Tools > Printing.
- Double-click the Export Web Map tool to open it.
- Leave the Web Map as JSON parameter blank.
To get printable images, users of this service will submit their own web map JSON for this parameter. The printing widgets in the ArcGIS web APIs do the work of generating this JSON behind the scenes.
- Leave the default for the Output File parameter. Once you publish this tool to the server, the output will be placed in the server jobs directory.
- Supply the Layout Templates Folder parameter by clicking the browse button and browsing to the folder where your layouts are stored.
If you just want to reference the basic layouts installed with ArcGIS for Server, browse to . Do not leave this parameter blank.
- Optionally, set the Layout Template parameter by choosing one of the layouts from the drop-down list. This will be the default layout when users run your service.
- Click OK to run the tool.
- Click Geoprocessing > Results to display the Results window.
- Expand Current Session, right-click the ExportWebMap result you just got, and click Share As > Geoprocessing Service.
- Choose Publish a service and click Next.
- Choose a connection to ArcGIS Server (or click the button to add a new one), and give your service a name. Then click Next.
- Choose the folder where this service will reside. You cannot publish into the existing System or Utilities folders. You must use your own folder or the root folder.
When you have finished selecting a folder, click Continue.
You are now viewing the Service Editor where you can do more preparatory work before publishing, such as setting available parameter choices for your service.
- Click Parameters and ensure the Execution Mode of the service is set to Synchronous. You can alternatively choose Asynchronous if you expect the requests to take more than a few seconds.
- On Service Editor, find the left panel where each tool parameter is listed (Web Map as JSON, Output File, Format, Layout Templates Folder, and Layout Template). Click each of these parameters and examine the defaults that are set. If you want to change the defaults, you need to go back to the Export Web Map tool dialog box and set the values there, as you did in the previous steps in this tutorial.
Due to a known limitation with the Export Web Map tool in 10.1, you cannot filter the parameter choices available to end users.
You can hide a parameter completely from end users and force them to use the default by setting the parameter's Input mode to Constant value.
- Use the Service Editor to set any other properties that you want for your service, such as the minimum and maximum number of instances that are allowed to run per machine.
- Click Publish to publish your service.
If you receive a warning about data being copied to the server, click OK. This just copies the default output image, which is not a significant amount of data.
- Verify that your service published correctly by browsing to it in Manager or the Services Directory.
Your new service can now be referenced in the printing widgets offered by the ArcGIS web APIs.
Updating the layout templates
If you want to update the layouts in your layout templates folder, the appropriate workflow is determined by whether you registered the layout templates folder with the server before publishing (see the previous section "Registering your layout templates with ArcGIS Server").
Updating the layout templates folder if you registered it with ArcGIS Server
If you registered your layout templates folder with the server, this means the server can see your layouts. Simply make updates to the MXDs in the folder and your new layouts will be immediately available.
Updating the layout templates folder if you did not register it with ArcGIS Server
If you did not register your layout templates folder with the server, the layouts were copied to the server at the time of publishing. You need to perform a service overwrite to update the templates on the server. Follow these steps to do the overwrite:
- In ArcMap, open the Export Web Map tool and run it using your desired default values as described in the previous section.
- Right-click the geoprocessing result and choose Share As > Geoprocessing Service.
- Choose the option Overwrite an existing service and click Next.
- Click the name of the service you want to overwrite and click Continue.
- On the Service Editor, verify that all the service properties are set to your liking (they should default to the properties you chose when you originally published the service). Then click Publish.
The options you choose overwrite all options set during the first publishing. The layout templates folder (including your updates) are copied to the server and replace the layout templates folder that was put there when you published the service originally.