[IronPython] SOAPAction header

O'Leary, Jim Jim.O'Leary at vancouver.ca
Wed Sep 10 18:46:45 CEST 2008


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.

query = Encoding.UTF8.GetBytes('''<?xml version="1.0"
encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetListItems
xmlns="http://schemas.microsoft.com/sharepoint/soap/"><listName>B8AF4305
-7BB5-4F9D-9553-F1144F7DEEA5</listName><viewName
/><rowLimit>5000000</rowLimit></GetListItems></soap:Body></soap:Envelope
>''')

request =
HttpWebRequest.Create('http://myserver/ims/_vti_bin/Lists.asmx')
request.Method = "POST"
myCredentials = System.Net.NetworkCredential
myCredentials = System.Net.CredentialCache.DefaultCredentials
request.Credentials = myCredentials

request.ContentType = "text/xml; charset=utf-8"
request.ContentLength = query.Length
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services
Client Protocol 2.0.50727.1433)"
requestStream = request.GetRequestStream()
requestStream.Write(query,0,query.Length)
response = request.GetResponse()

Thanks

Jim




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080910/b4d1275c/attachment.html>


More information about the Ironpython-users mailing list