title: How to add WS security element to SOAP request on powershell?
body: <p>I got pretty standard powershell script that sends request to web service:</p>
  
  <pre><code>$ws = New-WebServiceProxy -uri "http://server:7801/path/service?wsdl"
  $ws | get-member -type method
  $ws.service.OverloadDefinitions
  
  $header = New-Object Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1801_service_wsdl.header
  $data = New-Object Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1801_esb_service_wsdl.data
  
  # $header
  # $data
  
  $header.channel = ...
  $data.Password = ...     
  $bar = $ws.service($header, $data)
  </code></pre>
  
  <p>It works fine, and now I want to add oasis ws-security component to the request's SOAP header:</p>
  
  <pre><code>&lt;wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt;
  &lt;wsse:UsernameToken&gt;
  &lt;wsse:Username&gt;Yolo McSwaggen&lt;/wsse:Username&gt;
  &lt;/wsse:UsernameToken&gt;
  &lt;/wsse:Security&gt;
  </code></pre>
  
  <p>How do I do it?</p>