AWS API Gateway接受内容类型:application/xml [英] AWS API Gateway accept Content-type: application/xml

查看:208
本文介绍了AWS API Gateway接受内容类型:application/xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于AWS API Gateway的问题.

I've got a question about AWS API Gateway..

我想将其他公司的API处理到我自己的AWS dynamoDB中. 他们只能发布格式化为我的API的XML. 我的设置是API网关-> Lambda-> DynamoDB.

I want to process an other companies API into my own dynamoDB in AWS. They can only POST an XML formatted to my API. My setup is API Gateway -> Lambda -> DynamoDB.

但是如何以我接受他们发布的XML的方式来设置API网关POST?

But how can do set up a API Gateway POST in such a way that i accepts the XML posted by them?

链接到其XML Post设置(仅是上行数据): http://zakelijke-community.kpn.com/t5/Data/Application-data-API/ta-p/4768

Link to their XML Post setup (it's just the uplink data): http://zakelijke-community.kpn.com/t5/Data/Application-data-API/ta-p/4768

推荐答案

您可以为"application/xml"定义请求映射模板,该模板将在客户端发送"application/xml"的"Content-Type"标头时触发".

You can define a request mapping template for "application/xml" which will be triggered when the client sends a "Content-Type" header of "application/xml".

虽然API网关尚未提供对XML的一流支持,但您只需在JSON字符串字段中将XML有效负载发送到Lambda:

While API Gateway doesn't yet offer first-class support for XML, you can simply send the XML payload to Lambda in a JSON string field:

{ 
   "bodyXml" : "$input.body"
}

在Lambda函数中,您可以使用您选择的XML解析库来处理XML.

In your Lambda function, you can use your XML parsing library of choice to process the XML.

希望这会有所帮助, 瑞安

Hope this helps, Ryan

这篇关于AWS API Gateway接受内容类型:application/xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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