PowerShell Logo Small

New-WebServiceProxy



This is the built-in help made by Microsoft for the command 'New-WebServiceProxy', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Creates a Web service proxy object that lets you use and manage the Web service in Windows PowerShell.

SYNTAX


New-WebServiceProxy [-Uri] <Uri> [[-Class] [<String>]] [[-Namespace] [<String>]] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}]
[-InformationVariable [<System.String>]] [<CommonParameters>]
New-WebServiceProxy [-Uri] <Uri> [[-Class] [<String>]] [[-Namespace] [<String>]] [-Credential [<PSCredential>]] [-InformationAction {SilentlyContinue | Stop | Continue |
Inquire | Ignore | Suspend}] [-InformationVariable [<System.String>]] [<CommonParameters>]
New-WebServiceProxy [-Uri] <Uri> [[-Class] [<String>]] [[-Namespace] [<String>]] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}]
[-InformationVariable [<System.String>]] [-UseDefaultCredential] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The New-WebServiceProxy cmdlet lets you use a Web service in Windows PowerShell. The cmdlet connects to a Web service and creates a Web service proxy object in Windows
PowerShell. You can use the proxy object to manage the Web service.


A Web service is an XML-based program that exchanges data over a network, particularly over the Internet. The Microsoft .NET Framework provides Web service proxy objects
that represent the Web service as a .NET Framework object.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=293890
New-Service

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>$zip = New-WebServiceProxy -Uri http://www.webservicex.net/uszip.asmx?WSDL



This command uses the New-WebServiceProxy command to create a .NET Framework proxy of the US Zip Web service in Windows PowerShell.










-------------------------- EXAMPLE 2 --------------------------

PS C:\>$URI = "http://www.webservicex.net/uszip.asmx?WSDL"
PS C:\>$zip = New-WebServiceProxy -Uri $URI -Namespace WebServiceProxy -Class USZip



This command uses the New-WebServiceProxy cmdlet to create a .NET Framework proxy of the US Zip Web service.

The first command stores the URI of the Web service in the $URI variable.

The second command creates the Web service proxy. The command uses the URI parameter to specify the URI and the Namespace and Class parameters to specify the namespace and
class of the object.










-------------------------- EXAMPLE 3 --------------------------

PS C:\>$zip | get-member -type method

TypeName: WebServiceProxy.USZip
Name MemberType Definition
---- ---------- ----------
Abort Method System.Void Abort(
BeginGetInfoByAreaCode Method System.IAsyncResul
BeginGetInfoByCity Method System.IAsyncResul
BeginGetInfoByState Method System.IAsyncResul
BeginGetInfoByZIP Method System.IAsyncResul
CreateObjRef Method System.Runtime.Rem
Discover Method System.Void Discov
Dispose Method System.Void Dispos
EndGetInfoByAreaCode Method System.Xml.XmlNode
EndGetInfoByCity Method System.Xml.XmlNode
EndGetInfoByState Method System.Xml.XmlNode
EndGetInfoByZIP Method System.Xml.XmlNode
Equals Method System.Boolean Equ
GetHashCode Method System.Int32 GetHa
GetInfoByAreaCode Method System.Xml.XmlNode
GetInfoByCity Method System.Xml.XmlNode
GetInfoByState Method System.Xml.XmlNode
GetInfoByZIP Method System.Xml.XmlNode
GetLifetimeService Method System.Object GetL
GetType Method System.Type GetTyp
InitializeLifetimeService Method System.Object Init
ToString Method System.String ToSt



This command uses the Get-Member cmdlet to display the methods of the Web service proxy object in the $zip variable. We will use these methods in the following example.

Notice that the TypeName of the proxy object, WebServiceProxy, reflects the namespace and class names that were specified in the previous example.






-------------------------- EXAMPLE 4 --------------------------

PS C:\>$zip.getinfobyzip(20500).table
CITY : Washington
STATE : DC
ZIP : 20500
AREA_CODE : 202
TIME_ZONE : E



This command uses the Web service proxy stored in the Zip variable. The command uses the GetInfoByZip method of the proxy and its Table property.