I am attempting to call a web service from a powershell script.
I am not the author of the web service, nor do I know much about web services. (I'm only ramping up in PowerShell, as well.)
The vendor of the web software has provided me with a .wsdl file. I ran wsdl.exe against it, then csc.exe against the .cs file that was generated, in order to produce proxy .dll files.
In my powershell script, I am instantiating an object, setting its url property and attempting to call one of the methods:
[Reflection.Assembly]::LoadFrom("$ProxyDllPath\VendorProxy.dll")
$myVar = new-object VendorObject
$myVar.url = "http://servername/serverdirectory/serverfile.asmx"
$myStuff = $myVar.GetStuff()
When I execute this, I get the exception:
Exception calling "GetStuff" with "0" argument(s): "Server did not recognize the value of HTTP Header SOAPAction: ."
At C:\users\xxx\desktop\xxx.ps1:56 char:55
+ $myStuff = $myVar.GetStuff<<<< ()
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
I have taken a network capture of my call and see:
POST /serverdirectory/serverfile.asmx HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.4927)
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Authorization: NTLM TlRMTVNTUAABAAAAt4II4gAAAAAAAAAAAAAAAAAAAAAGAbAdAAAADw==
Host: servername
Content-Length: 0
The WSDL description for this webservice is:
<wsdl:operation name="GetStuff">
<soap:operation soapAction="" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
I'm afraid that I don't really understand the exception; as I said, web services is not an area where I claim competence.
How can I determine the soap action the server requires, and how do I configure my $myVar to use that soap action?