asyrjasalo / RESTinstance

Robot Framework library for RESTful JSON APIs
https://pypi.org/project/RESTinstance
GNU Lesser General Public License v3.0
205 stars 84 forks source link

Unable to send XML payload in the form of key - value pair for a POST request in robot framework #97

Closed Manisha0421 closed 3 years ago

Manisha0421 commented 4 years ago

Hi,

I have to make a POST request through SOAP to a URL by providing the payload as an XML file in the form of a key value pair, like xml: "content of XML file"

The code is able to read the XML file correctly and displays the content of the file but when making the POST request, it gives "

HTTP/1.1 400 Unable to get data [ xml is required]"

Note: This request is being sent using robot framework script; The same request is working fine with the same XML when sending the request via Postman.

Robot file code: Create Session soap ${URLService} verify=False ${file_data} Get Binary File ${Transaction_Request} Log ${file_data} ${files}= Create Dictionary xml ${file_data} ${headers}= Create Dictionary Content-Type=application/xml ${resp}= Post Request alias=soap uri=${URLComponentDateRangeAPI} files=${files} headers=${headers} Log ${resp.content} ${root}= Parse Xml ${resp.content} log ${root.tag}

Output for POST request:

<?xml version="1.0" encoding="UTF-8"?>

ErrorMessage HTTP/1.1 400 Unable to get data [ xml is required ]

Can anybody help resolve this issue.

Thanks & Regards

testautomation commented 4 years ago

I had same issue in the past. POSTing xml payloads was not supported by this library - not sure if that has changed @asyrjasalo? Use robotfamework-requestlibrary instead for sending xml.

Atihinen commented 3 years ago

Hi!

At the moment we don't have any plans to start support XML with RESTInstance, please use the robotframework-requestlibrary instead for the time being.

wlad commented 2 years ago

@Atihinen any news on supporting XML payloads?

EDIT: ignore my question, I just saw a recent comment of your's which is related.