CmdID / PowerShell / Cmdlets / New
New-WebServiceProxy
Creates a Web service proxy object that lets you use and manage the Web service in PowerShell. PowerShell reference
From the PowerShell reference 5 parameters
What it does
Creates a Web service proxy object that lets you use and manage the Web service in PowerShell. The New-WebServiceProxy cmdlet lets you use a Web service in PowerShell. The cmdlet connects to a Web service and creates a Web service proxy object in 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, especially over the Internet. The Microsoft .NET Framework provides Web service proxy objects that represent the Web service as a .NET Framework object.
New-WebServiceProxy [-Uri] <Uri> [[-Class] <String>] [[-Namespace] <String>] [<CommonParameters>]New-WebServiceProxy [-Uri] <Uri> [[-Class] <String>] [[-Namespace] <String>] [-Credential <PSCredential>] [<CommonParameters>]New-WebServiceProxy [-Uri] <Uri> [[-Class] <String>] [[-Namespace] <String>] [-UseDefaultCredential] [<CommonParameters>]
Create a proxy for a Web service
$calc = New-WebServiceProxy -Uri "http://www.dneonline.com/calculator.asmx?wsdl"IdentifyCreate a proxy for a Web service and specify namespace and class
$URI = "http://www.dneonline.com/calculator.asmx?wsdl"
$calc = New-WebServiceProxy -Uri $URI -Namespace "WSProxy" -Class "Calculator"IdentifyDisplay methods of a Web service proxy
$calc | Get-Member -MemberType MethodIdentifyUse a Web service proxy
PS> $calc.Multiply(6,7)
42IdentifyIts page in the reference: New-WebServiceProxy.
Parameters
-ClassSpecifies a name for the proxy class that the cmdlet creates for the Web service. The value of this parameter is used together with the Namespace parameter to provide a fully qualified name for the class. The default value is generated from the Uniform Resource Identifier (URI).-CredentialSpecifies a user account that has permission to perform this action. The default is the current user. This is an alternative to using the UseDefaultCredential parameter.-NamespaceSpecifies a namespace for the new class.
The value of this parameter is used together with the value of the Class parameter to generate a fully qualified name for the class. The default value is Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes plus a type that is generated from the URI.
You can set the value of the Namespace parameter so that you can access multiple Web services that have the same name.-UriSpecifies the URI of the Web service. Enter a URI or the path and filename of a file that contains a service description.
The URI must return an .asmx page or to a page that returns a service description. To return a service description of a Web service that was created using ASP.NET, append "?WSDL" to the URL of the Web service (for example, http://www.contoso.com/MyWebService.asmx?WSDL).-UseDefaultCredentialIndicates that this cmdlet uses the default credential. This cmdlet sets the UseDefaultCredential property in the resulting proxy object to True. This is an alternative to using the Credential parameter.