Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I access a web service from PowerShell?

Tags:

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?

like image 921
tangens Avatar asked Jan 07 '10 18:01

tangens


People also ask

How do you access the Web in PowerShell?

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.

How do I view services in PowerShell?

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.

How do you call a SOAP web service in PowerShell?

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.


1 Answers

# 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 
like image 141
doer Avatar answered Oct 23 '22 03:10

doer