Pergunta

All,

I am trying to access a restful API via PowerShell. The API requires several non-standard headers so I am using the $request.Headers.Add() syntax.

I am getting a (500) Internal Server error so I know I am nowhere close.

I can't use WireShark because the endpoint is Https.

How can I build a HttpWebRequest object in PowerShell and view the Raw XML?

Here is the simple code:

$concat = EncodeBase64("$($username)@$($org):$($password)")

$request = [System.Net.HttpWebRequest]::Create($URL);
$request.Method = "POST";
$request.ContentType = "application/vnd.vmware.vcloud.session+xml;version1.5";
$request.Headers.Add("x-vcloud-authorization", $concat);

Thanks!

Foi útil?
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top