Select to view content in your preferred language

Where to programmatically create Layer Objects

999
3
05-16-2014 02:19 PM
StephanieFitzgerald
Deactivated User
So, I am trying to read several layers from a database and populate the layer list from a list of layers.  Each layer has a different username and password for token generation.  I do not wish to have the user enter 50 passwords at launch of the flex app and I do not wish to reconfigure the server to not require each from having individual usernames and passwords.   I am trying to figure out how to manually create the layers by reading from a generated xml file, not the config.xml but an xml generated from our database, that contains all of the attribute of the layer object.  And allows the Layerlist to login and receive the layers token, without hard coding the token, the userid, or the password.  Thank you!
Tags (2)
0 Kudos
3 Replies
StephanieFitzgerald
Deactivated User
So I have accessed the xml to dynamically alter it based on a passed Jason object.  I have also implemented a httpservice to dynamically request a token.  The only issue I am having now is that the token does not appear to get passed in time to update the xml before load.  I can display an alert but it still does not get passed over.  In other languages I have done a while to pause to program processing while waiting for the token but that just seems to stop the drawing of the webmap.  Any suggestions?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Stephanie,

   Your requirements and workflow are not very normal, so you will be hard pressed to get to much help. But what I can say is that if all you need to to have certain services use a specific username and password than all you need to do is setup a proxy service (the newer on that supports many new options) found here:
https://github.com/Esri/resource-proxy

Using this new proxy you can do many things that were not possible before. You can specify a service or simply a server root url and the password and user that will be used when accessing this service.

<serverUrl url="http://gislap183:6080" username="user1" password="Pa$$w0rd"
                   matchAll="true"/>
0 Kudos
StephanieFitzgerald
Deactivated User
I was actually able to complete this programmatically.  By populating the config.xml, dynamically based on user based attributes you can then send encrypted usernames and passwords to each user.  Then by decrypting the usernames and passwords you can poll each layer in the list for its token based on those decrypted user names and passwords.  I then would have the ConfigManager.as read this list instead of its default, which was also provided in case of any communication failure.  I can see how this may be slightly different then what the standard developer would have to do but my motto is if there is a problem then there is a programmatic solution.  It took just a few alterations and programming "know-how" to complete and once I finalize this project I would be delighted to share it with the community, as I have now completed this in both Flex and Javascript API's.
0 Kudos