Share via


PowerShell WebService SOAP Post Test

I recently had to test a POST to WCF services through a production server.

As I could not install test tools (eg SOAP UI) I tested using PowerShell and Invoke-WebRequest.

Here are the steps I took to take the test:

 

$URI = "WebService URL"
$Result = (iwr $URI -InFile C:\TEMP\InputData.xml -contentType "text/xml" -Method POST)
$Result.Content | Export-XML –Path C:\Temp\Result.xml

Where:

$URI = The WebService URL with wsdl

InputData.xml = The XML with the input parameters for the SOAP request