Saturday, January 26, 2013

Using curl to test asmx web services

This is an example of how to use curl to test a classic asmx service by hand. In this example, the service is located at http://localhost:52573/Pizza.asmx

1. Go to the web service help page and copy the SOAP 1.2 example request.

2. Paste the example into your favorite text edit and save it as request.xml.

3. Remove the header and fill in the placeholders

4. Open PowerShell at the folder containing your example. And use this command:

curl -H 'Content-Type: application/soap+xml; charset=utf-8' -d '@request.xml' http://localhost:52573/Pizza.asmx

The '@ syntax' used in @request instructs curl to use the file contents as post data. You might have to use the --ntlm and -u if you have authentication problems.

1 comment:

Dominic said...

Thank you. Your post has helped me.