Subscribe
Accepted Solution

(505) Http Version Not Supported error when invoking workflow via Invoke-RestMethod

Hi WFA gurus,

            I am invoking a WFA workflow using Invoke-RestMethod in PSv3/PSv4. When I invoke the script to call the workflow via rest it fails with the following error.

 

PS H:\> Invoke-Rest.ps1
Invoke-RestMethod : The remote server returned an error: (505) Http Version Not Supported.
At H:\Invoke-Rest.ps1:58 char:22
+ [xml]$executionXML = Invoke-RestMethod -Method Post -Credential $credential -Uri ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

 

Where as if invoke the workflow with postman rest client and then run the same script it works perfectly fine.

 

So not sure what is the difference and the cause when its invoked via PS for the first time.

 

Anyone encountered this earlier ? 

 

BTW here is the snippet of my invoke

[xml]$executionXML = Invoke-RestMethod -Method Post -Credential $credential -Uri $workflowExecutionUri -body $XMLObject -ContentType "application/xml"

 

Regards

Adai

Re: (505) Http Version Not Supported error when invoking workflow via Invoke-RestMethod

This error is normally not seen with Invoke-RestMethod. But, if its has, you can try this. Type the below line before calling the Invoke-RestMethod.

 

[System.Net.ServicePointManager]::Expect100Continue = $false

 

sinhaa 

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Re: (505) Http Version Not Supported error when invoking workflow via Invoke-RestMethod

Adai,

 

Are you using HTTP or HTTPS to connecto to the WFA server for the REST operatoin?

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Re: (505) Http Version Not Supported error when invoking workflow via Invoke-RestMethod

Hi Sinha,

                  Thanks this seems to work. Will update if there is any failure during the course of testing.

 

Regards

Adai

Re: (505) Http Version Not Supported error when invoking workflow via Invoke-RestMethod

Hi Andrew,

               I am using http and not https.

 

Regards

Adai