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