执行从PowerShell的单向WCF服务操作 [英] Execute a one-way wcf service operation from powershell
问题描述
我有每个小时执行PowerShell脚本计划任务。 PowerShell脚本必须调用一个单向的WCF服务操作。本质上,它只是需要启动的操作。我的问题是我怎么去这样做?我以为只是执行URL实际上会揭开序幕的请求,但显然这是不正确的。
I have a scheduled task which executes a powershell script every hour. The powershell script must make a call to a one-way WCF service operation. Essentially it just needs to kick off an operation. My question is how do I go about doing that? I thought that just executing the url would in fact kick off the request but apparently that is not correct.
下面是什么,我试图做的:
Here is what I was trying to do:
$request = [System.Net.WebRequest]::Create("http://myserver.com/myservice/dosomething")
$request.GetResponse()
该操作不接受参数并返回void。
The operation accepts no parameters and returns void.
推荐答案
的PowerShell 2.0使得这个平凡的新WebServiceProxy cmdlet的,例如:
PowerShell 2.0 makes this trivial with the New-WebServiceProxy cmdlet e.g.:
$zip = New-WebServiceProxy -uri http://www.webservicex.net/uszip.asmx?WSDL
$zip.getinfobyzip(20500).table
CITY : Washington
STATE : DC
ZIP : 20500
AREA_CODE : 202
TIME_ZONE : E
这篇关于执行从PowerShell的单向WCF服务操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!