Caling a layer in Arcgis Javascript API

2548
4
Jump to solution
10-13-2015 06:18 AM
ADITYAKUMAR1
Occasional Contributor III

Dear Users,

I need to call a dynamic mapservice.

The parameter provided to me are

         

TitleMap_Service_NameMap_Service_UrlIs_RequiredService_TypePurposeIs_PrintMap_Service_OrderIs_Restricted
2D GSI2D https://mapserver.XXXXXX.com/ArcGIS/rest/services/GXXXX2D_XXXX/XXXX1CachedSeismic Query14

0

How can I add the mapservice to my application?

If i add it with new esri.layers.ArcGISDynamicMapServiceLayer(layer url);

I get the following error. 401 Unauthorized

{"currentVersion":10.2,"fullVersion":"10.2.0","soapUrl":"https://mapserver.eXXXXXXX.com/arcgis/services","secureSoapUrl":null,"authInfo":{"isTokenBasedSecurity":false}}

Thanks in advance for the help.

Aditya kumar

0 Kudos
1 Solution

Accepted Solutions
TracySchloss
Frequent Contributor

You said you want to load a ArcGISDynamicMapServiceLayer, but in that example, you specify ArcGISTiledMapServiceLayer.  Unless a service is published as tiled, you won't be able to create it that way. 

View solution in original post

0 Kudos
4 Replies
TracySchloss
Frequent Contributor

You should be able to take the URL of the map service, paste in in a browser window and have some results returned.  If you get some sort of permission error, the service has been secured and won't be able to use it without some sort of authentication. If you can't view its rest service endpoint, then you won't be able call the service in code either.

If you do see information about the service using the URL, then you have a syntax problem when constructing this layer.  If you post the lines of code, it will be easier for people to see where you might have a problem.

0 Kudos
ADITYAKUMAR1
Occasional Contributor III

Hi Tracy,

Thanks for the reply. When I paste the url in the browser I can easily see the data. But when I bring the same in my map its giving me error.

var GSI_2D = new esri.layers.ArcGISTiledMapServiceLayer("https://mapserver.xxxxx.xxxx.com/ArcGIS/rest/services/Global/xxxxxxx/MapServer",

{"opacity":1.0,"visible":true});

Thanks

Aditya Kumar

0 Kudos
TracySchloss
Frequent Contributor

You said you want to load a ArcGISDynamicMapServiceLayer, but in that example, you specify ArcGISTiledMapServiceLayer.  Unless a service is published as tiled, you won't be able to create it that way. 

0 Kudos
ADITYAKUMAR1
Occasional Contributor III

Hi Tracy,

Thanks for the reply.

I am sorry for writing Dynamic service ,its actually a tiled map service and I am calling it the way I mentioned above.

0 Kudos