[Fedora-suds-list] Sharepoint and SUDS, partial success and a question on UpdateListItems problems

Michael Conry michael.conry at esbi.ie
Thu Sep 16 08:00:44 UTC 2010


Hi,
I've been trying to get to grips with SUDS as an interface to
Sharepoint/SOAP, and have been very pleased.

The resources I've worked from are principally
https://fedorahosted.org/suds/wiki/SharepointArticle
and
http://stackoverflow.com/questions/2629918/how-to-update-documents-metad
ata-in-sharepoint-linux-webservices-sharepo
(the second, I think, draws on the first)

Things are working OK for me except for the very last example in the
SharepointArticle guide.
I can setup my clients (After a bit of messing around with
http-proxies), I can create lists/libraries, folders and so on.  Where I
hit a problem is with the UpdateListItems method, which takes XML as its
argument.

Following the guide, diligently, I first leave out the nsX: bit and
<updates>, and get the error as described.  Then I try the equivalent of
c_lists.service.UpdateListItems('Support Schedule',str(batch))
and get the error described ("Data at the root level is invalid. Line 1,
position 1.")

Finally, I do the recommended approach
updates = Element('ns0:updates')
updates.append(batch)
(Except in my case I think ns1 is the correct ns, see below.)
However, I still have an error "Value does not fall within the expected
range."

My debug output is:

DEBUG:suds.client:sending to
(http://esbmoss/sc/esbiengfm/ams/test_mc/_vti_bin/lists.asmx)
message:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://schemas.microsoft.com/sharepoint/soap/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <ns0:Body>
      <ns1:UpdateListItems>
         <ns1:listName>TestCreateList</ns1:listName>
         <ns1:updates>
            <Batch OnError="Continue" ListVersion="1">
               <Method ID="1" Cmd="New">
                  <Field Name="ID">New</Field>
               </Method>
            </Batch>
         </ns1:updates>
      </ns1:UpdateListItems>
   </ns0:Body>
</SOAP-ENV:Envelope>
DEBUG:suds.client:headers = {'SOAPAction':
u'"http://schemas.microsoft.com/sharepoint/soap/UpdateListItems"',
'Content-Type': 'text/xml; charset=utf-8'}
DEBUG:suds.client:http succeeded:
<?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><soap:Fault><fau
ltcode>soap:Server</faultcode><faultstring>Exception of type
'Microsoft.SharePoint.SoapServer.SoapServerException' was
thrown.</faultstring><detail><errorstring
xmlns="http://schemas.microsoft.com/sharepoint/soap/">Value does not
fall within the expected
range.</errorstring></detail></soap:Fault></soap:Body></soap:Envelope>

I've tried this in very, very, many ways, created different types of
lists, etc., and have kept hitting the same problem.  Using the U2U Caml
utility, I did manage to create things over SOAP, so server must be ok.
For what it's worth, my SUDS/Python code is as follows (for a minimal
example).

Can anyone offer any pointers?

from suds import client
from suds.transport.https import WindowsHttpAuthenticated
d = dict(http='127.0.0.1:5865',https='127.0.0.1:5865')
from suds.sax.element import Element
from suds.sax.element import Attribute

SITE = "http://esbmoss/sc/esbiengfm/ams/test_mc"
USER = "Domain\\Username"   # AD user name
PASS = "Password"

import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)

wss_lists = client.Client("%s/_vti_bin/lists.asmx?WSDL" %
SITE,transport=WindowsHttpAuthenticated(username=USER, password=PASS,
proxy=d))

batch = Element("Batch")
batch.append(Attribute("OnError","Continue"))
batch.append(Attribute('ListVersion','1'))
method= Element("Method")
method.append(Attribute("ID","1")).append(Attribute("Cmd","New"))
method.append(Element("Field").append(Attribute('Name','ID')).setText('N
ew'))
batch.append(method)

updates=Element('ns1:updates')
updates.append(batch)

print "--------------------------"
print updates
print "--------------------------"

#wss_lists.service.UpdateListItems('TestCreateList',str(batch))

wss_lists.service.UpdateListItems('TestCreateList',updates)
-------------- next part --------------

An timpeallacht? - Smaoinigh air sula bpriont?ileann t? an r-phost seo.
Please consider the Environment before printing this email. 

* ** *** ** * ** *** ** * ** *** ** *
T? an t-eolas sa r?omhphost seo agus in aon chomhad a ghabhann leis r?nda agus ceaptha le haghaidh ?s?ide an t? n? an aon?in ar seoladh chuige iad agus na h?s?ide sin amh?in.
Is tuairim? n? dearctha? an ?dair amh?in aon tuairim? n? dearctha? ann, agus n? g? gurb ionann iad agus tuairim? n? dearctha? ESB.
M? bhfuair t? an r?omhphost seo tr? earr?id, ar mhiste leat ? sin a chur in i?l don seolt?ir.
Scanann ESB r?omhphoist agus ceangalt?in le haghaidh v?reas, ach n? r?tha?onn s? go bhfuil ceachtar d?obh saor ? v?reas agus n? glacann dliteanas ar bith as aon dam?iste de dhroim v?reas.
Cl?raithe an Chomhlachta: http://www.esb.ie/companies


This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.
Any views or opinions presented are solely those of the author, and do not necessarily represent those of ESB.
If you have received this email in error please notify the sender.
Although ESB scans e-mail and attachments for viruses, it does not guarantee that either is virus-free or accepts no liability for any damage sustained as a result of viruses.
Company Registration Information: http://www.esb.ie/companies

* ** *** ** * ** *** ** * ** *** ** *


More information about the suds mailing list