Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I POST an XML string to a webservice for testing? [closed]

Tags:

We have developed a RESTful web service which expects an XML string to arrive as "parameter". For QA to test the web service, I am looking for a simple way to POST an XML string to a URL, then display the XML response from the server.

Is there an easy way to POST an XML string to a URL?

like image 910
Priyank Avatar asked Aug 07 '09 12:08

Priyank


People also ask

How do I POST XML to the server?

To post XML data to the server, you need to make an HTTP POST request, include the XML in the body of the request message, and set the correct MIME type for the XML. The correct MIME type for XML is application/xml.

Can we test XML in Postman?

The new Postman app also supports collections of tests that can be run as a suite. However, I needed to test the web services of an application with REST endpoints and XML request payloads and responses. The test orchestration needed dynamic payloads, dynamic parameters, and test routing.


2 Answers

Get the Firefox Poster add-on.

A developer tool for interacting with web services and other web resources that lets you make HTTP requests, set the entity body, and content type. This allows you to interact with web services and inspect the results.

like image 61
ohnoes Avatar answered Sep 22 '22 21:09

ohnoes


I used wget for that, there are Windows and Linux versions. Not GUI either but no need of graphical interface for such simple task.

For example:

wget "http://url_of_my_web_service?param1=123&param2=abc" --post-file="xmlTestFile.xml" --header="Content-Type:text/xml" 

Where the xmlTestFile.xml it's an xml file in the same directory you run the wget command.

If you want to send a xml string instead of a xml file, use --post-data="string"

like image 35
David Aleu Avatar answered Sep 24 '22 21:09

David Aleu