AnsweredAssumed Answered

ExecuteProcess SOAP call to PAM from PowerShell

Question asked by rob.mccoy on Apr 11, 2014
Latest reply on Apr 11, 2014 by rob.mccoy

First, I'm not a programmer. I have as much knowledge of what SOAP is and how it works as I do about what happens when I turn the key in my ignition.  I've successfully written a c# program to call PAM with SOAP to execute a process, but I'm trying to do the same in PowerShell.  I'm not having much luck.  Does anyone know what I'm doing wrong in this code?

function Execute-SOAPRequest 
        [Xml]    $SOAPRequest, 
        [String] $URL 
        write-host "Sending SOAP Request To Server: $URL" 
        $soapWebRequest = [System.Net.WebRequest]::Create($URL) 

        $soapWebRequest.ContentType = "text/xml;charset=`"utf-8`"" 
        $soapWebRequest.Accept      = "text/xml" 
        $soapWebRequest.Method      = "POST" 
        write-host "Initiating Send." 
        $requestStream = $soapWebRequest.GetRequestStream() 
        write-host "Send Complete, Waiting For Response." 
        $resp = $soapWebRequest.GetResponse() 
        $responseStream = $resp.GetResponseStream() 
        $soapReader = [System.IO.StreamReader]($responseStream) 
        $ReturnXml = [Xml] $soapReader.ReadToEnd() 
        write-host "Response Received."
        return $ReturnXml 

$url = 'http://ourpamserver/itpam/soap'
$soap = [xml]@'
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="" xmlns:itp="">
               <itp:param name="Mozart">Symphony</itp:param>

$ret = Execute-SOAPRequest $soap $url