[Soap-Python] suds client and soaplib

Joshua J. Kugler joshua at eeinternet.com
Mon Apr 12 20:46:14 CEST 2010


On Monday 12 April 2010, John Aherne elucidated thus:
> Joshua
>
> Thanks for the reply.
>
> I think I will post a message on the suds list and see what they can
> tell me.

Yeah...Jeff Ortel is really good at working with WSDLs and spotting 
where the fault lies (whether it be the programmer's fault for not 
fully specifying what they need, or the WSDL's fault for not properly 
specify all types or services ports, etc.).

For your log below, what WSDL are you using?  From the log, it looks 
like your WSDL defines stringArray, but then the service is returning 
something unexpected.  But I don't know anywhere near enough about SOAP 
to provide an authoritative answer on that. Ask Jeff. :)

j

>
> However, I have done some more investigating and run the logger in
> the suds client.
>
> This shows that soaplib is returning the results.
>
> But it seems to me that the suds client objects to the stringArray
> type being returned.
>
> It certainly moans about a typed attribute not being found, And
> stringArray looks the most likely candidate to me. Not that I know
> much about the types that might be supported
>
> I have attached the log below:
>
> Anyone got any suggestions as to what I should try next.
>
> Thanks
>
> John Aherne
>
>
> Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
> (Intel)] on win32
> Type "copyright", "credits" or "license()" for more information.
>
>
> Suds ( https://fedorahosted.org/suds/ )  version: 0.3.9 GA  build:
> R659-20100219
>
> Service ( HelloWorldService )
> tns="HelloWorldService.HelloWorldService" Prefixes (1)
>       ns0 = "HelloWorldService.HelloWorldService"
>    Ports (1):
>       (HelloWorldService)
>          Methods (1):
>             say_hello(xs:string name, xs:int times, )
>          Types (3):
>             say_hello
>             say_helloResponse
>             stringArray
>
>
> DEBUG:suds.client:sending to (http://localhost:7889/wsdl)
> message:
> <SOAP-ENV:Envelope
> xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:ns1="HelloWorldService.HelloWorldService" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="
> http://schemas.xmlsoap.org/soap/envelope/">
>    <SOAP-ENV:Header/>
>    <ns0:Body>
>       <ns1:say_hello>
>          <name>punk</name>
>          <times>5</times>
>       </ns1:say_hello>
>    </ns0:Body>
> </SOAP-ENV:Envelope>
> DEBUG:suds.client:headers = {'SOAPAction': u'"say_hello"',
> 'Content-Type': 'text/xml'}
> DEBUG:suds.client:http succeeded:
> <SOAP-ENV:Envelope
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:
>Body><say_helloResponse><say_helloResult
> type="tns:stringArray"><string xsi:type="xs:string">Hello,
> punk</string><string xsi:type="xs:string">Hello, punk</string><string
> xsi:type="xs:string">Hello, punk</string><string
> xsi:type="xs:string">Hello, punk</string><string
> xsi:type="xs:string">Hello,
> punk</string></say_helloResult></say_helloResponse></SOAP-ENV:Body></
>SOAP-ENV:Envelope> WARNING:suds.umx.typed:attribute (type) type,
> not-found
>
> Traceback (most recent call last):
>   File "E:\soaplib-0.8.1\examples\test_suds.py", line 8, in <module>
>     print client.service.say_hello("punk",5)
>   File "E:\python-suds-0.3.9\suds\client.py", line 539, in __call__
>     return client.invoke(args, kwargs)
>   File "E:\python-suds-0.3.9\suds\client.py", line 598, in invoke
>     result = self.send(msg)
>   File "E:\python-suds-0.3.9\suds\client.py", line 627, in send
>     result = self.succeeded(binding, reply.message)
>   File "E:\python-suds-0.3.9\suds\client.py", line 659, in succeeded
>     r, p = binding.get_reply(self.method, reply)
>   File "E:\python-suds-0.3.9\suds\bindings\binding.py", line 160, in
> get_reply
>     result = unmarshaller.process(nodes[0], resolved)
>   File "E:\python-suds-0.3.9\suds\umx\typed.py", line 66, in process
>     return Core.process(self, content)
>   File "E:\python-suds-0.3.9\suds\umx\core.py", line 48, in process
>     return self.append(content)
>   File "E:\python-suds-0.3.9\suds\umx\core.py", line 63, in append
>     self.append_children(content)
>   File "E:\python-suds-0.3.9\suds\umx\core.py", line 140, in
> append_children cval = self.append(cont)
>   File "E:\python-suds-0.3.9\suds\umx\core.py", line 61, in append
>     self.start(content)
>   File "E:\python-suds-0.3.9\suds\umx\typed.py", line 77, in start
>     found = self.resolver.find(content.node)
>   File "E:\python-suds-0.3.9\suds\resolver.py", line 341, in find
>     frame = Frame(result, resolved=known, ancestry=ancestry)
>   File "E:\python-suds-0.3.9\suds\resolver.py", line 473, in __init__
>     resolved = type.resolve()
>   File "E:\python-suds-0.3.9\suds\xsd\sxbasic.py", line 63, in
> resolve raise TypeNotFound(qref)
> TypeNotFound: Type not found: '(string,
> HelloWorldService.HelloWorldService, )'
>
> On Mon, Apr 12, 2010 at 6:18 PM, Joshua J. Kugler 
<joshua at eeinternet.com>wrote:
> > I would encourage you to bring this up on the suds mailing list
> > and/or the suds irc channel (#suds on freenode).  Jeff Ortel, the
> > maintainer of suds, is very knowledgeable in all matters SOAP
> > related. I'm sure he'd be able to help you.
> >
> > FYI, I'm not sure he monitors this list, you might want to alert
> > him to its presence in the process. :)
> >
> > j
> >
> > On Sunday 11 April 2010, John Aherne elucidated thus:
> > > Burak
> > >
> > > Thanks for the info.
> > >
> > > I have turned off cache by using cache=None and removed all the
> > > cache files.
> > >
> > > Still same problem though.
> > >
> > > It looks to me as though the namespace is not right.
> > >
> > > If you look at the tns it shows as
> > > HelloWorldService.HelloWorldService.
> > >
> > > Without knowing too much about soap, I would expect it to be just
> > > HelloWorldService or maybe
> > > http://localhost:7889/HelloWorldService
> > >
> > > The difference I see between the soaplib client and suds is that
> > > the soaplib client passes in the service as a parameter, and suds
> > > interrogates the service to get the wsd and interprets the result
> > >
> > > That's a bit simplistic but correct where I am wrong.
> > >
> > > Thanks for any info
> > >
> > > John Aherne
> > >
> > >
> > > On Sun, Apr 11, 2010 at 11:18 PM, Burak Arslan
> > >
> > > <burak.arslan at arskom.com.tr>wrote:
> > > >  hi john,
> > > >
> > > > i guess you need to clear your suds cache.
> > > >
> > > > on linux you'd either use
> > > >
> > > > rm -rf /tmp/suds
> > > >
> > > > or
> > > >
> > > > rm -rf $TMP/suds
> > > >
> > > > but i have no idea where those files would be on windows. i'm
> > > > sure it's somewhere under c:\documents and settings\$user\
> > > >
> > > > i suggest you to turn off suds cache entirely, unless you're
> > > > under very strict resource restrictions. see the cache-related
> > > > arguments in
> > > > https://fedorahosted.org/suds/wiki/Documentation#OPTIONS
> > > >
> > > > hth
> > > > burak
> > > >
> > > >
> > > > On 04/11/10 21:44, John Aherne wrote:
> > > >
> > > > I have been looking at suds and soaplib experimenting with xml.
> > > >
> > > >  Using Windows XP SP3
> > > > soaplib 0.8.1
> > > > suds 0.3.9
> > > > python 2.5.1
> > > >
> > > >
> > > >  The soaplib examples I have looked at for server and client
> > > > all work fine
> > > >
> > > >  I have tried the suds client against a couple of external
> > > > services and it works fine
> > > >
> > > >  However, I have problems with the suds client and soaplib.
> > > >
> > > >  I am using the helloworld.py example from the soaplib\examples
> > > > directory as my server.
> > > >
> > > >  And for a client I am using the 3 lines that Burak  suggested
> > > > in his email from last month
> > > >
> > > >  I see that last month someone else had problems with using the
> > > > client.factory.create method
> > > > But that it worked if the parameters were passed directly.
> > > >
> > > >  I see the same problem when the factory method is used, but
> > > > still have a problem with passing the parameters directly.
> > > >
> > > >  Since a number of people seem to be using suds and soaplib
> > > > successfully, I assume I am doing something wrong or
> > > > overlooking some fairly obvious point.
> > > >
> > > >  It looks to me as though I am getting an doubling of part of
> > > > the namespace, but this is early days for me on soap so don't
> > > > take my word for it.
> > > >
> > > >  I have included a dump of wsdl from service.py of what I think
> > > > is being returned from the wsdl call. If someone could cast an
> > > > eye over it and let me know if they see anything wrong, it
> > > > would be very helpful.
> > > >
> > > >  I am hoping someone can point me in the right direction, since
> > > > this seems a pretty basic point to get stuck on.
> > > >
> > > >  Thanks for any help
> > > >
> > > >  John Aherne
> > > >
> > > >
> > > >
> > > >  <?xml version='1.0' encoding='utf-8' ?>
> > > > <definitions xmlns:plnk="
> > > > http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
> > > > xmlns:tns="HelloWorldService.HelloWorldService"
> > > > xmlns:typens="HelloWorldService.HelloWorldService" xmlns:xs="
> > > > http://www.w3.org/2001/XMLSchema"
> > > > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> > > > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> > > > xmlns="http://schemas.xmlsoap.org/wsdl/"
> > > > targetNamespace="HelloWorldService.HelloWorldService"
> > > > name="HelloWorldService"><types><schema
> > > > targetNamespace="HelloWorldService.HelloWorldService"
> > > > xmlns="http://www.w3.org/2001/XMLSchema">
> > > > <xs:element name="say_hello" type="tns:say_hello"/>
> > > > <xs:complexType name="say_hello">
> > > > <xs:sequence><xs:element name="name"
> > > > type="xs:string"/><xs:element name="times" type="xs:int"/>
> > > > </xs:sequence></xs:complexType>
> > > > <xs:element name="stringArray" type="tns:stringArray"/>
> > > > <xs:complexType
> > > > name="say_helloResponse"><xs:sequence><xs:element
> > > > name="say_helloResult" type="tns:stringArray"/>
> > > > </xs:sequence></xs:complexType>
> > > > <xs:complexType name="stringArray">
> > > > <xs:sequence><xs:element minOccurs="0" maxOccurs="unbounded"
> > > > type="tns:string" name="string"/>
> > > > </xs:sequence></xs:complexType>
> > > > <xs:element name="say_helloResponse"
> > > > type="tns:say_helloResponse"/> </schema></types><message
> > > > name="say_hello">
> > > > <part name="say_hello" element="tns:say_hello"/>
> > > > </message><message name="say_helloResponse">
> > > > <part name="say_helloResponse"
> > > > element="tns:say_helloResponse"/> </message>
> > > > <portType name="HelloWorldService">
> > > > <operation name="say_hello" parameterOrder="say_hello">
> > > > <documentation>
> > > > Docstrings for service methods appear as documentation in the
> > > > wsdl &lt;b&gt;what fun&lt;/b&gt;
> > > > @param name the name to say hello to
> > > > @param the number of times to say hello
> > > > @return the completed array
> > > > </documentation><input name="say_hello"
> > > > message="tns:say_hello"/> <output name="say_helloResponse"
> > > > message="tns:say_helloResponse"/>
> > > > </operation></portType><plnk:partnerLinkType
> > > > name="HelloWorldService"> <plnk:role name="HelloWorldService">
> > > > <plnk:portType name="tns:HelloWorldService"/>
> > > > </plnk:role></plnk:partnerLinkType>
> > > > <binding name="HelloWorldService" type="tns:HelloWorldService">
> > > > <soap:binding style="document" transport="
> > > > http://schemas.xmlsoap.org/soap/http"/>
> > > > <operation name="say_hello">
> > > > <soap:operation soapAction="say_hello" style="document"/>
> > > > <input name="say_hello"><soap:body use="literal"/>
> > > > </input><output name="say_helloResponse"><soap:body
> > > > use="literal"/> </output></operation></binding><service
> > > > name="HelloWorldService"> <port name="HelloWorldService"
> > > > binding="tns:HelloWorldService"> <soap:address
> > > > location="http://localhost:7889/wsdl"/></port>
> > > > </service></definitions>
> > > > localhost - - [11/Apr/2010 19:00:16] "GET /wsdl HTTP/1.1" 200
> > > > 2669
> > > >
> > > >  Warning (from warnings module):
> > > >   File "C:\Python25\lib\site-packages\soaplib\wsgi_soap.py",
> > > > line 219 if payload:
> > > > FutureWarning: The behavior of this method will change in
> > > > future versions. Use specific 'len(elem)' or 'elem is not None'
> > > > test instead.
> > > >
> > > >  Warning (from warnings module):
> > > >   File "C:\Python25\lib\site-packages\soaplib\wsgi_soap.py",
> > > > line 236 if payload:
> > > > FutureWarning: The behavior of this method will change in
> > > > future versions. Use specific 'len(elem)' or 'elem is not None'
> > > > test instead. localhost - - [11/Apr/2010 19:00:16] "POST /wsdl
> > > > HTTP/1.1" 200 525
> > > >
> > > >
> > > >  SUDS CLIENT
> > > >
> > > >  from suds.client import Client
> > > >
> > > >  client= Client("http://localhost:7889/wsdl")
> > > > print client.service.say_hello("punk",5)
> > > >
> > > >
> > > >
> > > >
> > > >  No handlers could be found for logger "suds.umx.typed"
> > > >
> > > >  Traceback (most recent call last):
> > > >   File "E:\soaplib-0.8.1\examples\test_suds.py", line 5, in
> > > > <module> print client.service.say_hello("punk",5)
> > > >   File "E:\python-suds-0.3.9\suds\client.py", line 539, in
> > > > __call__ return client.invoke(args, kwargs)
> > > >   File "E:\python-suds-0.3.9\suds\client.py", line 598, in
> > > > invoke result = self.send(msg)
> > > >   File "E:\python-suds-0.3.9\suds\client.py", line 627, in send
> > > >     result = self.succeeded(binding, reply.message)
> > > >   File "E:\python-suds-0.3.9\suds\client.py", line 659, in
> > > > succeeded r, p = binding.get_reply(self.method, reply)
> > > >   File "E:\python-suds-0.3.9\suds\bindings\binding.py", line
> > > > 160, in get_reply
> > > >     result = unmarshaller.process(nodes[0], resolved)
> > > >   File "E:\python-suds-0.3.9\suds\umx\typed.py", line 66, in
> > > > process return Core.process(self, content)
> > > >   File "E:\python-suds-0.3.9\suds\umx\core.py", line 48, in
> > > > process return self.append(content)
> > > >   File "E:\python-suds-0.3.9\suds\umx\core.py", line 63, in
> > > > append self.append_children(content)
> > > >   File "E:\python-suds-0.3.9\suds\umx\core.py", line 140, in
> > > > append_children
> > > >     cval = self.append(cont)
> > > >   File "E:\python-suds-0.3.9\suds\umx\core.py", line 61, in
> > > > append self.start(content)
> > > >   File "E:\python-suds-0.3.9\suds\umx\typed.py", line 77, in
> > > > start found = self.resolver.find(content.node)
> > > >   File "E:\python-suds-0.3.9\suds\resolver.py", line 341, in
> > > > find frame = Frame(result, resolved=known, ancestry=ancestry)
> > > > File "E:\python-suds-0.3.9\suds\resolver.py", line 473, in
> > > > __init__ resolved = type.resolve()
> > > >   File "E:\python-suds-0.3.9\suds\xsd\sxbasic.py", line 63, in
> > > > resolve raise TypeNotFound(qref)
> > > > TypeNotFound: Type not found: '(string,
> > > > HelloWorldService.HelloWorldService, )'
> >
> > --
> > Joshua Kugler
> > Part-Time System Admin/Programmer
> > http://www.eeinternet.com
> > PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A



-- 
Joshua Kugler
Part-Time System Admin/Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A



More information about the Soap mailing list