Validate service for FeatureLayer

608
4
10-31-2012 09:49 PM
KlimChugunkin
New Contributor
Hello there!
I would appreciate it very much if you guys help me solve this issue:
I'm trying to create FeatureLayer like this
featureLayer = new esri.layers.FeatureLayer(featureServiceURL, featureLayerOptions);
the line above gives me an error: Unable to draw graphic (geometry:null, symbol:null): Unable to complete operation.
That's because featureServiceURL points to the server which does not exist or is inaccessible.
My question is: how to find out if the service is OK before creating FeatureLayer - in other words, how to validate service prior to FeatureLayer please?

Thanks in advance,
Klim
0 Kudos
4 Replies
__Rich_
Occasional Contributor III
Just make any kind of request to the service and handle the response or (importantly in your case!) the error.
0 Kudos
SteveCole
Frequent Contributor
Like Rich states, maybe you can attempt to access the service before really needing it. Perhaps you can alter the code snippit found in the API documentation for ESRI.Request to verify that the service is up and running:  esri.request
0 Kudos
KlimChugunkin
New Contributor
Just make any kind of request to the service and handle the response or (importantly in your case!) the error.


Thanks you geos_rfleet.
0 Kudos
KlimChugunkin
New Contributor
Like Rich states, maybe you can attempt to access the service before really needing it. Perhaps you can alter the code snippit found in the API documentation for ESRI.Request to verify that the service is up and running:  esri.request


Thank you evtguy.
That's what I needed.
0 Kudos