使用Powershell脚本调用WebRequest

使用Powershell脚本调用WebRequest,powershell,Powershell,我不熟悉脚本。当我尝试使用xml输入的web服务时,我遇到了一些错误 当我尝试调用WebRequest时,获取了xml的内容 [xml]$sun= Invoke-WebRequest -Uri $uri -CalculateTax post -ContentType "String" -InFile $Input.OuterXml. 其中,$uri是具有服务url的变量 CalculateAX是服务的方法 $Input是包含XML内容的变量 将错误获取为 Invoke-WebRequest :

我不熟悉脚本。当我尝试使用xml输入的web服务时,我遇到了一些错误

当我尝试调用WebRequest时,获取了xml的内容

[xml]$sun= Invoke-WebRequest -Uri $uri -CalculateTax post -ContentType "String" -InFile $Input.OuterXml.
其中,$uri是具有服务url的变量 CalculateAX是服务的方法 $Input是包含XML内容的变量 将错误获取为

Invoke-WebRequest : A parameter cannot be found that matches parameter name 'CalculateTax'.   
+    [xml]$sun= Invoke-WebRequest -Uri $uri -CalculateTax Post -ContentType "string"  ...
+                                        ~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

请帮助我处理此问题。

好的,
Invoke-WebRequest
cmdlet中没有
-calculateAX
参数。这就是你看到的错误

PS C:\> Get-Command Invoke-WebRequest -Syntax

Invoke-WebRequest [-Uri] <uri> [-UseBasicParsing] [-WebSession <WebRequestSession>] [-SessionVariable <string>]
[-Credential <pscredential>] [-UseDefaultCredentials] [-CertificateThumbprint <string>] [-Certificate
<X509Certificate>] [-UserAgent <string>] [-DisableKeepAlive] [-TimeoutSec <int>] [-Headers <IDictionary>]
[-MaximumRedirection <int>] [-Method <WebRequestMethod>] [-Proxy <uri>] [-ProxyCredential <pscredential>]
[-ProxyUseDefaultCredentials] [-Body <Object>] [-ContentType <string>] [-TransferEncoding <string>] [-InFile <string>]
[-OutFile <string>] [-PassThru] [<CommonParameters>]

嗯,
Invoke-WebRequest
cmdlet中没有
-calculateAX
参数。这就是你看到的错误

PS C:\> Get-Command Invoke-WebRequest -Syntax

Invoke-WebRequest [-Uri] <uri> [-UseBasicParsing] [-WebSession <WebRequestSession>] [-SessionVariable <string>]
[-Credential <pscredential>] [-UseDefaultCredentials] [-CertificateThumbprint <string>] [-Certificate
<X509Certificate>] [-UserAgent <string>] [-DisableKeepAlive] [-TimeoutSec <int>] [-Headers <IDictionary>]
[-MaximumRedirection <int>] [-Method <WebRequestMethod>] [-Proxy <uri>] [-ProxyCredential <pscredential>]
[-ProxyUseDefaultCredentials] [-Body <Object>] [-ContentType <string>] [-TransferEncoding <string>] [-InFile <string>]
[-OutFile <string>] [-PassThru] [<CommonParameters>]

谢谢你,拉维。我使用了新的WebServiceProxy。它为CalculateTax方法创建了代理。谢谢Ravi。我使用了新的WebServiceProxy。它创建了CalculateTax方法的代理。