簡體   English   中英

如何在 AWS Lambda 的測試事件頁面中測試 xml 請求

[英]How to test xml request in test event page for AWS Lambda

我有一個 lambda function,我想使用 API 代理測試事件頁面來測試它。 問題是當我在正文值中添加 xml 時,出現錯誤。 如何在請求中發送 xml 作為正文?

Error:
Execution result: succeeded(logs)
Details
The area below shows the last 4 KB of the execution log.
{
  "statusCode": 500,
  "headers": {
    "Content-Type": "application/json",
    "Access-Control-Allow-Origin": "*",
    "X-Content-Type-Options": "nosniff"
  },
  "body": "Error processing incoming requestUnexpected character encountered while     parsing value: <. Path '', line 0, position 0.",
  "isBase64Encoded": false
}




Event Json:

{
  "body": "<AgentSearchRequest><agentNumber></agentNumber><locNumber>023000</locNumber><applicationName>ISY</applicationName><companyNumber>0</companyNumber><subCompanyNumber>0</subCompanyNumber><futureUse></futureUse></AgentSearchRequest>",
  "resource": "/{proxy+}",
  "path": "/api/AgentSearchCore",
  "httpMethod": "POST"
}

我在我的 c# 代碼中發現了這個問題。 它試圖將請求反序列化為 JSON 而不是 XML。我使用了 XML 序列化器,它工作正常。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM