Can you post the equivalent VB.NET code?  My first guess would be there's an 
attribute somewhere which is carrying the action - but it is just a guess.

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of O'Leary, Jim
Sent: Wednesday, September 10, 2008 9:47 AM
To: [email protected]
Subject: [IronPython] SOAPAction header



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


_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to