Web services 使用Powershell在web服务上调用异步web方法

Web services 使用Powershell在web服务上调用异步web方法,web-services,powershell,Web Services,Powershell,我正在使用PowerShell V2,并试图找到一个使用web服务代理调用异步web方法的示例: 以下是我目前掌握的代码: $Uri = "http://localhost/mywebservice.asmx?wsdl" $proxy = New-WebServiceProxy -Uri $Uri -UseDefaultCredential web服务具有以下方法 Beginfo EndFoo fooancy *食物完成* 希望这是有意义的这里有一个使用BeginInvoke/EndInv

我正在使用PowerShell V2,并试图找到一个使用web服务代理调用异步web方法的示例:

以下是我目前掌握的代码:

$Uri = "http://localhost/mywebservice.asmx?wsdl" 

$proxy = New-WebServiceProxy -Uri $Uri -UseDefaultCredential
web服务具有以下方法 Beginfo EndFoo fooancy *食物完成*


希望这是有意义的

这里有一个使用BeginInvoke/EndInvoke的示例。运行
$ar | Get Member
查看IAsyncResult对象上还有哪些其他方法和属性可用

PS> $zip = New-WebServiceProxy -uri http://www.webservicex.net/uszip.asmx?WSDL
PS> $ar = $zip.BeginGetInfoByAreaCode("970", $null, $null)

... other PS script ...

# Now join the async work back to the PowerShell thread, wait for completion
# and grab the result. WaitOne returns false on timeout, true if signaled.
PS> $ar.AsyncWaitHandle.WaitOne([timespan]'0:0:5')
True
PS> $ar.IsCompleted
True
PS> $res = $zip.EndGetInfoByAreaCode($ar)
PS> $res.Table


CITY      : Whitewater
STATE     : CO
ZIP       : 81527
AREA_CODE : 970
TIME_ZONE : M

CITY      : Wiggins
STATE     : CO
ZIP       : 80654
AREA_CODE : 970
TIME_ZONE : M

谢谢Keith我明天早上会测试的