<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Load a WMS map service to Map  in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/load-a-wms-map-service-to-map/m-p/831929#M8362</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's great &lt;A href="https://community.esri.com/migrated-users/7877"&gt;Helen Zhou&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, that's the usual way to using&amp;nbsp; esri resource proxy to solve cors issue.&lt;/P&gt;&lt;P&gt;So I believed your layer can be loaded already.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Feb 2020 05:12:08 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2020-02-06T05:12:08Z</dc:date>
    <item>
      <title>Load a WMS map service to Map</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/load-a-wms-map-service-to-map/m-p/831925#M8358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am working a customized widget usingWeb Appbuilder developer edition 2.14. One part of the code is to load a WMS map service to the map. I am able to load the WMS service in development environment. After I download the site and deploy it in an IIS server, the WMS map is not loaded to the map. Google Chrome developer tool shows the layer is added and no error at the console tab. If I put the same piece of codes to a standalone html page in an IIS server. It also works. Any help is appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thelines of code to load WMS service is below-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(!this.isNearmapLoaded){ &lt;BR /&gt; wmsNearmapLayerUrl='https://api.nearmap.com/wms/v1/latest/apikey/somekey?request=GetCapabilities'; &lt;BR /&gt; &lt;BR /&gt; this.wmsNearmapLayer = new WMSLayer(wmsNearmapLayerUrl, {&lt;BR /&gt; format: "jpg",&lt;BR /&gt; id:"Nearmap",&lt;BR /&gt; visibleLayers: ["area/d1cb2895-a36f-902170/all/2016-09-19"]&lt;BR /&gt; });&lt;BR /&gt; &lt;BR /&gt; this.map.addLayer(this.wmsNearmapLayer) ; &lt;BR /&gt; this.map.reorderLayer(this.wmsNearmapLayer,1);&lt;BR /&gt; this.isNearmapLoaded = true;&lt;BR /&gt; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Feb 2020 20:16:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/load-a-wms-map-service-to-map/m-p/831925#M8358</guid>
      <dc:creator>HelenZhou</dc:creator>
      <dc:date>2020-02-03T20:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Load a WMS map service to Map</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/load-a-wms-map-service-to-map/m-p/831926#M8359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/7877"&gt;Helen Zhou&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These two code shall not go sequentially together.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;this.map.addLayer(this.wmsNearmapLayer) ;&lt;/SPAN&gt;&lt;BR style="background-color: #ffffff;" /&gt;&lt;SPAN style="background-color: #ffffff;"&gt;this.map.reorderLayer(this.wmsNearmapLayer,1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;After you call addLayer, it might not be added into the map yet.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Better to register layer-add event with below code before calling addLayer&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;this.map.on("layer-add", lang.hitch(this, this.layerOrderChange));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;at layerOrderChange method, try to find out whether your layer is already added or not.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;and call the this.map.reorderLayer method.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Please import, lang package and all the accordingly, it is just based on the concept. let me know hows it is go.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2020 05:46:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/load-a-wms-map-service-to-map/m-p/831926#M8359</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-02-04T05:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: Load a WMS map service to Map</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/load-a-wms-map-service-to-map/m-p/831927#M8360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks so much, Than. I have removed the line of code to reorder Layer and run code again today. The Chrome developer tool console shows error: "Access to XMLHttpRequest at 'https://api.nearmap.com/wms/v1/latest/apikey/N......jAy?SERVICE=WMS&amp;amp;REQUEST=GetCapabilities' from origin 'https://testserver' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am able to run the same codes in a html page deployed in the same server. The only additional code in the html page is&lt;/P&gt;&lt;P&gt;esriConfig.defaults.io.corsEnabledServers.push("api.nearmap.com").&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So - I try to configure the proxy in the config.json for proxy:&lt;/P&gt;&lt;P&gt;&amp;nbsp;"httpProxy": {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"useProxy": true,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"url": "",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"alwaysUseProxy": false,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;"rules": [{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;"urlPrefix": "https://api.nearmap.com/",&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;"proxyUrl": "https://testserver/wabsupport/proxy/proxy.ashx"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}]&lt;BR /&gt;&amp;nbsp; },&lt;/P&gt;&lt;P&gt;in the proxy.config:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serverUrl url="https://api.nearmap.com/"&amp;nbsp;&amp;nbsp;&amp;nbsp; matchAll="true"/&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Running the WAB application, the WMS is still not loaded with 500 error: &lt;A class="link-titled" href="https://tst-gis6/wabsupport/proxy/proxy.ashx?https://api.nearmap.com/wms/v1/latest/apikey/NjdjYjVlZTQtYzliNS00Yjc4LThmNjQtYzhkNDNlNjZiNjAy?SERVICE=WMS&amp;amp;REQUEST=GetCapabilities" title="https://tst-gis6/wabsupport/proxy/proxy.ashx?https://api.nearmap.com/wms/v1/latest/apikey/NjdjYjVlZTQtYzliNS00Yjc4LThmNjQtYzhkNDNlNjZiNjAy?SERVICE=WMS&amp;amp;REQUEST=GetCapabilities"&gt;https://testserver/wabsupport/proxy/proxy.ashx?https://api.nearmap.com/wms/v1/latest/apikey/N.../...&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks so much for help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2020 18:00:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/load-a-wms-map-service-to-map/m-p/831927#M8360</guid>
      <dc:creator>HelenZhou</dc:creator>
      <dc:date>2020-02-04T18:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Load a WMS map service to Map</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/load-a-wms-map-service-to-map/m-p/831928#M8361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have figured it out.&lt;/P&gt;&lt;P&gt;I download the latest proxy and deploy it in IIS server. In the config.json httpProxy section, I change the value to the latest proxy url for &lt;SPAN&gt;proxyUrl&lt;/SPAN&gt; value. the latest can be downloaded here &lt;A class="link-titled" href="https://github.com/Esri/resource-proxy/archive/master.zip" title="https://github.com/Esri/resource-proxy/archive/master.zip"&gt;https://github.com/Esri/resource-proxy/archive/master.zip&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Feb 2020 22:44:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/load-a-wms-map-service-to-map/m-p/831928#M8361</guid>
      <dc:creator>HelenZhou</dc:creator>
      <dc:date>2020-02-05T22:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Load a WMS map service to Map</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/load-a-wms-map-service-to-map/m-p/831929#M8362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's great &lt;A href="https://community.esri.com/migrated-users/7877"&gt;Helen Zhou&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, that's the usual way to using&amp;nbsp; esri resource proxy to solve cors issue.&lt;/P&gt;&lt;P&gt;So I believed your layer can be loaded already.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Feb 2020 05:12:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/load-a-wms-map-service-to-map/m-p/831929#M8362</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-02-06T05:12:08Z</dc:date>
    </item>
  </channel>
</rss>

