Hi,
this is my first post to this list. I discovered SUDS recently and start
to like more and more... thanks for your work!
I wondered why SUDS uses two different prefixes "ns1" and "SOAP-ENV" for
the namespace "http://schemas.xmlsoap.org/soap/envelope/"::
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope ...
xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" ...
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns1:Body>
...
</ns1:Body>
</SOAP-ENV:Envelope>
Okay it is valid XML, but it's not very elegant. And there is at least
one problem report that seems to be caused by some parser that doesn't
like it: http://stackoverflow.com/questions/4605687/invalid-suds-envelope
I fixed this strange behaviour very easily (at least AFAICS), by
changing one word in suds/bindings/binding.py, method get_message()
if self.options().prefixes:
env.normalizePrefixes()
#~ body.normalizePrefixes()
env.promotePrefixes()
else:
env.refitPrefixes()
So I suggest to fix this in the trunk (unless I missed something, which
is not impossible since I am rather new to XML and SOAP. In that case
I'd be glad if one of you finds a few words to explain it to me).
Luc
Friends,
I am getting the following error, while invoking "AccountCheckOut" web service as
response = client_eap.service.AccountCheckOut(userId, accountNumber, requestSource)
suds.WebFault: Server raised fault: 'Validation: XML schema validation of SOAPBody failed
(OPERATION=AccountCheckOut, DETAILS=XML Document has Error:cvc-complex-type.2.4.a:
Invalid content was found starting with element 'UserID'. One of '{"urn:bearstearns.com:bsc.ais.Account:1.0":UserID}' is expected.)'
On printing my wsdl client, I see that the target service is defined as:
AccountCheckOut(xs:token UserID, xs:token AccountNumber, ns2:RequestSourceType RequestSource, )
The AccountCheckOut.xsd defines the UserId as a ref=acct:UserId and the namespace is defined as
xmlns:acct="urn:bearstearns.com:bsc.ais.Account:1.0" inside AccountCheckOut.xsd
So the correct suds service request should have gone out with the following:
<ns1:Body>
<ns0:AccountCheckOut>
<UserID xmlns="urn:bearstearns.com:bsc.ais.Account:1.0">XXXXXX</UserID>
<AccountNumber xmlns="urn:bearstearns.com:bsc.ais.Account:1.0">55750172</AccountNumber>
<RequestSource xmlns="urn:bearstearns.com:bsc.ais.Account:1.0">XXX</RequestSource>
</ns0:AccountCheckOut>
</ns1:Body>
But it went out with the incorrect xmlns as shown below:
<ns1:Body>
<ns0:AccountCheckOut>
<UserID xmlns="urn:bearstearns.com:bsc.eap.AccountCheckOut:1.0">XXXXXX</UserID>
<AccountNumber xmlns="urn:bearstearns.com:bsc.eap.AccountCheckOut:1.0">55750172</AccountNumber>
<RequestSource xmlns="urn:bearstearns.com:bsc.eap.AccountCheckOut:1.0">XXX</RequestSource>
</ns0:AccountCheckOut>
</ns1:Body>
Please see the content of the AccountCheckOut.xsd below:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="urn:bearstearns.com:bsc.eap.AccountCheckOut:1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:pend="urn:bearstearns.com:bsc.ais.PendingAccount:1.0" xmlns:acct="urn:bearstearns.com:bsc.ais.Account:1.0" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="urn:bearstearns.com:bsc.ais.Account:1.0" schemaLocation="./ais/Account.xsd"/>
<xs:import namespace="urn:bearstearns.com:bsc.ais.PendingAccount:1.0" schemaLocation="./ais/PendingAccount.xsd"/>
<xs:element name="AccountCheckOut">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="acct:UserID"/>
<xs:element ref="acct:AccountNumber"/>
<xs:element ref="acct:RequestSource"/>
</xs:sequence>
</xs:complexType>
</xs:element>
....
...
</xs:schema>
I want to know how can I correct this and make the xmlns = urn:bearstearns.com:bsc.ais.Account:1.0 instead instead of urn:bearstearns.com:bsc.eap.AccountCheckOut:1.0 in my service request
Thanks.
Sanku
Hi all,
I have some problems accessing this ws.
I can get the wsdl by putting the credentials directly in the url as in:
http://xxxxxxxxxx:yyyyyyyy@webservices.IZSLER.it/wsTestAnagrafeIZSLER/gestiā¦
but when I try passing the credentials using HttpAuthenticated, I get
401 error:
------------------------------------------------
# -*- coding: utf-8 -*-
from suds.client import Client
username="xxxxxxxx"
password="yyyyyyyy"
url = 'https://webservices.IZSLER.it/wsAnagrafeIZSLER/gestioneUO.php?wsdl'
from suds.transport.http import HttpAuthenticated
t = HttpAuthenticated(username=username, password=password)
client=Client(url=url, transport=t)
print client
--------------------
DEBUG:suds.wsdl:reading wsdl at:
https://webservices.IZSLER.it/wsAnagrafeIZSLER/gestioneUO.php?wsdl ...
DEBUG:suds.transport.http:opening
(https://webservices.IZSLER.it/wsAnagrafeIZSLER/gestioneUO.php?wsdl)
Traceback (most recent call last):
File "testIZS.py", line 16, in <module>
client=Client(url=url, transport=t)
File "build/bdist.linux-x86_64/egg/suds/client.py", line 112, in __init__
File "build/bdist.linux-x86_64/egg/suds/reader.py", line 152, in open
File "build/bdist.linux-x86_64/egg/suds/wsdl.py", line 136, in __init__
File "build/bdist.linux-x86_64/egg/suds/reader.py", line 79, in open
File "build/bdist.linux-x86_64/egg/suds/reader.py", line 95, in download
File "build/bdist.linux-x86_64/egg/suds/transport/http.py", line 173,
in open
File "build/bdist.linux-x86_64/egg/suds/transport/http.py", line 64,
in open
suds.transport.TransportError: HTTP Error 401: Authorization Required
-----------------
Thanks for any help.
j