Video Screencast Help

Powershell 3.0 Invoke-WebRequest for WF service

Created: 17 Jul 2013 | 1 comment

I am using Powershell to trigger a Decision Only workflow using the Invoke-WebRequest command. However, I want this workflow to use authentication. How do you pass authentication with powershell?

EXAMPLE:

$uri = "https://workflowserver/Demo/MyService.asmx?WSDL"

$soap = @'

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

<soap:Body>

<Execute xmlns="www.symantec.com" />

</soap:Body>

</soap:Envelope>

'@

[xml]$WF = Invoke-WebRequest $uri -Method post -ContentType "text/xml" -Body $soap

write

$wf.Envelope.Body.ExecuteResponse.ExecuteResult

Comments 1 CommentJump to latest comment

noodleNT's picture

Figured it out...

[xml]$WF = Invoke-WebRequest $uri -UseDefaultCredentials -Method post -ContentType "text/xml" -Body $soap