I'd like to access a web service with a given (simple) WSDL from within Windows PowerShell.
Is there an easy way to do this?
The Windows PowerShell Web Access web application is now configured to use your signed SSL certificate. You can access Windows PowerShell Web Access by opening https://<server_name>/pswa in a browser window.
To find the service name and display name of each service on your system, type Get-Service . The service names appear in the Name column, and the display names appear in the DisplayName column.
Invoke-WebRequest First, this is the old, cumbersome way that I would have used to call a SOAP web service from PowerShell. Create a credential object, define the body (copied from the request created by SoapUI) then call with Invoke-WebRequest setting the credential, content-type, headers and body.
# Working example of how to use PowerShell (version >= 2) to access a web service. $svc = New-WebServiceProxy –Uri ‘http://www.webservicex.net/stockquote.asmx?WSDL’ $svc | Get-Member # Use Get-Member to discover the interface of a web service. # Get stock quotes. $svc.GetQuote(‘BA’) # Boeing $svc.GetQuote(‘AMZN’) # Amazon $svc.GetQuote(‘SBUX’) # Starbucks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With