在设置中的Http action-chunking选项中处理大消息无效. [英] Handle large messages in Http action- chunking option in settings doesn't work.

查看:81
本文介绍了在设置中的Http action-chunking选项中处理大消息无效.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Http操作从逻辑应用程序中命中REST Api.但是这些服务的回应非常内容长度约为的大消息" 29561777"依次显示在逻辑应用程序中,如下所示:

I'm trying to hit a REST Api from logic app using Http action. But the services responds with a very  large message having Content-Length of about  " 29561777 " which in turn is displayed in logic app as shown below :

输出:

点击下载

现在,我不能在下一个动作中使用此输出.并且我还尝试了允许分块"设置中的选项并添加内容范围"标头,以字节为单位.

Now , I cannot use this output for my very next action  and I have also tried "allow chunking" option in settings and adding  "Content-Range " header to provide size in bytes .

类似于此:  范围" "bytes = 0-1023"

Similar to this :  "headers": { "Range": "bytes=0-1023" },

Please let me know, is it possible to fix this issue and if yes how ?



推荐答案

要通过HTTP从端点下载分块消息,该端点必须支持部分内容请求,或者为 chunked 下载.当您的逻辑应用程序向端点发送HTTP GET请求以下载内容时,该端点以"206"响应.状态码,响应中包含分块的内容. Logic Apps无法控制端点是否支持 部分要求.但是,当您的逻辑应用程序获得第一个"206"时,响应,您的逻辑应用程序会自动发送多个请求以下载所有内容.

To download chunked messages from an endpoint over HTTP, the endpoint must support partial content requests, or chunked downloads. When your logic app sends an HTTP GET request to an endpoint for downloading content, and the endpoint responds with a "206" status code, the response contains chunked content. Logic Apps can't control whether an endpoint supports partial requests. However, when your logic app gets the first "206" response, your logic app automatically sends multiple requests to download all the content.

要检查端点是否可以支持部分内容,请发送HEAD请求.该请求可帮助您确定是否 响应中包含 接受范围 建议 sans-serif>范围

To check whether an endpoint can support partial content, send a HEAD request. This request helps you determine whether the response contains the Accept-Ranges header. That way, if the endpoint supports chunked downloads but doesn't send chunked content, you can suggest this option by setting the Range header in your HTTP GET request.

这些步骤描述了Logic Apps用于将分块内容从端点下载到您的逻辑的详细过程 应用:

These steps describe the detailed process Logic Apps uses for downloading chunked content from an endpoint to your logic app:

  1. 您的逻辑应用将HTTP GET请求发送到端点.

请求标头可以选择包含一个; 范围

The request header can optionally include a Range field that describes a byte range for requesting content chunks.

  1. 端点以"206"响应状态代码和HTTP消息正文.

有关此块中内容的详细信息出现在响应的 内容范围

Details about the content in this chunk appear in the response's Content-Range header, including information that helps Logic Apps determine the start and end for the chunk, plus the total size of the entire content before chunking.

  1. 您的逻辑应用会自动发送后续的HTTP GET请求.

您的逻辑应用发送了后续信息GET请求,直到检索到全部内容.

"getAction": {
    "inputs": {
        "headers": {
            "Range": "bytes=0-1023"
        },
       "method": "GET",
       "uri": "http://myAPIendpoint/api/downloadContent"
    },
    "runAfter": {},
    "type": "Http"
}


GET请求设置"Range".到"bytes = 0-1023"的报头,这是字节的范围.如果端点 支持部分内容请求,端点以请求范围内的内容块作为响应.基于该端点,范围"的确切格式被指定为"Range".标头字段可以不同.


The GET request sets the "Range" header to "bytes=0-1023", which is the range of bytes. If the endpoint supports requests for partial content, the endpoint responds with a content chunk from the requested range. Based on the endpoint, the exact format for the "Range" header field can differ.

另一种方法是,您可以使用compose动作来组合来自API的响应如果是json回应,您可以使用Parse json动作解析并处理回应 根据您的要求.我已经从json创建了一个HTML表,如下所示

Other way around is you can compose the response from the API using compose action and if it is a json response you can parse it using Parse json action and process the response as per your requirement. I have created a HTML table from the json as shown below

下面是您的LA的json代码视图:

Below is json code view of your LA:

{
    "definition": {
        "


schema":"https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#" , 操作":{ 撰写":{ "inputs":"@ body('HTTP')", " runAfter" ;: { "HTTP":[ 成功";成功". ] }, 类型":撰写" }, " Create_HTML_table" ;: { 输入":{ 格式":"HTML", " from" ;:" @body('Parse_JSON')?['stationBeanList']" }, " runAfter" ;: { " Parse_JSON&qu​​ot;:[ 成功";成功". ] }, 类型":表" }, "HTTP":{ 输入":{ 标题":{ 范围":"bytes = 0-1023" }, "method":"GET", "uri":"https://feeds.citibikenyc.com/stations/stations.json" }, " runAfter":{}, "runtimeConfiguration":{ "contentTransfer":{ "transferMode":"Chunked" } }, "type":"Http" }, " Parse_JSON&qu​​ot ;: { 输入":{ "content":"@ outputs('Compose')", 模式":{ 属性":{ "stationBeanList":{ "items":{ 属性":{ 海拔":{ "type":"string" }, "availableBikes":{ 类型":数字" }, "availableDocks":{ 类型":数字" }, 城市":{ "type":"string" }, "id":{ "type":"integer" }, "landMark":{ "type":"string" }, "lastCommunicationTime":{ "type":"string" }, 纬度":{ 类型":数字" }, 位置":{ "type":"string" }, 经度":{ 类型":数字" }, "postalCode":{ "type":"string" }, "stAddress1":{ "type":"string" }, "stAddress2":{ "type":"string" }, "stationName":{ "type":"string" }, "statusKey":{ "type":"integer" }, "statusValue":{ "type":"string" }, "testStation":{ 类型":布尔" }, "totalDocks":{ "type":"integer" } }, 必填":[ "id", "stationName", "availableDocks", "totalDocks", 纬度", 经度", "statusValue", "statusKey", "availableBikes", "stAddress1", "stAddress2", 城市", "postalCode", 位置", 海拔", "testStation", "lastCommunicationTime", "landMark" ], 类型":对象" }, "type":"array"; } }, 类型":对象" } }, " runAfter" ;: { 撰写":[ 成功";成功". ] }, 类型":"ParseJson" }, 响应":{ 输入":{ "body":"@ body('Create_HTML_table')", 标题":{ "Content-Type":"text/html"; }, "statusCode":200 }, " runAfter" ;: { "Create_HTML_table":[ 成功";成功". ] }, "type":"Response" } }, "contentVersion":"1.0.0.0", 输出":{}, "parameters":{}, 触发器":{ 请求":{ 输入":{ "method":"GET", 模式":{} }, "kind":"Http", 类型":请求" } } } }
schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", "actions": { "Compose": { "inputs": "@body('HTTP')", "runAfter": { "HTTP": [ "Succeeded" ] }, "type": "Compose" }, "Create_HTML_table": { "inputs": { "format": "HTML", "from": "@body('Parse_JSON')?['stationBeanList']" }, "runAfter": { "Parse_JSON": [ "Succeeded" ] }, "type": "Table" }, "HTTP": { "inputs": { "headers": { "Range": "bytes=0-1023" }, "method": "GET", "uri": "https://feeds.citibikenyc.com/stations/stations.json" }, "runAfter": {}, "runtimeConfiguration": { "contentTransfer": { "transferMode": "Chunked" } }, "type": "Http" }, "Parse_JSON": { "inputs": { "content": "@outputs('Compose')", "schema": { "properties": { "stationBeanList": { "items": { "properties": { "altitude": { "type": "string" }, "availableBikes": { "type": "number" }, "availableDocks": { "type": "number" }, "city": { "type": "string" }, "id": { "type": "integer" }, "landMark": { "type": "string" }, "lastCommunicationTime": { "type": "string" }, "latitude": { "type": "number" }, "location": { "type": "string" }, "longitude": { "type": "number" }, "postalCode": { "type": "string" }, "stAddress1": { "type": "string" }, "stAddress2": { "type": "string" }, "stationName": { "type": "string" }, "statusKey": { "type": "integer" }, "statusValue": { "type": "string" }, "testStation": { "type": "boolean" }, "totalDocks": { "type": "integer" } }, "required": [ "id", "stationName", "availableDocks", "totalDocks", "latitude", "longitude", "statusValue", "statusKey", "availableBikes", "stAddress1", "stAddress2", "city", "postalCode", "location", "altitude", "testStation", "lastCommunicationTime", "landMark" ], "type": "object" }, "type": "array" } }, "type": "object" } }, "runAfter": { "Compose": [ "Succeeded" ] }, "type": "ParseJson" }, "Response": { "inputs": { "body": "@body('Create_HTML_table')", "headers": { "Content-Type": "text/html" }, "statusCode": 200 }, "runAfter": { "Create_HTML_table": [ "Succeeded" ] }, "type": "Response" } }, "contentVersion": "1.0.0.0", "outputs": {}, "parameters": {}, "triggers": { "Request": { "inputs": { "method": "GET", "schema": {} }, "kind": "Http", "type": "Request" } } } }


这篇关于在设置中的Http action-chunking选项中处理大消息无效.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆