Welcome › Forums › General PowerShell Q&A › How to add WS security element to SOAP request in powershell?
- This topic has 1 reply, 2 voices, and was last updated 3 years, 1 month ago by
Keymaster.
-
AuthorPosts
-
-
November 28, 2017 at 3:08 pm #85060
Hi all,
I have a SOAP request, the example is below.
–
–
–
–
–
– 2017-11-28T06:11:16.669Z
– 2017-11-28T06:515:16.669Z
–
–
– xxx
– PASSWORD
– password
– 2017-11-28T06:11:12.637Z
–
–
–
–
–
– xxx
– yyy
– CSV
–
– zzz
–
– en_US
–
– 2
–
–
–
–
–
– display_options
– default
–
–
–
–
–And I figured out how to add all parameters to the body.
$URL = “https://expedialc.skillwsa.com/olsa/services/Olsa?WSDL”
$proxy = New-WebServiceProxy -Uri $URL$type = $proxy.GetType().Namespace
$mySubmitDT = ($type + ‘.SubmitReportRequest’)
$mySubmit = New-Object($mySubmitDT)
$mySubmit.customerId = “xxx”
$mySubmit.report = “yyy”
$mySubmit.scopingUserId = “zzz”
$mySubmit.language = “en_US”
$mySubmit.duration = 1$reportFormatDT = ($type + ‘.reportFormat’)
$reportFormat = New-Object($reportFormatDT)
$reportFormat.value__ = 2$MapItemtDT = ($type + ‘.MapItem’)
$MapItemt = New-Object($MapItemtDT)
$MapItemt.key = “display_options”
$MapItemt.value = “default”$mySubmit.reportFormat = $reportFormat
$mySubmit.reportParameters = $MapItemt#[xml]$result = $proxy.UD_SubmitReport($mySubmit)
But no idea how to add security header with UserToken and Timestamp.
Thanks,
Tatiana -
November 28, 2017 at 6:14 pm #85079
Note that you can’t paste XML here. You’d need to make it a Gist, and paste the Gist URL, just as with code.
Referencing https://stackoverflow.com/questions/1309767/adding-custom-http-headers-to-web-service-proxy, this isn’t a straightforward thing. Because the proxy class is an abstraction, you’d need to do some heavier .NET coding in order to add custom HTTP headers. The WebServiceProxy command itself is meant to be simplistic, and it doesn’t support custom headers.
-
-
AuthorPosts
- The topic ‘How to add WS security element to SOAP request in powershell?’ is closed to new replies.