ConvertWebMapToMapDocument Python Script With Secure Map Services

Discussion created by shaun_weston-eagle-co-nz-esridist on Mar 21, 2013
Latest reply on Nov 6, 2013 by MayMay
I've developed a python script for use in a web application, which works fine for public services, but does not work with secure services. I've setup some code in the script to hopefully handle secure services:

serverConnection is a variable, which holds the path to a user connection to the arcgis server
server = {}
server['SERVER_CONNECTION_FILE'] = serverConnection
result = arcpy.mapping.ConvertWebMapToMapDocument(webmapJSON, templateMxd, extra_conversion_options=server)

So I can publish it to server and print public map services, but secure services come back with this:

Unable to connect to map server at  ..."},{"type":"esriJobMessageTypeInformative","description":"Layer \"Licences\": Unable to connect to map server at"},{"

o I've setup the tokens to pass in a flex app and the tokens are HTTP Referrer (in fact I've tried lots of different token options but nothing works!). Why does it have this error?