Book Image

Windows PowerShell for .NET Developers - Second Edition - Second Edition

Book Image

Windows PowerShell for .NET Developers - Second Edition - Second Edition

Overview of this book

Windows PowerShell 5.0 for .NET Developers is your self-start guide to performing automation using Windows PowerShell. This book will help you to understand the PowerShell syntax and grammar and will also teach you techniques to remove the rough edges of manual deployments. Packed with PowerShell scripts and sample C# codes to automate tasks, it also includes real-world scenarios such as administrating office servers to help you save time and perform deployments swiftly and efficiently. The book begins with the Windows PowerShell basics, explores the significant features of Windows Management Framework 5.0, covers the basic concepts of Desired State Configuration and the importance of idempotent deployments. By the end of the book, you will have a good understanding of Windows PowerShell’s features and will be able to automate your tasks and manage configuration effectively.
Table of Contents (13 chapters)

Exploring web services


A web service is generally an XML-based program. Using this, we can exchange data over a network. A web service is nothing but an application component, which works on an open protocol, can be used by other applications, and is reusable.

Web services allow interaction between applications and use standardized XML. Simply put, it's a combination of XML and HTTP. The following components work for all web services:

  • Simple Object Access Protocol (SOAP)

  • Universal Description, Discovery, and Integration (UDDI)

  • Web Services Description Language (WSDL)

In this topic, we will demonstrate the use of web services and complex web services using Windows PowerShell.

Using web services

New-WebServiceProxy is a cmdlet that allows us to create a proxy object of any given valid web service.

For our example, we will use the following web service:

http://www.webservicex.net/CurrencyConvertor.asmx?WSDL

Run the following command:

$var = New-WebServiceProxy -Uri http://www.webservicex.net...