Azure数据工厂V2复制数据问题-错误代码:2200

我正在尝试使用 Azure Data Factory V2 中的 REST API 连接器从ServiceNow表中提取数据。提取数据时,有时会出现以下错误,有时我没有任何错误,并且管道已成功运行。

{
"errorCode": "2200","message": "Failure happened on 'Source' side. ErrorCode=UserErrorInvalidJsonDataFormat,'Type=microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Error occurred when deserializing source JSON data. Please check if the data is in valid JSON object format.,Source=microsoft.DataTransfer.Clientlibrary,''Type=Newtonsoft.Json.JsonReaderException,Message=Invalid character after parsing property name. Expected ':' but got:,. Path 'result',line 1,position 15740073.,Source=Newtonsoft.Json,'","failureType": "UserError","target": "REST-API-ServiceNow" 
}

有人可以在这里帮助我吗?

谢谢!

didy21dd 回答:Azure数据工厂V2复制数据问题-错误代码:2200

  

1。反序列化源JSON数据时发生错误。请检查数据是否为有效的JSON对象格式。   2.Message =解析属性名称后的无效字符。预期为“:”,但得到:,..

我认为错误详细信息表明您的源数据不能通过ADF反序列化,因为它不是标准的JSON格式。非法的JSON数据无法通过ADF复制活动传递。

由于无法触摸您的源数据,因此我无法重现您的问题。但是,我建议您在执行复制活动之前使用WEB Activity来调用REST API。并收集Web活动的输出(来自REST API的响应)以将其存储在其他住所中。这样您就可以每次检查源数据是否合法。


我的想法如下:

1。配置“ Web活动”以调用REST API,然后您可以从源数据中获得响应。

enter image description here

2。配置功能应用活动以记录以上Web活动的输出。

enter image description here

Body应该设置为Web活动:@activity('Web1').output的输出,然后将其记录在功能应用程序中。一些示例函数代码如下:

using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;

namespace FunctionAppStoreCSV
{
    public static class Function2
    {
        [FunctionName("Function2")]
        public static async Task<IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous,"get","post",Route = null)] HttpRequest req,ILogger log)
        {
            log.LogInformation("C# HTTP trigger function processed a request.");

            string requestBody = await new StreamReader(req.Body).ReadToEndAsync();


            dynamic data = JsonConvert.DeserializeObject(requestBody);

            log.LogInformation(requestBody);

            return requestBody != null
                ? (ActionResult)new OkObjectResult($"Log Successfully")
                : new BadRequestObjectResult("Please pass output in the request body");
        }
    }
}

我在本地进行了测试,您可能会看到类似如下的日志数据:

enter image description here

如果它在门户中,则可以在KUDU URL上查看日志:D:\home\LogFiles\Application\Functions\function\Function2>

enter image description here

3。在“复制活动”之前将它们都连接到ADF中。

enter image description here

提示:

我的方法可以为天蓝色存储省钱,我只记录数据,以便您可以检查数据是否遵循严格的格式。当然,您可以将它们存储在Blob存储中。只需编写代码即可将Body数据存储到Azure函数应用中所需的Blob存储中。

本文链接:https://www.f2er.com/3116816.html

大家都在问