[Fedora-suds-list] suds client and soaplib
John Aherne
jjaherne at googlemail.com
Tue Apr 13 20:18:49 UTC 2010
I am using the soaplib trivial helloworld.py example.
I can call soaplib from suds using simple types as the first example shows
below.
I pass 2 simple types a name and an integer value. And I get the response
repeated the number of times of the integer value.
But I am having a problem with calling soaplib from suds using the
client.factory_create method.
This you can see in the 2nd example.
Looking at the log output it seems that it is SUDS that has the problem -
but I am no expert on this.
It looks like it is trying to create a structure for a complex type and to
me it seems like it is not doing it correctly.
It could be I'm doing this all wrong. And I should be sticking to avoiding
the client factory for this type of message.
But I thought I would check and see if someone can give me some pointers as
to what I should be doing.
Needless to say I am not that well up in soap messages
Thanks for any info
John Aherne
************************************
1st example
************************************
from suds.client import Client
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
client= Client("http://localhost:7889/wsdl",cache=None)
print client
print client.service.say_hello("punk",5)
E:\soaplib-0.8.1\examples>test_suds.py
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:integer 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:n
s1="HelloWorldService.HelloWorldService" xmlns:xsi="
http://www.w3.org/2001/XMLSc
hema-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:S
OAP-ENV="http://schemas.xmlsoap.org/soap/envelope/
"><SOAP-ENV:Body><say_helloRes
ponse><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</strin
g><string xsi:type="xs:string">Hello,
punk</string></say_helloResult></say_hello
Response></SOAP-ENV:Body></SOAP-ENV:Envelope>
WARNING:suds.umx.typed:attribute (type) type, not-found
(stringArray){
_type = "tns:stringArray"
string[] =
"Hello, punk",
"Hello, punk",
"Hello, punk",
"Hello, punk",
"Hello, punk",
}
*********************************
2nd Example
********************************
from suds.client import Client
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.transport').setLevel(logging.DEBUG)
client= Client("http://localhost:7889/wsdl",cache=None)
print 'myclient',client
e = client.factory.create("ns0:say_hello")
print ' i am E',e
e.name = "punk"
e.times = 3
print 'I am E 2',e
client.service.say_hello(e)
E:\soaplib-0.8.1\examples>test_suds2.py
DEBUG:suds.transport.http:opening (http://localhost:7889/wsdl)
mycleint
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:integer times, )
Types (3):
say_hello
say_helloResponse
stringArray
i am E (say_hello){
name = None
times = None
}
I am E 2 (say_hello){
name = "punk"
times = 3
}
DEBUG:suds.transport.http:sending:
URL:http://localhost:7889/wsdl
HEADERS: {'SOAPAction': u'"say_hello"', 'Content-Type': 'text/xml',
'Content-typ
e': 'text/xml', 'Soapaction': u'"say_hello"'}
MESSAGE:
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:n
s1="HelloWorldService.HelloWorldService" xmlns:xsi="
http://www.w3.org/2001/XMLSc
hema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
****************************************
his I think shows the problem
****************************************
<ns0:Body>
<ns1:say_hello>
<name>
<name>punk</name>
<times>3</times>
</name>
<times/>
</ns1:say_hello>
</ns0:Body>
************************************************
</SOAP-ENV:Envelope>
ERROR:suds.client:<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:n
s1="HelloWorldService.HelloWorldService" xmlns:xsi="
http://www.w3.org/2001/XMLSc
hema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
******************************************
This I think shows the problem
*****************************************
<ns0:Body>
<ns1:say_hello>
<name>
<name>punk</name>
<times>3</times>
</name>
<times/>
</ns1:say_hello>
</ns0:Body>
</SOAP-ENV:Envelope>
Traceback (most recent call last):
File "E:\soaplib-0.8.1\examples\test_suds2.py", line 13, in <module>
client.service.say_hello(e)
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 633, in send
result = self.failed(binding, e)
File "E:\python-suds-0.3.9\suds\client.py", line 684, in failed
r, p = binding.get_fault(reply)
File "E:\python-suds-0.3.9\suds\bindings\binding.py", line 238, in
get_fault
raise WebFault(p, faultroot)
suds.WebFault: Server raised fault: 'range() integer end argument expected,
got
NoneType.'
E:\soaplib-0.8.1\examples>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/suds/attachments/20100413/037acb6d/attachment.html
More information about the suds
mailing list