<?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: Modifying Service Definition Draft file to enable WMS capabilities? in Publishing and Managing Services Questions</title>
    <link>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1079119#M471</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/298976"&gt;@ZikangZhou1&lt;/a&gt;&amp;nbsp;i am using a netcdf file from esri and then copying its multidimensional raster layer to a raster dataset (crf). After that, i am using the CreateImageSddraft function and not the getMap as i want to publish directly from the file and not the map document. I have added the file and if required i can share the complete workflow as well.&lt;BR /&gt;One more thing, if i change the raster dataset from .crf to .tif then i get an error for a WMS layer which is below while the imagery layer is displayed in grayscale.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;The WMS service, &lt;A href="https://coastmap.hzg.de/image/services/image/ImageServer/WMSServer" target="_blank" rel="noopener"&gt;https://xyz.com/image/services/image/ImageServer/WMSServer&lt;/A&gt;, cannot be added to the map. It is either not available or you have entered an invalid URL for the type of layer you want to reference.&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jul 2021 07:34:20 GMT</pubDate>
    <dc:creator>RehanChaudhary</dc:creator>
    <dc:date>2021-07-15T07:34:20Z</dc:date>
    <item>
      <title>Modifying Service Definition Draft file to enable WMS capabilities?</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1078624#M464</link>
      <description>&lt;P&gt;I am trying to automate the process of publishing WMS services directly from a raster file without using a map document or project file. I am able to publish an imagery layer or a map image layer but when i try to modify the image draft file to enable the WMS or WFS capabilities and create a new draft file it displays a black image for the image layer and the WMS. Probably because the information from previous file is not copied to the new file and i am not referencing the data in my workflow but rather copying it to the server. How can i enable WMS on my layer? Here is how i implement the image draft file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.CreateImageSDDraft(rasterimage, output_draft, service, 'FROM_CONNECTION_FILE', con, True, None, "netCDF test", "test,auto")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is how i enable WMS :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;doc=DOM.parse(output_draft)
typeNames = doc.getElementsByTagName('TypeName')
for typeName in typeNames:
    # Get the TypeName whose properties we want to modify.
    if typeName.firstChild.data == "WMSServer":
        extension = typeName.parentNode
        for extElement in extension.childNodes:
            # Enabled SOE.
            if extElement.tagName == 'Enabled':
                extElement.firstChild.data = 'true'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Here is how i create a new draft file for storing updated&amp;nbsp; properties. and here is the problem. The info from previous file is lost and so i see a black image:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;new_draft=r"C:/Users/C/arcgis/image1.sddraft"
f = open(new_draft, 'w')     
doc.writexml( f )     
f.close()   &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jul 2021 12:21:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1078624#M464</guid>
      <dc:creator>RehanChaudhary</dc:creator>
      <dc:date>2021-07-14T12:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Service Definition Draft file to enable WMS capabilities?</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1078634#M467</link>
      <description>&lt;P&gt;Dear Rehan,&lt;/P&gt;&lt;P&gt;I share with you the function that I use to enable the WMS capability. The only difference is that I work with&amp;nbsp;CreateMapSDDraft.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def enableWMS(sddraft):
    # These are the properties we will change in the sddraft xml.
    soe = 'WMSServer'

    # Read the sddraft xml.
    doc = DOM.parse(sddraft)
    # Find all elements named TypeName. This is where the server object extension (SOE) names are defined.
    typeNames = doc.getElementsByTagName('TypeName')
    for typeName in typeNames:
        # Get the TypeName whose properties we want to modify.
        if typeName.firstChild.data == soe:
            extension = typeName.parentNode
            for extElement in extension.childNodes:
                # Enabled SOE.
                if extElement.tagName == 'Enabled':
                    extElement.firstChild.data = 'true'
                    break

    keys = doc.getElementsByTagName('Key')
    for key in keys:
        if key.hasChildNodes():
            if key.firstChild.data == 'isCached':
                key.nextSibling.firstChild.data = 'false'
            elif key.firstChild.data == 'cacheOnDemand':
                key.nextSibling.firstChild.data = 'false'


    outXml = sddraft
    if os.path.exists(outXml): os.remove(outXml)
    f = open(outXml, 'w')
    doc.writexml(f)
    f.close()

    del f, doc&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 14 Jul 2021 12:31:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1078634#M467</guid>
      <dc:creator>Borch</dc:creator>
      <dc:date>2021-07-14T12:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Service Definition Draft file to enable WMS capabilities?</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1078638#M469</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/493578"&gt;@Borch&lt;/a&gt;&amp;nbsp;unfortunately this still gives the same result&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jul 2021 12:43:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1078638#M469</guid>
      <dc:creator>RehanChaudhary</dc:creator>
      <dc:date>2021-07-14T12:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Service Definition Draft file to enable WMS capabilities?</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1078818#M470</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/469496"&gt;@RehanChaudhary&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you share the data you used?&lt;/P&gt;&lt;P&gt;If a WMS getMap returns things (even if it is black), that means WMS is working and the problem is more like a data rendering/visualization issue.&lt;/P&gt;&lt;P&gt;We could check the associated image service export image operation had it displayed well and start investigating from there.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jul 2021 17:47:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1078818#M470</guid>
      <dc:creator>ZikangZhou1</dc:creator>
      <dc:date>2021-07-14T17:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Service Definition Draft file to enable WMS capabilities?</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1079119#M471</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/298976"&gt;@ZikangZhou1&lt;/a&gt;&amp;nbsp;i am using a netcdf file from esri and then copying its multidimensional raster layer to a raster dataset (crf). After that, i am using the CreateImageSddraft function and not the getMap as i want to publish directly from the file and not the map document. I have added the file and if required i can share the complete workflow as well.&lt;BR /&gt;One more thing, if i change the raster dataset from .crf to .tif then i get an error for a WMS layer which is below while the imagery layer is displayed in grayscale.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;EM&gt;The WMS service, &lt;A href="https://coastmap.hzg.de/image/services/image/ImageServer/WMSServer" target="_blank" rel="noopener"&gt;https://xyz.com/image/services/image/ImageServer/WMSServer&lt;/A&gt;, cannot be added to the map. It is either not available or you have entered an invalid URL for the type of layer you want to reference.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 07:34:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1079119#M471</guid>
      <dc:creator>RehanChaudhary</dc:creator>
      <dc:date>2021-07-15T07:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Service Definition Draft file to enable WMS capabilities?</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1079520#M472</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/469496"&gt;@RehanChaudhary&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot reproduce the problem using my Pro 2.8 and Server 10.9 with your data. Here are my steps:&lt;/P&gt;&lt;P&gt;1. download your netcdf, run make multidimensional raster layer tool with the netcdf.&lt;/P&gt;&lt;P&gt;2. run copy raster tool, select process as multidimensional, output format as crf.&lt;/P&gt;&lt;P&gt;3. run the exact code snippet you provided to generate the sddraft file.&lt;/P&gt;&lt;P&gt;4. stage the sddraft file to make it a sd file; upload the sd file to server.&lt;/P&gt;&lt;P&gt;5. add the wms endpoint to arcgis pro as a new wms server, the layer displays just fine.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Zikang_0-1626392438544.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/18605i56381994793C4811/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Zikang_0-1626392438544.png" alt="Zikang_0-1626392438544.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 23:41:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1079520#M472</guid>
      <dc:creator>Zikang</dc:creator>
      <dc:date>2021-07-15T23:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Service Definition Draft file to enable WMS capabilities?</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1079592#M473</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/496072"&gt;@Zikang&lt;/a&gt;&amp;nbsp;i finally upload it to a federated esri arcgis portal and that is where i get the above mentioned error that it cannot be added to the map. When i see the layer detail it gives me error code 499 which is related to making the service public as currently it is set to private. I tried making it public directly from the portal but that did not help. How can i make it public using the functions of creating draft file and staging files to server and maybe that might solve the problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 08:58:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1079592#M473</guid>
      <dc:creator>RehanChaudhary</dc:creator>
      <dc:date>2021-07-16T08:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Service Definition Draft file to enable WMS capabilities?</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1079723#M474</link>
      <description>OK. Now I see the reason. Your service is a private one and it will always need a "token" parameter to access the wms. You may add a long-term token as an additional parameter when access via wms server connection.&lt;BR /&gt;Alternatively, you can make the item public through your portal, that will help as well.&lt;BR /&gt;Service definition doesn't have a such thing defined inside. You could try arcgis python api to make an item public after it is created. &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.Item.share" target="_blank"&gt;https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.Item.share&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Jul 2021 16:42:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1079723#M474</guid>
      <dc:creator>ZikangZhou1</dc:creator>
      <dc:date>2021-07-16T16:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Service Definition Draft file to enable WMS capabilities?</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1080272#M475</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/298976"&gt;@ZikangZhou1&lt;/a&gt;&amp;nbsp;i tried making it public through my portal but that did not solve the problem. How can i add a token parameter?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 14:25:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1080272#M475</guid>
      <dc:creator>RehanChaudhary</dc:creator>
      <dc:date>2021-07-19T14:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Service Definition Draft file to enable WMS capabilities?</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1080366#M477</link>
      <description>Rehan,&lt;BR /&gt;Try some of arcgis portal documentations such as: &lt;A href="https://enterprise.arcgis.com/en/portal/latest/administer/windows/specify-the-default-token-expiration-time.htm" target="_blank"&gt;https://enterprise.arcgis.com/en/portal/latest/administer/windows/specify-the-default-token-expiration-time.htm&lt;/A&gt;&lt;BR /&gt;Theoretically, making it public through portal should have resolved the problem.&lt;BR /&gt;This is getting out of my expertise right now. Could you reach out to esri technical support for this?&lt;BR /&gt;</description>
      <pubDate>Mon, 19 Jul 2021 17:03:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/modifying-service-definition-draft-file-to-enable/m-p/1080366#M477</guid>
      <dc:creator>Zikang</dc:creator>
      <dc:date>2021-07-19T17:03:46Z</dc:date>
    </item>
  </channel>
</rss>

