GetMapServiceInfo doesn't return the correct map service URL due to missing connecting string in site.xml
Hi,
When view Geocotex Site REST API (e.g. http://mydomain/Geocortex/Essentials/REST/sites/TestSite/map/mapservices/1), usually it shows Connection String (and the token URL if AGS token required), just like the first screenshot below. On the same Geocortex server/instance, we have number of sites, most of them did show the connection string, however there’re 2 or 3 sites, in which some map services have the Connection String shown up, some not (as screenshot 2)
And because the connection string is missing, the GetMapServiceInfo widget in workflow didn’t work as expected, the output Map Service URL is the URL of the map service in Geocortex site REST Url, not ArcGIS REST Url. Also the output token is Geocortex token, not ArcGIS REST token. Therefore, I couldn’t use the URL or token in further widget like QueryTask. At the moment I have to hard code all the URL and username/password to the workflow, which I try to avoid.
Also I noticed if I add the same map services with the connection string issue to a new site, the connection string showed all right. I also tried manually add the connection string to the site.xml, it worked fine for a period, but when if I changed anything in the site and save it, the connection string went missing again.
I had this issue since GE4.4 and now we’re on GE4.6.1 but it has not been solved yet. Search around didn’t find any clue. Am I the only one having the problem?? thanks
map service has connection string
_img_ alt="Map Service have connection string" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=90660000000PDix&feoid=Body&refid=0EM60000000HSel" _/_img_
connection string is missing
_img_ alt="User-added image" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=90660000000PDix&feoid=Body&refid=0EM60000000HSeq"_/_img_
0
-
GetMapServiceInfo stopped giving me the Map Service Url after upgrading to 2.7 from 2.5. It started to give me the Geocortex Url instead. So for now I have the map service URL as one of the arguments. It does not do this for all map services. The one that works and the one that does not work are both dynamic map services. 0 -
Hi Masao, sorry to hear you had the same issue but it means I'm not the only one. Yes I could set the URLs in the arguments, but I'm a bit hesitate to hard code or set argument in workflow with AGS username and password as the token genereated from GetMapServiceInfo is also Geocortex token not AGS token when the connection string missing. 0 -
Jack, we are also just experiencing this issue after upgrading from GE 4.2 to 4.5.1 (HTML viewer 2.4 to 2.6.1). Workflows built prior to the upgrade that use this activity work properly, but any new workflows (or workflows modified and saved with new Workflow Designer) return Geocortex Url instead of ArcGIS Url. 0 -
This is the expected behaviour when you configure permissions on layers in your site.
ArcGIS Server does not implement per-layer security so we handle this via the Essentials REST API. Essentials acts as a proxy for the ArcGIS Server service and applies the permission filtering logic to requests. The viewer actually thinks that the Essentials REST API is ArcGIS Server in this case.
The empty connection string is intentional because we don’t actually want/need to tell the viewer where ArcGIS Server is. If you are really securing your layers ArcGIS Server should be behind a firewall and inaccessible to the viewer so there would be no point in telling the viewer what the URL to ArcGIS Server is anyway. There is logic in the viewer to detect the empty connection string and infer that it should use the Essentials URL instead.
The GetMapServiceInfo activity returns the Essentials URL for the map service and the Essentials token when layer security is applied. This should be exactly what you need for the Query Task activity or other logic where you need to issue a request to ArcGIS Server that honours the configured permissions.
--Ryan0 -
Ryan, Thanks for your answer. Eventually I have to come back to the same issue. OK I got what you mean here. The GetMapServiceInfo activty returned me a Essential URL of the map service like https://xxx.com/Geocortex/Essentials/REST/sites/MySite/map/mapservices/61/rest/services/x/MapServer, and a Essential token. Do you mean I then should be able to insert the URL + the native layer ID of the layer I want to query, and the Essential token into QueryTask activty? I've tried that but unformatnly it returns still returns me the same error. Am I missing something?.. 0 -
Hi Jack,
Yes, that is the idea. The outputs of the Get Map Service Info activity are designed to provide everything you need to populate the Query Task activity.
Some things to try:- Log the value you are supplying to the Query Task as the Query Service Url to ensure it is correct.
- Manually assemble a request to the Essentials in a web browser to see if you can get it to work
- ..Geocortex/Essentials/REST/sites/MySite/map/mapservices/61/rest/services/x/MapServer/<layerId>?f=json&where=1%3D1&token=<token>
- Use a tool like Fiddler (on the server) to examine the outgoing request that the Query Task activity makes.
--Ryan0 -
Hi Ryan,
thanks a lot to explain it again. Finally with your suggestion I have figured it out. Below is an example how I did it for anyone else having the same question.
question related. Is there an built-in function in workflow to detect whether a map service support dynamicLayers?? the only way I could think of now is get get it from the JSON reponse of map service REST end point.
Cheers,
--Jack
_img_ alt="User-added image" src="https://latitudegeo--c.na53.content.force.com/servlet/rtaImage?eid=907f2000000fyCT&feoid=Body&refid=0EMf2000000kAHT" _/_img_0 -
Hi Ryan and otheres
Could you please clarify what happens to non-Geocortex secured map services? I have only ArcServer token secured services set up and Map Service Info returns an ArcServer REST URL. However this causes problems in Display Forms where Task URL is set by default to the Geocortex REST URL. I would really like to use the Autocomplete Box UI to fill in values and not the RuntimeModifications as I have tons of Autocomplete Boxes. Is there a way to synchronise the two?
Thank you,
Helen0 -
Helen, have you tried Ryan's suggestion to manually assemble the reqeust URL using the Geocortex REST URL of the map service with the layer and token like below, and try it in web broswer?
...Geocortex/Essentials/REST/sites/MySite/map/mapservices/61/rest/services/x/MapServer/<layerId>?f=json&where=1%3D1&token=<token>0 -
Hi Jack,
I am currently struggling with exactly the same issue. I have tried your suggestion but it doesn't work in my case. I am wondering wha are the 'cast' and 'assign' activites in your example is for. The reason I am asking is because we've already got the mapserviceURL and layerID from the 'GetMapServiceInfo' activity. In the end, my composed Query Service URL is the same as my layerURL. Can we just bypass those 'cast' and 'assign' activites and use layerURL for the 'Query Service URL' in the Query Task instead?0 -
Hi Hery,
my example is for secured map service has dynamic layer enabled. If your map service doesn't have dynamic layer enabled, then yes you should bypass cas and assgin and just use the LayerURI output from GetMapServiceInfo.
My understanding is, if the map service has dyanmic layers enabled, GetMapServiceInfo then couldn't get the original layer ID in the LayerID output nor the layerURL. therefore, I have to get it form the LayerSource output. and to do that, I have to cast the LayerSource object to LayerMapSource object, then from that, i can get the orignal layer ID by theLayerMapSource.MapLayerId.ToString
Hope that helps
regards,
Jack0 -
Hi Jack,
I am not sure why I get different result, but my map service is secured and dyamic layer is enabled. If I add 'Alert' activity below the 'GetMapServiceInfo', I will get the correct mapServiceURL or layerURL, which is the Geocortex site Rest URL. However, my QueryTask still doesn't work, even though I have tried a simple Where "1=1". So I assume there's something wrong with my layerURL.
Using your 'Cast' and 'Assign' as in your example, I get the "Object reference not set to an instance of an object" error message in my 'Assign' activity. Anyway, I will keep working on it to figure it out.0
Please sign in to leave a comment.
Comments
12 comments