bb1769

GP service input parameter converted from string to integer when called from browser

Discussion created by bb1769 on Nov 7, 2012
Latest reply on Apr 6, 2016 by akk602dev
I have a 10.1 GP service task based on a Python script. At the top of the script I grab the input parameters, e.g.,

myId = arcpy.GetParameterAsText(0)
myId2 = arcpy.GetParameterAsText(1)

The parameters are all defined as String type in the Properties of the script within the ArcGIS toolbox. The second parameter has a format along the lines of 01207.000. We need this full string including leading zeroes and trailing digits.

When I use ArcMap/Catalog to run this GP service task, the parameters get read correctly and the script runs fine. However, when I run this task from the Services Directory, the second parameter has its format converted to 1207, i.e., leading and trailing zeroes are dropped, as if it's been parsed to an integer. This happens even when running the task from a browser on the server using port 6080.

I have used a packet sniffer (Wireshark) to confirm that the full format is being sent to the server. And in the script I've used arcpy.AddMessage to display the value as read by the script. In the Services Directory case that shows it is receiving the parameter in integer format.

Is there some reason the value would be getting converted between the browser and the script?

Outcomes