【发布时间】:2021-05-04 16:45:57
【问题描述】:
我在 ADF 中有一个通往 REST API 端点的管道,该端点返回一个用双引号 (") 括起来的字符串。它看起来像这样:"xyz123fj==" 我想要做的是将字符串值存储在变量名为AuthKey。最初我只是“按原样”存储它,但管道失败并出现以下错误:The variable 'AuthKey' of type 'String' cannot be initialized or updated with value of type 'Object'. The variable 'AuthKey' only supports values of types 'String'.
所以很自然地我想我会尝试转换为这样的字符串:string(@activity('Get Token').output) 这实际上允许成功存储变量,但下一步失败并显示消息:Error calling the endpoint 'https://<xxxxxx.com/APIendpoint>'. Response status code: ''. More details:Exception message: 'The format of value 'string(@activity('Get Token').output)' is invalid.'. No response from the endpoint. Possible causes: network connectivity, DNS failure, server certificate validation or timeout.
我怀疑这意味着它实际上并没有存储原始的'xyz123fj==' 字符串,而是将未计算的函数本身存储为字符串(因此它存储了string(@activity('Get Token').output),这在发送到 API 时是无效的。
我还尝试了@string(activity('Get Token').output),导致错误消息略有不同:More details:Exception message: 'The format of value '{"Response":"\"xyz123fj==\"","ADFWebActivityResponseHeaders":{"Pragma":"no-cache","Strict-Transport-Security":"max-age=31536000","X-Absorb-Correlation-Id":"c937fab2-3e6c-4d92-8b28-5375fb2d5721","X-Content-Type-Options":"nosniff","X-Frame-Options":"SAMEORIGIN","X-LMS-Server":"USE1-PRD-WEB-A3","X-Response-For":"/api/Rest/v1/Authenticate","X-XSS-Protection":"1; mode=block","Connection":"keep-alive","Cache-Control":"no-cache","Date":"Mon, 03 May 2021 15:53:01 GMT","Content-Length":"178","Content-Type":"application/json; charset=utf-8","Expires":"-1"},"effectiveIntegrationRuntime":"DefaultIntegrationRuntime (East US)","executionDuration":0,"durationInQueue":{"integrationRuntimeQueue":0},"billingReference":{"activityType":"ExternalActivity","billableDuration":[{"meterType":"AzureIR","duration":0.016666666666666666,"unit":"Hours"}]}}' is invalid.'. No response from the endpoint.
在最后一个示例中,使用变量的步骤似乎从“设置变量”活动接收完整的输出对象,而不是预期的简单字符串。任何关于我在这里做错了什么的见解将不胜感激。
我也尝试只修剪单引号(所以没有字符串转换功能),但也无法让它工作。我要做的就是自己存储这个字符串:(
【问题讨论】: