Active IQ Unified Manager Discussions

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

AdaikkappanArumugam
8,496 Views

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

1 ACCEPTED SOLUTION

sinhaa
8,479 Views

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.

View solution in original post

4 REPLIES 4

sinhaa
8,480 Views

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.

AdaikkappanArumugam
8,387 Views

Hi Sinha,

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

 

Regards

Adai

asulliva
8,425 Views

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.

AdaikkappanArumugam
8,386 Views

Hi Andrew,

               I am using http and not https.

 

Regards

Adai

Public