繁体   English   中英

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

[英]Azure Data Factory V2 Copy data issue - Error code: 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" 
}

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

提前致谢!

1.反序列化源JSON数据时出错。 请检查数据是否为有效的 JSON object 格式。 2.Message=解析属性名后的无效字符。 预期':'但得到:,。

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

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


我的想法如下:

1.配置Web Activity调用你的REST API,然后你可以从你的源数据中得到响应。

在此处输入图像描述

2.配置一个Function App Activity来记录上述Web Activity的output。

在此处输入图像描述

Body should be set the output of Web Activity: @activity('Web1').output , then log it in the function app. 一些示例 function 代码如下:

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");
        }
    }
}

我在本地做了一个测试,你可能会看到类似的日志数据:

在此处输入图像描述

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

在此处输入图像描述

3.在复印活动之前将它们都连接到 ADF 中。

在此处输入图像描述

提示:

我的方法可以节省azure存储的钱,我只是记录数据,以便您检查数据是否遵循严格的格式。 当然,您可以将它们存储在 blob 存储中。 只需在 Azure Function 应用程序中编写代码以将Body数据存储到 Blob 存储中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM