Hoppa till huvudinnehållet

workflows with python

Kommentarer

1 kommentar

  • Permanently deleted user
    My solution to a similar issue was to run the workflow from the REST endpoint, then monitor to the network traffic using Chrome Developer Tools and see how the inargs were being passed in the request. Here are my input arguments:

     

    Input Arguments

     

    And here is how they were being passed in the request: inargs=%5B%0D%0A++%7B%0D%0A++++%22isRequired%22%3A+false%2C%0D%0A++++%22name%22%3A+%22minX%22%2C%0D%0A++++%22typeName%22%3A+%22System.Double%2C+mscorlib%22%2C%0D%0A++++%22runtimeTypeName%22%3A+%22System.Double%2C+mscorlib%22%2C%0D%0A++++%22value%22%3A+122%0D%0A++%7D%2C%0D%0A++%7B%0D%0A++++%22isRequired%22%3A+false%2C%0D%0A++++%22name%22%3A+%22minY%22%2C%0D%0A++++%22typeName%22%3A+%22System.Double%2C+mscorlib%22%2C%0D%0A++++%22runtimeTypeName%22%3A+%22System.Double%2C+mscorlib%22%2C%0D%0A++++%22value%22%3A+-18%0D%0A++%7D%2C%0D%0A++%7B%0D%0A++++%22isRequired%22%3A+false%2C%0D%0A++++%22name%22%3A+%22maxX%22%2C%0D%0A++++%22typeName%22%3A+%22System.Double%2C+mscorlib%22%2C%0D%0A++++%22runtimeTypeName%22%3A+%22System.Double%2C+mscorlib%22%2C%0D%0A++++%22value%22%3A+123%0D%0A++%7D%2C%0D%0A++%7B%0D%0A++++%22isRequired%22%3A+false%2C%0D%0A++++%22name%22%3A+%22maxY%22%2C%0D%0A++++%22typeName%22%3A+%22System.Double%2C+mscorlib%22%2C%0D%0A++++%22runtimeTypeName%22%3A+%22System.Double%2C+mscorlib%22%2C%0D%0A++++%22value%22%3A+-17%0D%0A++%7D%0D%0A%5D&workflow=&f=pjson&ReadyToRun=1 I got rid of the "+" characters, then swapped out the hard coded coordinate values for placeholders. I then appended the inargs to the end of my workflow URL to form my request URL: from urllib2 import urlopen import json def get_jsonparsed_data(url): response = urlopen(url) data = response.read().decode("utf-8") return json.loads(data) minX = 122 maxX = 123 minY = -18 maxY = -17 url = ("http://GeoServer.au/Geocortex/Essentials/REST/" "sites/Dev/workflows/Report/run?inargs=%5B%0D%0A%7B%0D%0A%22" "isRequired%22%3Afalse%2C%0D%0A%22name%22%3A%22minX%22%2C%0D%0A%22" "typeName%22%3A%22System.Double%2Cmscorlib%22%2C%0D%0A%22" "runtimeTypeName%22%3A%22System.Double%2Cmscorlib%22%2C%0D%0A%22" "value%22%3A<b>{minX}</b>%0D%0A%7D%2C%0D%0A%7B%0D%0A%22" "isRequired%22%3Afalse%2C%0D%0A%22name%22%3A%22minY%22%2C%0D%0A%22" "typeName%22%3A%22System.Double%2Cmscorlib%22%2C%0D%0A%22" "runtimeTypeName%22%3A%22System.Double%2Cmscorlib%22%2C%0D%0A%22" "value%22%3A<b>{minY}</b>%0D%0A%7D%2C%0D%0A%7B%0D%0A%22" "isRequired%22%3Afalse%2C%0D%0A%22name%22%3A%22maxX%22%2C%0D%0A%22" "typeName%22%3A%22System.Double%2Cmscorlib%22%2C%0D%0A%22" "runtimeTypeName%22%3A%22System.Double%2Cmscorlib%22%2C%0D%0A%22" "value%22%3A<b>{maxX}</b>%0D%0A%7D%2C%0D%0A%7B%0D%0A%22" "isRequired%22%3Afalse%2C%0D%0A%22name%22%3A%22maxY%22%2C%0D%0A%22" "typeName%22%3A%22System.Double%2Cmscorlib%22%2C%0D%0A%22" "runtimeTypeName%22%3A%22System.Double%2Cmscorlib%22%2C%0D%0A%22" "value%22%3A<b>{maxY}</b>%0D%0A%7D%0D%0A%5D&workflow=&f=json&ReadyToRun=1" ).format(minX=minX, minY=minY, maxX=maxX, maxY=maxY) print(get_jsonparsed_data(url))

     

    Hope this helps someone.

     

     
    0

Du måste logga in om du vill lämna en kommentar.