Friday, December 1, 2017

Mocking a Web Service with NetCat

Write the web service's response(xml, json, plain text) in a file, and then run the following in a terminal:
$ while true; do echo -e "HTTP/1.1 200 OK\r\n\r\n$(cat wsresponse.file)" | nc -l 9999; done

Where wsresponse.file is the file with the web service response.

In this case, the web service mock is listening in the port 9999. Just change the port as your needs.


Related Posts:

0 comments:

Post a Comment

Popular Posts

Recent Posts

Unordered List

Text Widget

Pages

Search This Blog

Powered by Blogger.