WebApps class trying to parse XML as though it is JSON
I am trying to use the Azure::ARM::Web::WebSiteManagementClient.new#web_apps.list_publishing_profile_xml_with_secrets method to retrieve ftp settings for my app. However, I keep getting this error:
MsRest::DeserializationError: {
"exception_message": "743: unexpected token at '<publishData><publishProfile profileName=\"<app name> - Web Deploy\" publishMethod=\"MSDeploy\" publishUrl=\"<site-name>.scm.azurewebsites.net:443\" msdeploySite=\"<site-name>\" userName=\"<username>\" userPWD=\"<password>\" destinationAppUrl=\"http://<site-name>\" SQLServerDBConnectionString=\"\" mySQLDBConnectionString=\"\" hostingProviderForumLink=\"\" controlPanelLink=\"http://windows.azure.com\" webSystem=\"WebSites\"><databases /></publishProfile><publishProfile profileName=\<profile-name> - FTP\" publishMethod=\"FTP\" publishUrl=\"ftp://waws-prod-am2-145.ftp.azurewebsites.windows.net/site/wwwroot\" ftpPassiveMode=\"True\" userName=\"<username>\" userPWD=\"<password>\" destinationAppUrl=\"http://<site-name>.azurewebsites.net\" SQLServerDBConnectionString=\"\" mySQLDBConnectionString=\"\" hostingProviderForumLink=\"\" controlPanelLink=\"http://windows.azure.com\" webSystem=\"WebSites\"><databases /></publishProfile></publishData>'",
"message": "Error occurred in deserializing the response",
"stacktrace": [
"/Users/pivotal/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/json-2.0.3/lib/json/common.rb:156:in `parse'",
"/Users/pivotal/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/json-2.0.3/lib/json/common.rb:156:in `parse'",
"/Users/pivotal/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/json-2.0.3/lib/json/common.rb:335:in `load'",
"/Users/pivotal/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/azure_mgmt_web-0.13.0/lib/generated/azure_mgmt_web/web_apps.rb:12457:in `block in list_publishing_profile_xml_with_secrets_async'",
"/Users/pivotal/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/promise.rb:501:in `block in on_fulfill'",
"/Users/pivotal/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/safe_task_executor.rb:24:in `block in execute'",
"/Users/pivotal/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/mri_lockable_object.rb:38:in `block in synchronize'",
"/Users/pivotal/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/mri_lockable_object.rb:38:in `synchronize'",
"/Users/pivotal/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/mri_lockable_object.rb:38:in `synchronize'",
"/Users/pivotal/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/safe_task_executor.rb:19:in `execute'",
"/Users/pivotal/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/promise.rb:531:in `block in realize'",
"/Users/pivotal/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:348:in `run_task'",
"/Users/pivotal/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:337:in `block (3 levels) in create_worker'",
"/Users/pivotal/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:320:in `loop'",
"/Users/pivotal/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:320:in `block (2 levels) in create_worker'",
"/Users/pivotal/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:319:in `catch'",
"/Users/pivotal/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb:319:in `block in create_worker'"
],
If you take a look at your code, the error seems to be on lines 8734 and 8726 of the list_publishing_profile_xml_with_secrets_async method where it tries to load xml as though it were JSON.
My team would like to use the sdk to retrieve the publishing profile information, but this problem is preventing us from doing so.
@NatashaHull would you mind pasting your raw request/response, so we can check on types being asked and sent by the service? You can set environment variable 'AZURE_HTTP_LOGGING' to get more info on request/response. Thanks!
@veronicagg This is the output I get with that env var
WARNING: Unexpected middleware set after the adapter. This won't be supported from Faraday 1.0.
I, [2017-10-04T11:56:36.691347 #21737] INFO -- : post https://management.azure.com/subscriptions/<subscription-id>/resourceGroups/<resource_group_name>/providers/Microsoft.Web/sites/<site-name>/publishxml?api-version=2016-08-01
D, [2017-10-04T11:56:36.691490 #21737] DEBUG -- request: User-Agent: "Ruby/2.3.3 (x86_64-darwin15) ms_rest/0.7.1 ms_rest_azure/0.9.0 Azure-SDK-For-Ruby azure_mgmt_web"
Content-Type: "application/json; charset=utf-8"
Accept: "application/json"
accept-language: "en-US"
x-ms-client-request-id: "<id>"
authorization: "Bearer <token>"
D, [2017-10-04T11:56:36.691544 #21737] DEBUG -- request: <publishData><publishProfile profileName="<site-name> - Web Deploy" publishMethod="MSDeploy" publishUrl="<site-name>.scm.azurewebsites.net:443" msdeploySite="<site-name>" userName="$<site-name>" userPWD="<password>" destinationAppUrl="http://<site-name>.azurewebsites.net" SQLServerDBConnectionString="" mySQLDBConnectionString="" hostingProviderForumLink="" controlPanelLink="http://windows.azure.com" webSystem="WebSites"><databases /></publishProfile><publishProfile profileName="<site-name> - FTP" publishMethod="FTP" publishUrl="ftp://waws-prod-am2-145.ftp.azurewebsites.windows.net/site/wwwroot" ftpPassiveMode="True" userName="<site-name>\$<site-name>" userPWD="<password>" destinationAppUrl="http://<site-name>.azurewebsites.net" SQLServerDBConnectionString="" mySQLDBConnectionString="" hostingProviderForumLink="" controlPanelLink="http://windows.azure.com" webSystem="WebSites"><databases /></publishProfile></publishData>
I, [2017-10-04T11:56:36.691609 #21737] INFO -- Status: 200
D, [2017-10-04T11:56:36.691661 #21737] DEBUG -- response: cache-control: "no-cache"
pragma: "no-cache"
content-length: "1222"
content-type: "application/xml"
expires: "-1"
strict-transport-security: "max-age=31536000; includeSubDomains"
server: "Microsoft-IIS/8.0"
x-aspnet-version: "4.0.30319"
x-powered-by: "ASP.NET"
x-ms-ratelimit-remaining-subscription-resource-requests: "11999"
x-ms-request-id: "a943f95d-d76f-4e05-8d78-dc2605d92edb"
x-ms-correlation-request-id: "a943f95d-d76f-4e05-8d78-dc2605d92edb"
x-ms-routing-request-id: "CANADAEAST:20171004T185635Z:a943f95d-d76f-4e05-8d78-dc2605d92edb"
date: "Wed, 04 Oct 2017 18:56:34 GMT"
connection: "close"
D, [2017-10-04T11:56:36.691685 #21737] DEBUG -- response: <publishData><publishProfile profileName="<site-name> - Web Deploy" publishMethod="MSDeploy" publishUrl="<site-name>.scm.azurewebsites.net:443" msdeploySite="<site-name>" userName="$<site-name>" userPWD="<password>" destinationAppUrl="http://<site-name>.azurewebsites.net" SQLServerDBConnectionString="" mySQLDBConnectionString="" hostingProviderForumLink="" controlPanelLink="http://windows.azure.com" webSystem="WebSites"><databases /></publishProfile><publishProfile profileName="<site-name> - FTP" publishMethod="FTP" publishUrl="ftp://waws-prod-am2-145.ftp.azurewebsites.windows.net/site/wwwroot" ftpPassiveMode="True" userName="<site-name>\$<site-name>" userPWD="<password>" destinationAppUrl="http://<site-name>.azurewebsites.net" SQLServerDBConnectionString="" mySQLDBConnectionString="" hostingProviderForumLink="" controlPanelLink="http://windows.azure.com" webSystem="WebSites"><databases /></publishProfile></publishData>
@NatashaHull Looking into this it appears that the rest api defined at https://github.com/Azure/azure-rest-api-specs/blob/current/specification/web/resource-manager/Microsoft.Web/2016-08-01/WebApps.json#L11766 produces XML. Our Ruby SDK does not currently support XML content type, therefore the exception you're seeing. We will evaluate supporting XML and will let you know one we have updates.
https://github.com/Azure/azure-sdk-for-ruby/issues/1080
Thank you for your interest in Azure SDKs. As detailed in this retirement announcement, this repo is no longer supported as of December 31st 2021. Please find the up-to-date list of languages and services supported with Azure SDKs here: https://aka.ms/azsdk