[IronPython] SOAPAction header

Miha Valencic miha.valencic at gmail.com
Thu Sep 11 06:44:15 CEST 2008


Jim, first of all, why aren't you using .NET infrastructrue to invoke
WebService? I suspect this is the reason, because you forgot to set he HTTP
header attribute, and infrastracture (are you using generated proxy stub in
VB.NET?) does this for you.

You should create you proxy by deriving from
System.ServiceModel.ClientBase<IYourInterface> for WCF clients, and for
regular clients, you should derive from
System.Web.Services.Protocols.SoapHttpClientProtocol.

wsdl.exe (or svcutil.exe) does this automatically for you. And I would not
create thos proxy classes in IPy, but would rather create a proxy in c#
(with them tools :)) and then just use this .net object to invoke my web
service from IPY like so:

clr.AddReference("MyDllWhichContainsWSProxy")
from MyNamespace import MyWSProxy

foo = MyWSProxy
foo.Url = "http://...."
result = foo.MethodX([1,2,3])

I hope I'm not missing anything...

rgds,
 Miha.

ps: If you still want to do it the hard way, just add the apropriate
SOAPAction HTTP header to your HTTP request. SOAPAction headers are
different for each method you invoke and are defined in WSDL file.

2008/9/10 O'Leary, Jim <Jim.O'Leary at vancouver.ca<Jim.O%27Leary at vancouver.ca>
>

>
> I am trying to access a web service on a SharePoint site using IronPython.
> The web service can be accessed via a vb.NET app, but not from IronPython.
>
> Sniffing the packets from both IronPython and vb.NET transactions shows
> that the SOAP envelope and all headers are exactly the same in both
> transactions, except for the SOAPAction header, which is missing in the
> IronPython app.
>
> At a certain point the server sends back the following faultstring:
>
> Unable to handle request without a valid action parameter. Please supply a
> valid soap action.
>
> How to you add this header? Below is my code. I am able to authenticate,
> but the app chokes on the request.GetResponse() line with 500 Internal
> Server Error.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080911/d4fb3fb3/attachment.html>


More information about the Ironpython-users mailing list