简体   繁体   中英

How to test xml request in test event page for AWS Lambda

I have a lambda function and I want to test it using the API Proxy test event page. The problem is when I add the xml inside the body value, i get an error. How do I send xml as the body in a request?

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

I found the issue in my c# code. It was trying to deserialize the request as JSON Instead of XML. I used an XML Serializer and it works fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM