简体   繁体   English

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

[英]Azure Data Factory V2 Copy data issue - Error code: 2200

I'm trying to pull data from ServiceNow tables using the REST API connector in Azure Data Factory V2 .我正在尝试使用Azure Data Factory V2中的REST API连接器从 ServiceNow 表中提取数据。 While pulling the data, I'm getting the following error sometimes and sometimes I'm not getting any error and the pipeline is successfully running.在提取数据时,有时我会收到以下错误,有时我没有收到任何错误并且管道正在成功运行。

{
"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" 
}

Can someone please help me here?有人可以在这里帮助我吗?

Thanks in advance!提前致谢!

1.Error occurred when deserializing source JSON data. 1.反序列化源JSON数据时出错。 Please check if the data is in valid JSON object format.请检查数据是否为有效的 JSON object 格式。 2.Message=Invalid character after parsing property name. 2.Message=解析属性名后的无效字符。 Expected ':' but got: ,.预期':'但得到:,。

I think the error details indicates that your source data can't be deserialized by ADF because it's not standard JSON format.Illegal JSON data can't pass through ADF copy activity.我认为错误详细信息表明您的源数据无法被 ADF 反序列化,因为它不是标准的 JSON 格式。非法 JSON 数据无法通过 ADF 复制活动。

I can't reproduce your issue on my side because i can't touch your source data.However, i suggest you using WEB Activity to call your REST API before the execution of Copy Activity.我无法在我这边重现您的问题,因为我无法触摸您的源数据。但是,我建议您使用WEB 活动来调用您的 REST API 在执行活动副本之前。 And collect the output of Web Activity (Response from REST API) to store them in other residence.并收集 Web Activity 的 output(来自 REST API 的响应)存储在其他住所。 So that you could check whether your source data is legal every time.这样您就可以每次都检查您的源数据是否合法。


My idea is as below:我的想法如下:

1.Configure Web Activity to call your REST API, then you could get the response from your source data. 1.配置Web Activity调用你的REST API,然后你可以从你的源数据中得到响应。

在此处输入图像描述

2.Configure a Function App Activity to log the output of above Web Activity. 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. Body should be set the output of Web Activity: @activity('Web1').output , then log it in the function app. Some sample function code as below:一些示例 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");
        }
    }
}

I did a test locally and you may see the log data something like:我在本地做了一个测试,你可能会看到类似的日志数据:

在此处输入图像描述

If it is in the portal, you could view the log on the KUDU url: D:\home\LogFiles\Application\Functions\function\Function2>如果在门户中,您可以在 KUDU url 上查看日志: D:\home\LogFiles\Application\Functions\function\Function2>

在此处输入图像描述

3.Connect both of them in ADF before your Copy Activity. 3.在复印活动之前将它们都连接到 ADF 中。

在此处输入图像描述

Tips:提示:

My way could save the money for the azure storage,i just log the data so that you could check whether the data is followed strict format.我的方法可以节省azure存储的钱,我只是记录数据,以便您检查数据是否遵循严格的格式。 Surely,you could store them in the blob storage.当然,您可以将它们存储在 blob 存储中。 Just write code to store the Body data into Blob storage as you want inside Azure Function app.只需在 Azure Function 应用程序中编写代码以将Body数据存储到 Blob 存储中。

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

相关问题 错误代码 2200 - json 从 Azure Blob 到 Azure Data Lake Gen2 的数据工厂复制作业“有效负载过大” - Error code 2200 - “payload too large” on data factory copy job of json from Azure Blob to Azure Data Lake Gen2 Azure数据工厂v2数据转换 - Azure Data Factory v2 Data Transformation 带有 Rest API 的 Azure 数据工厂 V2 复制活动为嵌套的 JSON 提供一行 - Azure Data Factory V2 Copy Activity with Rest API giving one row for nested JSON Azure数据工厂V2-解析JSON HTTP GET数据集 - Azure Data Factory V2 - Parsing JSON HTTP GET Dataset 将活动数据工厂 V2 集合引用复制到字符串类型 - Copy Activity Data Factory V2 Collection Refrence to String type Azure 数据工厂 (v2) 中缺少 JSON 标头 - JSON Headers is missing in Azure Data Factory (v2) Azure 数据工厂复制活动 JSON 数据类型转换问题 - Azure Data Factory copy activity JSON data type conversion issue Azure数据工厂复制活动 - Azure Data Factory Copy Activity 如何在Azure Data Factory V2上的Json中为此REST_API编写文件路径 - How to write a file path in Json for this REST_API on Azure Data Factory V2 如何使用PowerShell为Azure Data Factory V2数据集/管道获取有效的JSON? - How can you get valid JSON for Azure Data Factory V2 Datasets/Pipelines using PowerShell?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM