Execute a one-way wcf service operation from powershell

后端 未结 5 1735
情歌与酒
情歌与酒 2021-02-06 12:52

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

5条回答
  •  独厮守ぢ
    2021-02-06 13:29

    HTTP replay approach:

    1. Install Fiddler, run it and start recording requests
    2. invoke the WCF service using the 'normal' client (record the request)
    3. use Invoke-WebRequest - replay the XML SOAP request body and some headers, be sure to match the headers: Content-Type, SOAPAction, and possibly others
    4. repeat (3) and keep tweaking the body and headers until you have a valid SOAP request

    You don't have to use WCF to call a WCF service, you can mimic one with 3-4 changes from HTTP defaults. Just don't try to building the SOAP envelope yourself. But it's safe to replay everything you need from Fiddler over 'plain' HTTP.

提交回复
热议问题