UPDATE - 17th November 2015
Add Service Widget - 1.2
Widget updated with WMS functionality. Apologies for how long this took, but it was quite a complex task. I finally found a workflow I was happy with, that would also support non-ESRI WMS. This widget cannot handle secured WMS.
The widget requires some configuration in the config.json file. It is an array of the GIS servers that you will be adding web services from. The code handles this and pushes them as corsEnabledServers. If the server isn't CORS enabled, I believe it won't permit adding of the service in your application.
A change was added to the image service workflow, whereby if the image service is cached it will bring it in as a tiled map service rather than an image service, as the image service capability limits the amount of tiles viewable (defined in the service).
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
UPDATE - 19th June 2015
Add Service Widget - 1.1.3
Fixed image service bug. Added additional code for error handling.
Add Service Widget - 1.1.2
Fixed image service bug. Now checks for the allowRasterFunction in JSON object to infer image service type, and attributes a new variable called imageServiceBool depending on outcome. If the allowRasterFunction object exists in the JSON then imageServiceBool = true, else imageServiceBool = false.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
UPDATE - 16th June 2015
Add Service Widget - 1.1.1
Fixed Layer List bug (where layer list showed map services as layer1, layer2 etc.). Layer list widget will now read in the json.mapName object for dynamic and tiled map services.
Add Service Widget - 1.1
Stan McShinsky has added code to the settings folder to enable automatic integration with web app builder. Just unzip the widget and drop it into your web app builder stemapp "Widgets" folder.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This widget will add an ArcGIS Server service at run time to web app builder. It currently accepts Dynamic and Tiled Map Services, and Image Services. The widget has been designed to handle secured services.
Added services can be controlled in the layer list widget (thanks to its listeners!).
Instructions
To add to your Web App Builder application, extract the zipped AddService folder and paste it into your application's "widgets" folder.
Hi Alvaro,
The web service host (gis server) needs to be able to handle CORS, as does your web server. ArcGIS for Server installs since 10.1 have this functionality enabled automatically.
If CORS cannot be set up, then you may have to set up a proxy.
Without any knowledge of your set-up or services your consuming, it is very difficult to diagnose the issue, as they are so specific to your environment.
Here are some links to guidance:
Cross Origin Resource Sharing (CORS) with the ArcGIS API for JavaScript | ArcGIS Blog
Cross Origin Resource Sharing (CORS) - buffer | ArcGIS API for JavaScript
Default API Configurations | Guide | ArcGIS API for JavaScript
Using the proxy | Guide | ArcGIS API for JavaScript
Thanks,
Damien
Mr. Robinson:
I agree and thank you for the suggestion to enable CORS, but why work on my WAB and not on my Web Server's ?
Thanks,
Alvaro
Alvaro,
Because WAB has a builtin proxy that it uses when you are running inside WAB but not once it is deployed.
Mr. Robinson:
I agree and thank you for the suggestion to enable CORS, but why work on my WAB
and not on my Web Server's, both are on the same machine
Thanks
Alvaro Murillo
Was just about to say exactly the same thing!
Hi Alvaro,
Web App Builder is self contained on your machine, with its own proxy. I suspect you are going to have to set up a separate proxy on your IIS instance.
Setting up a Proxy | Support Services Blog
Thanks,
Damien
Mr. Robinson:
Thanks, now I understand better what is the problem, I will work on this and communicate as I was. Thanks for your advice
sincerely
Alvaro