TypeNotFound exception : how to import XSD schema with Python Suds (version 0.3.6) SOAP library ?
by Paul Poulet
I'm trying to use SABRE travel web services with Python Suds 0.3.6, but one
XSD seems not well-formed (maybe namespace is missing in this schema).
from suds.client import Client
wsdl = '
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQ.wsdl'
client = Client(wsdl, cache=None)
Debug trace returns :
.DEBUG:suds.wsdl:reading wsdl at:
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQ.ws....
DEBUG:suds.transport.http:opening (
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQ.wsdl)
DEBUG:suds.metrics:sax (
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQ.wsdl)
duration: 406 (ms)
DEBUG:suds.xsd.sxbasic:Import:0x7f90196fd5f0, importing ns="
http://webservices.sabre.com/sabreXML/2003/07",
location="OTA_AirPriceLLSRQRS.xsd"
DEBUG:suds.transport.http:opening (
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQRS.xsd
)
DEBUG:suds.metrics:sax (
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQRS.xsd)
duration: 504 (ms)
DEBUG:suds.xsd.sxbasic:Include:0x7f90196fdf80, importing ns="None",
location="OTA_AirPriceLLSRQ.xsd"
DEBUG:suds.transport.http:opening (
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQ.xsd)
DEBUG:suds.metrics:sax (
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQ.xsd)
duration: 1.363 (seconds)
DEBUG:suds.xsd.schema:built:
Schema:0x7f9019708e60
(...)
DEBUG:suds.xsd.query:(u'MessageHeader',
http://www.ebxml.org/namespaces/messageHeader), found as: <Element:0x1f68dd0
name="MessageHeader" />
DEBUG:suds.xsd.query:(u'Security',
http://schemas.xmlsoap.org/ws/2002/12/secext), found as: <Element:0x21a3a28
name="Security" />
DEBUG:suds.xsd.query:(u'OTA_AirPriceRQ',
http://webservices.sabre.com/sabreXML/2003/07), not-found
.
----------------------------------------------------------------------
Ran 2 tests in 11.669s
Type not found: '(OTA_AirPriceRQ,
http://webservices.sabre.com/sabreXML/2003/07, )'
It's logic : Python Suds loads OTA_AirPriceRQ in a "None" namespace.
I read "fix broken schema" Python Suds documentation (
https://fedorahosted.org/suds/wiki/Documentation#FIXINGBROKENSCHEMAs):
from suds.client import Client
from suds.xsd.doctor import ImportDoctor, Import
wsdl = '
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQ.wsdl'
imp = Import('
http://webservices.sabre.com/sabreXML/2003/07/OTA_AirPriceLLSRQ', '
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQ.xsd')
d = ImportDoctor(imp)
client = Client(wsdl, cache=None, doctor=d)
But script return another exception :
.DEBUG:suds.wsdl:reading wsdl at:
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQ.ws....
DEBUG:suds.transport.http:opening (
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQ.wsdl)
DEBUG:suds.metrics:sax (
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQ.wsdl)
duration: 617 (ms)
DEBUG:suds.xsd.doctor:inserting: <xs:import xmlns:xs="
http://www.w3.org/2001/XMLSchema" namespace="
http://webservices.sabre.com/sabreXML/2003/07/OTA_AirPriceLLSRQ"
schemaLocation="
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQ.xsd
"/>
DEBUG:suds.xsd.sxbasic:Import:0xe6cf80, importing ns="
http://webservices.sabre.com/sabreXML/2003/07/OTA_AirPriceLLSRQ", location="
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQ.xsd"
DEBUG:suds.transport.http:opening (
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQ.xsd)
DEBUG:suds.metrics:sax (
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQ.xsd)
duration: 1.375 (seconds)
DEBUG:suds.xsd.doctor:inserting: <xs:import xmlns:xs="
http://www.w3.org/2001/XMLSchema" namespace="
http://webservices.sabre.com/sabreXML/2003/07/OTA_AirPriceLLSRQ"
schemaLocation="
http://webservices.sabre.com/wsdl/sabreXML1.0.00/tpf/OTA_AirPriceLLSRQ.xsd
"/>
(...)
Error maximum recursion depth exceeded while calling a Python object
I don't understand how to use "doctor" functions. Somebody can help me,
please ?
Thank you.
14 years, 1 month
O your really think he will? Because I'm sure I'll like your M
by Carrino
Ngs will be somewhat clearer." He leaned back in his chair. Malone
shifted his feet again and transferred his hat from his right to his
left hand. "We put one of our test subjects in the insulated room," Dr.
O'Connor said, "and connected him to the detector. He was to read from a
book-- a book that was not too common. This was, of course, to obviate
the chance that some other person nearby might be reading it, or might
have read it in the past. We picked _The Blood is the Death_ by
Hieronymus Melanchthon, which, as you may know, is a very rare book
indeed." "Sure," Malone said. He had never heard of the book, but he
was, after all, willing to take Dr. O'Connor's word for it. The
telepathy expert went on: "Our test subject read it carefully, scanning
rather than skimming. Cameras recorded the movements of his eyes in
order for us to tell just what he was reading at any given moment, in
order to correlate what was going on in his mind with the reactions of
the machine's indicators, if you follow me." Malone nodded helplessly.
"At the same time," Dr. O'Connor continued blithely, "we had Charlie in
a nearby room, recording his babblings. Every so often, he would come
out with quotations from _The Blood is the Death_, and these quotations
corresponded exactly with what our test subject was reading at the time,
and also corresponded with the abnormal fluctuations of the detector."
Dr. O'Connor paused. Something, Malone realized, was expected of him. He
thought of several responses and chose one. "I see," he said. "But the
important thing here," Dr. O'Connor said, "is the timing. You see,
Charlie was incapable of continued concentration. He could not keep his
mind focused on another mind for very l
14 years, 1 month
Suds question (attribute vs element)
by Cesar Canassa
Hello everyone,
I have a service that its expecting a call like this:
<inputInitCloseItems maxNumberOfPackages="1" />
But when I run the method from sud I get the following output:
client.service.initCloseItems(1)
<inputInitCloseItems>
<maxNumberOfPackages>1<maxNumberOfPackages/>
</inputInitCloseItems>
The Suds is generating the maxNumberOfPackages as a element instead of a
inputInitCloseItems attribute, why does it do that?
This is XSD part:
<xs:complexType name="InputInitCloseItems">
<xs:sequence/>
<xs:attribute name="maxNumberOfPackages" type="xs:short" use="required"/>
</xs:complexType>
Thanks,
Cesar
14 years, 1 month
ppy--John C. Fremont--Drake
by Journot
Mericans who were teaching the Chinese the English language. This night
school is popular with young, ambitious Chinamen, for when they learn
our language it is much easier for them to obtain work in stores and
offices, and even as house servants. The books used had the Chinese
words on one page and the English sentences opposite. S
14 years, 1 month
Type not found: xs:complexType?
by Wesley Griffin
Hi,
I'm trying to use suds to work with the ServiceU WSDL
<http://webservices.serviceu.com/v1/PublicCalendar.asmx?WSDL>. I used
ImportDoctor to import both the XMLSchema and soap encoding:
xml = Import('http://www.w3.org/2001/XMLSchema')
xml.filter.add('http://webservices.serviceU.com/')
enc = Import('http://schemas.xmlsoap.org/soap/encoding/')
enc.filter.add('http://webservices.serviceU.com/')
doc = ImportDoctor(xml, enc)
and when I create and print a Client, everything appears happy:
url = 'http://webservices.serviceu.com/v1/PublicCalendar.asmx?WSDL'
client = Client(url, doctor=doc)
print client
[See attached file for the output]
Now, when I try and call a method:
try:
result = client.service.GetCategories(ORG_ID, error)
print result, error
except Exception, e
print "exception:", e
I get the following output:
exception: Type not found: 'xs:complexType'
Unfortunately, I am not an expert when it comes to SOAP, so I'm not
sure how to fix this error. Looking at the examples, the WSDL defines
complex types as <complexType name="Person">, however, the ServiceU
WSDL has this:
<s:element name="SearchEvents">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="OrgID"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="FromDate"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="ToDate"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="DepartmentID"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="CategoryID"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="EventName"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="ErrorMessage"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
Do I need to be manually importing another schema?
Thanks,
Wes
Thanks,
Wes
14 years, 1 month
How to deal with this data type
by Chris Frantz
I'm trying to talk to a service that defines this data type (names changed
to protect the guilty):
<complexType name="FooThing">
<simpleContent>
<extension base="xsd:string">
<attribute name="arg" type="xsd:string"/>
</extension>
</simpleContent>
</complexType>
In the vendor's Java and C# examples, FooThing is always setup like this:
FooThing foo = new FooThing();
foo.arg = "somename";
foo.Value = "Help";
int rc = doFoo(foo)
Which leads to this XML representation on the wire:
<doFoo>
<_this xsi:type="FooThing" arg="somename">Help</_this>
</doFoo>
I'm a bit confused on how I would accomplish the same with suds. FooThing
is an extension of the string type... how to I assign a value to it after
creating it with the factory?
foo = client.factory.create('FooThing')
print foo
(FooThing){
arg = ""
}
I've tried the "Including Literal XML" trick, but I get "Exception: raw XML
not valid as attribute value".
Thanks,
--Chris
14 years, 1 month
Ty were in high spirits; for the little Maud had
by Risler
W ship, about five hundred feet long, and others nearly as large. "This
big ditch across the isthmus has an average width of three hundred feet,
or two hundred less than the length of the Ophir. She could not,
therefore, get across the channel. There is a current in this water, and
fierce winds sometimes blow across it, and both of these affect the
inertia of the vessels. A comparatively small steamer like the
Guardian-Mother can be twisted about by these causes, and her bow or her
stern may catch on the sloping sides." "You have made out your case,
Captain Ringgold; and the moral is that general truths are not
invariably true," said Uncle Moses good-naturedly. "I only hope we shall
not get aground," added Mrs. Belgrave. "We are fairly started now, and
we have Lake Menzaleh on one side, and a low sandy plain, once covered
with water, on the other," continued the commander. "It is difficult to
believe that the swamp and lagoon on the starboard were once covered
with fertile fields, watered by two of the branches of the Nile, where
wheat was raised in abundance, from which Rome and other countries were
supplied with food." "What vast flocks of birds!" exclaimed Mrs.
Woolridge. "Those are flamingoes, just rising from their resting-place,"
added the captain. "They were white just now as we looked at them;
notice the color of
14 years, 1 month
Mont Marbore, from the sum
by Reihe
Ation was accomplished with such dexterity, that many of those present
at the spectacle asked of their neighbours if it was already finished;
and were told that it was; upon which they remarked, that it was the
last time they would put themselves so much out of the way for so
little. Three months had passed since the head and body of Peter Leroux
had been cast into a corner of the cemetery, and, in all probability,
the grave no longer concealed aught but his bones, when a new session of
assizes was opened, and M. Desalleux had again to support a capital
indictment. The day previous, he quitted at an early hour a ball to
which he had been invited with all his family, at a chateau in the
environs, and returned alone to the city, in order to prepare his case
for the morrow. The night was dark; a warm wind from the south whistled
drearily, while the buzz of the gay scene that he had left seemed to
linger in his ears. A feeling of melancholy stole over him. The memory
of many people whom he had known, and who were dead, returned to his
mind; and, scarcely knowing why, he began to think of Peter Leroux.
Nevertheless, as he drew near the city, and the first lights of the
suburbs began to appear, all his sombre ideas vanished, and as soon as
he found himself again at his desk, surrounded by his books and papers,
he thought no longer of anything but his oration, which he had
determined should be even yet more brilliant than any that had preceded
it. His system of indictment was already nearly settled. It is singular,
by the way, that French legal expression, a 'system of indictment'--that
is to say, an absolute manner of grouping an _ensemble_ of facts and
proofs, in virtue of which the prosecutor appropriates to himself the
head of a man--as one would say, 'a system of philosophy'--that is, an
_ensemble_ of reasonings and sophisms, by the aid of which we establish
some harmless truth, theory, or fancy. His system of indictment was
nearly completed, when the deposition of a witness which he had not
examined, suddenly presented itself, with such an aspect as threatened
to overturn all the edifice of his logic. He hesitated for some moments;
but, as we have already seen, M. Desalleux, in his functions
14 years, 1 month
error using the EPO's Open Patent Services
by Gary Wilson Jr.
So, playing with the EPO service again (with the new multi-service
feature, thanks!), I'm using the following code:
from suds.client import Client
wsdl = 'http://ops.epo.org/wsdl/ops.wsdl'
client = Client(wsdl)
retrieve = getattr(client.service['OPSBiblioRetrievalService'],
'biblio-retrieval')
pub = client.factory.create('exch:publication-reference')
setattr(pub, '_data-format', "docdb")
doc = getattr(pub, 'document-id')
doc.country = "EP"
setattr(doc, 'doc-number', 1000000)
doc.kind = "A1"
retrieve(pub)
...which results in a server fault. The generated request content is:
<SOAP-ENV:Envelope xmlns:ns0="http://www.epo.org/exchange"
xmlns:ns1="http://ops.epo.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ns1:biblio-retrieval>
<ns1:publication-reference data-format="docdb">
<ns0:document-id>
<ns0:country>EP</ns0:country>
<ns0:doc-number
xsi:type="ns0:doc-numberType">1000000</ns0:doc-number>
<ns0:kind xsi:type="ns0:kindType">A1</ns0:kind>
</ns0:document-id>
</ns1:publication-reference>
<ns1:application-reference/>
<ns1:priority-claim/>
<ns1:publication-reference xsi:type="ns1:publication-referenceType"/>
<ns1:application-reference xsi:type="ns1:application-referenceType"/>
<ns1:priority-claim xsi:type="ns1:priority-claimType"/>
</ns1:biblio-retrieval>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
...and what seems to be causing the problems are the empty elements
within the biblio-retrieval element. Using the soapUI client [1], I
get a successful response if I remove those empty elements from the
above message. From what soapUI reports, only one of the six
parameters there should be given, though I'm unsure of where that fact
can be inferred. Is there a way I can make suds not put those empty
elements in the message, or is this a bug?
Thanks,
Gary
[1] http://www.soapui.org/
14 years, 1 month