luizhandrade / pysimplesoap Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/pysimplesoap
Automatically exported from code.google.com/p/pysimplesoap
To run with older Python, just apply the following trivial patch:
diff -d -u -r a/pysimplesoap/simplexml.py b/pysimplesoap/simplexml.py
--- a/pysimplesoap/simplexml.py 2010-10-28 02:51:19.000000000 +0200
+++ b/pysimplesoap/simplexml.py 2010-10-29 06:33:58.000000000 +0200
@@ -34,7 +34,7 @@
bool_u = lambda s: {'0':False, 'false': False, '1': True, 'true': True}[s]
# aliases:
-class Alias():
+class Alias:
def __init__(self, py_type, xml_type):
self.py_type, self.xml_type = py_type, xml_type
def __call__(self, value):
diff -d -u -r a/pysimplesoap/client.py b/pysimplesoap/client.py
--- a/pysimplesoap/client.py 2010-10-28 02:51:19.000000000 +0200
+++ b/pysimplesoap/client.py 2010-10-29 06:34:32.000000000 +0200
@@ -23,7 +23,7 @@
Http = httplib2.Http
except ImportError:
import urllib2
- class Http(): # wrapper to use when httplib2 not available
+ class Http: # wrapper to use when httplib2 not available
def request(self, url, method, body, headers):
f = urllib2.urlopen(urllib2.Request(url, body, headers))
return f.info(), f.read()
Original issue reported on code.google.com by [email protected]
on 28 Oct 2010 at 3:32
Pysimplesoap.client.SoapClient could not connect a SOAP service, which requires
the use of client certificates, due to obvious lack of a certificate parameter.
Using httplib2 directly I could retrieve data from the service.
h2 = httplib2.Http()
h2.add_certificate('c.pem','s.pem','someservice.xyz')
url = "https://someservice.xyz/public.asmx?wsdl"
content = h2.request(url,"GET")
Since httplib2 works and is supported by SoapClient, I decided to patch the
source (patched client.py attached to this report).
SoapClient now takes tree new parameters (clientpem, serverpem and ssldomain)
and if you're using httplib2 it creates a SSL connection with client
certificates.
I left all the modifications inside client.py since I only use httplib2, but it
might be smart to move all parameters into __init__ of various HttpTransports
and configure each accordingly.
Sidenote: I started using pysimplesoap only because every other library is even
more complicated with client certificates. It is a real issue (just check
stackoverflow on 1001 way of semi solving this problem) and perhaps it might be
smart if support for client certificates was more developed (ie - directly from
SoapClient, with all three different libraries).
PS: @reingart, thanks for swift answer.
Original issue reported on code.google.com by [email protected]
on 25 Jan 2012 at 9:17
Attachments:
Hi,
When using pysimplesoap with the new wsfev1 afip webservice, I got the
following error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 9: ordinal
not in range(128)
(This was for listing bill types, with the 'Nota de Débito' value). In order
to fix it, I changed the way that the unicode function was being applied to the
values.
I'm not sure if it's the best way, but this one at least works.
diff -r 9dc392f4a0ec simplexml.py
--- a/simplexml.py Wed Oct 20 03:59:29 2010 -0300
+++ b/simplexml.py Fri Oct 29 11:30:26 2010 -0300
@@ -355,7 +355,10 @@
try:
# get special desserialization function (if any)
fn = TYPE_UNMARSHAL_FN.get(fn,fn)
- value = fn(unicode(node))
+ if fn == str:
+ value = fn(node).decode("utf-8")
+ else:
+ value = fn(node)
except (ValueError, TypeError), e:
raise ValueError("Tag: %s: %s" % (name, unicode(e)))
else:
Original issue reported on code.google.com by margamanterola
on 29 Oct 2010 at 2:34
Attachments:
What steps will reproduce the problem?
1. Use type mapping (ie: wsdl)
2. Call a function that returns a string with non-ascii characters
3.
What is the expected output? What do you see instead?
I'd expect to get a unicode string. Instead the library attempts to convert it
to a 'str' instance, which throws the following exception;
...
File "/export/home/henry/code/lib/pysimplesoap/pysimplesoap/simplexml.py", line 366, in unmarshall
raise ValueError("Tag: %s: %s" % (name, unicode(e)))
ValueError: Tag: domesticText: ('ascii', u'Bergs\xe5ker', 5, 6, 'ordinal not in
range(128)')
What version of the product are you using? On what operating system?
pysimplesoap-1.02c.zip
Please provide any additional information below.
Because there are two keys mapping to 'string' in TYPE_MAP (in simplexml.py),
the REVERSE_TYPE_MAP in client.py can map 'string' to either unicode or str. On
my machine it mapped to str, which caused the failure. Here is the simple fix;
--- a/pysimplesoap/client.py
+++ b/pysimplesoap/client.py
@@ -248,6 +248,7 @@ class SoapClient(object):
get_local_name = lambda s: str((':' in s) and s.split(':')[1] or s)
REVERSE_TYPE_MAP = dict([(v,k) for k,v in TYPE_MAP.items()])
+ REVERSE_TYPE_MAP['string'] = unicode
def fetch(url):
"Fetch a document from a URL, save it locally if cache enabled"
Original issue reported on code.google.com by misc%[email protected]
on 5 Jan 2011 at 5:50
Attached is a path to add SOAP service support for web2py using this library
It extends Service class with soap decorator and soap_serve method.
See Web2Py for detailed information.
Example:
{{{
service = Service(globals())
@service.soap('MyFunction',returns={'result':int,args={'a':int,'b':int,})
def myfunction(a, b):
return a + b
def call():
return service()
}}}
The call it with:
{{{
from pysimplesoap.client import SoapClient
client = SoapClient(
location = "http://localhost:8000/webservices/sample/call/soap",
action = 'http://example.com/', # SOAPAction
namespace = "http://example.com/sample.wsdl",
soap_ns='soap', # classic soap 1.1 dialect
trace = True, # print http/xml request and response
ns = False) # do not add namespace prefix
response = client.MyFunction(a=1,b=2)
print int(response.result)
}}}
Original issue reported on code.google.com by [email protected]
on 21 Jul 2010 at 3:36
Attachments:
What steps will reproduce the problem?
1. instantiate a client with a wsdl that has a host : http://localhost
2. as init parameters, set location to something different, say http://foo
3. when calling methods on the wsdl, they will always go to http://localhost
instead of http://foo
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
linux python 2.4
Please provide any additional information below.
commented out a line, not sure if that has other effects:
client.py:676, commented out the line that looks like
#self.location = port['location']
Original issue reported on code.google.com by [email protected]
on 30 Oct 2010 at 9:21
This works with SUDS
from suds.client import Client
url = 'http://wennekers.epcc.ed.ac.uk:8080/axis/services/MetadataCatalogue?WSDL'
client = Client(url)
result = client.service.doEnsembleURIQuery("Xpath", "/markovChain", 0, -1)
print '\nreply(\n%s\n)\n' % str(result)
but not with pysimplesoap
from pysimplesoap.client import SoapClient
url = 'http://wennekers.epcc.ed.ac.uk:8080/axis/services/MetadataCatalogue?WSDL'
client = SoapClient(wsdl=url,trace=False)
response = client.doEnsembleURIQuery("Xpath", "/markovChain", 0, -1)
print response
One error is client.py and line
return lambda self=self, *args, **kwargs: self.wsdl_call(attr,*args,**kwargs)
should be
return lambda *args, **kwargs: self.wsdl_call(attr,*args,**kwargs)
but also the envelop in the request appears to be is malformed, no data is
passed to it.
Original issue reported on code.google.com by [email protected]
on 15 Jul 2011 at 12:32
What steps will reproduce the problem?
1.try and parse a soap response with a timestamp with fractional seconds
What is the expected output? What do you see instead?
You get a valueError. Should parse just fine.
What version of the product are you using? On what operating system?
python2.7
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 15 Jun 2011 at 9:58
Thank you Mariano for this library. I have made small tests with it and the
speed is incredible (in comparison with suds)
Let me suggest, as suds does, that it would be a good idea to completely
separate the "transport" from the generation and parsing of SOAP messages.
Right now (at least in the client) there is urllib, urllib2 and httplib2 code
mixed with the SOAP parts. And the proxy parameter seems to be too tightly
coupled to httplib2 where it should be more generic.
Additionally the URL will fail to be fetched if the client has to do that over
a proxy.
A transport abstraction would allow any HTTP library (httplib2, urllib2 or
others like my own httxlib) to be plugged in and keep the network code separate
from the SOAP code.
I am playing a bit around with the sources and will attach an update to this
"Enhancement Request" for your consideration.
Once again thank you and best regards
Original issue reported on code.google.com by [email protected]
on 5 Aug 2011 at 12:10
What steps will reproduce the problem?
1. Centos 5 x86_64
2. install pysimplesoap
What is the expected output? What do you see instead?
no errors
What version of the product are you using? On what operating system?
1.2c, centos 5.5 x86_64
Please provide any additional information below.
byte-compiling build/bdist.linux-x86_64/egg/pysimplesoap/simplexml.py to
simplexml.pyc
File "build/bdist.linux-x86_64/egg/pysimplesoap/simplexml.py", line 37
class Alias():
^
SyntaxError: invalid syntax
=============================================
full result
=============================================
[root@mydomain tmp]# python setup.py install
running install
running bdist_egg
running egg_info
writing pysimplesoap.egg-info/PKG-INFO
writing top-level names to pysimplesoap.egg-info/top_level.txt
writing dependency_links to pysimplesoap.egg-info/dependency_links.txt
reading manifest file 'pysimplesoap.egg-info/SOURCES.txt'
writing manifest file 'pysimplesoap.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/pysimplesoap
copying build/lib/pysimplesoap/__init__.py ->
build/bdist.linux-x86_64/egg/pysimplesoap
copying build/lib/pysimplesoap/simplexml.py ->
build/bdist.linux-x86_64/egg/pysimplesoap
copying build/lib/pysimplesoap/server.py ->
build/bdist.linux-x86_64/egg/pysimplesoap
copying build/lib/pysimplesoap/client.py ->
build/bdist.linux-x86_64/egg/pysimplesoap
byte-compiling build/bdist.linux-x86_64/egg/pysimplesoap/__init__.py to
__init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/pysimplesoap/simplexml.py to
simplexml.pyc
File "build/bdist.linux-x86_64/egg/pysimplesoap/simplexml.py", line 37
class Alias():
^
SyntaxError: invalid syntax
byte-compiling build/bdist.linux-x86_64/egg/pysimplesoap/server.py to server.pyc
byte-compiling build/bdist.linux-x86_64/egg/pysimplesoap/client.py to client.pyc
File "build/bdist.linux-x86_64/egg/pysimplesoap/client.py", line 26
class Http(): # wrapper to use when httplib2 not available
^
SyntaxError: invalid syntax
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying pysimplesoap.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying pysimplesoap.egg-info/SOURCES.txt ->
build/bdist.linux-x86_64/egg/EGG-INFO
copying pysimplesoap.egg-info/dependency_links.txt ->
build/bdist.linux-x86_64/egg/EGG-INFO
copying pysimplesoap.egg-info/top_level.txt ->
build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/pysimplesoap-1.02c-py2.4.egg' and adding
'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing pysimplesoap-1.02c-py2.4.egg
Removing /usr/lib/python2.4/site-packages/pysimplesoap-1.02c-py2.4.egg
Copying pysimplesoap-1.02c-py2.4.egg to /usr/lib/python2.4/site-packages
Adding pysimplesoap 1.02c to easy-install.pth file
Installed /usr/lib/python2.4/site-packages/pysimplesoap-1.02c-py2.4.egg
Processing dependencies for pysimplesoap==1.02c
Original issue reported on code.google.com by [email protected]
on 29 Mar 2011 at 12:50
What steps will reproduce the problem?
# Run this code
nclient =
SoapClient(wsdl='http://ec.europa.eu/taxation_customs/vies/services/checkVatServ
ice.wsdl')
vat = 'PT508141184'
print = client.service.checkVat(countryCode=vat[:2], vatNumber=vat[2:])
What is the expected output? What do you see instead?
Something like """{'name': 'NDRIVE NAVIGATION SYSTEMS S A', 'countryCode':
'PT', 'vatNumber': '508141184', 'valid': True, 'requestDate':
datetime.date(2010, 9, 27), 'address': 'ESTR DA CIRCUNVALAÇÃO N
10381\nPORTO\n4250-151 PORTO'}"""
What version of the product are you using? On what operating system?
Mercurial repo, rev. 8e831ad8fe1c (tip, at the time).
Please provide any additional information below.
>>> print client.checkVat(countryCode=vat[:2], vatNumber=vat[2:])
--------------------------------------------------------------------------------
POST http://ec.europa.eu/taxation_customs/vies/services/checkVatService
SOAPAction: "None"
Content-length: 401
Content-type: text/xml; charset="UTF-8"
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<checkVat xmlns="urn:ec.europa.eu:taxud:vies:services:checkVat:types">
<countryCode>PT</countryCode><vatNumber>508141184</vatNumber></checkVat>
</soap:Body>
</soap:Envelope>
via: 1.0 localhost (squid/3.0.STABLE1)
proxy-connection: close
x-cache: MISS from localhost
x-cache-lookup: MISS from localhost:3128
server: WebLogic Server 8.1 SP3 Tue Jun 29 23:11:19 PDT 2004 404973
date: Mon, 27 Sep 2010 12:28:23 GMT
content-type: text/xml; charset=UTF-8
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><urn:che
ckVatResponse
xmlns:urn="urn:ec.europa.eu:taxud:vies:services:checkVat:types"><urn:countryCode
>PT</urn:countryCode><urn:vatNumber>508141184</urn:vatNumber><urn:requestDate>20
10-09-27+02:00</urn:requestDate><urn:valid>true</urn:valid><urn:name>NDRIVE
NAVIGATION SYSTEMS S A</urn:name><urn:address>ESTR DA CIRCUNVALAÇÃO N 10381
PORTO
4250-151
PORTO</urn:address></urn:checkVatResponse></soapenv:Body></soapenv:Envelope>
================================================================================
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "client.py", line 105, in <lambda>
return lambda self=self, *args, **kwargs: self.wsdl_call(attr,*args,**kwargs)
File "client.py", line 209, in wsdl_call
resp = response('Body',ns=soap_uri).children().unmarshall(output)
File "simplexml.py", line 325, in unmarshall
value = children and children.unmarshall(fn)
File "simplexml.py", line 335, in unmarshall
raise ValueError("Tag: %s: %s" % (name, unicode(e)))
ValueError: Tag: address: ('ascii', u'ESTR DA CIRCUNVALA\xc7\xc3O N
10381\nPORTO\n4250-151 PORTO', 18, 20, 'ordinal not in range(128)')
Original issue reported on code.google.com by [email protected]
on 27 Sep 2010 at 12:35
It would be nice to be able to write something like this:
headers = SimpleXMLElement()
headers.add_child('headername').marshall('attrname', 'attrvalue')
client.call('methodname', headers=headers)
The client code would have this block inside the call method:
if kwargs.has_key('headers'):
header_block = xml_body('soapenv:Header')
for subheader in kwargs['headers'].children():
header_block.import_node(subheader)
Original issue reported on code.google.com by [email protected]
on 6 May 2011 at 3:21
What steps will reproduce the problem?
1. from pysimplesoap.client import SoapClient
2. SoapClient('http://www.destin8.co.uk/ISLInterface/ISLInterface?WSDL')
What is the expected output? What do you see instead?
The SoapClient instance should be initialised from the WSDL. It instead throws
the following exception;
...
File "./aisarchive.py", line 52, in _create_client
result = SoapClient(wsdl='%s?WSDL' % self._url, trace=True)
File "/export/home/henry/code/lib/pysimplesoap/pysimplesoap/client.py", line 68, in __init__
self.services = wsdl and self.wsdl(wsdl, debug=trace, cache=cache)
File "/export/home/henry/code/lib/pysimplesoap/pysimplesoap/client.py", line 461, in wsdl
preprocess_schema(schema)
File "/export/home/henry/code/lib/pysimplesoap/pysimplesoap/client.py", line 434, in preprocess_schema
process_element(element_name, children)
File "/export/home/henry/code/lib/pysimplesoap/pysimplesoap/client.py", line 372, in process_element
uri = ns and e.get_namespace_uri(ns) or xsd_uri
File "/export/home/henry/code/lib/pysimplesoap/pysimplesoap/simplexml.py", line 182, in get_namespace_uri
v = self.__document.documentElement.attributes['xmlns:%s' % ns]
File "/usr/local/lib/python2.6/xml/dom/minidom.py", line 530, in __getitem__
return self._attrs[attname_or_tuple]
KeyError: u'xmlns:xsd'
What version of the product are you using? On what operating system?
pysimplesoap-1.02c.zip
BEA WebLogic Server 8.1
Please provide any additional information below.
The problem is the 'xsd' namespace found under schema elements.
This isn't the server I'm using; the WSDL is from a server I found online
(http://www.google.com/search?q=%22For+a+formal+definition,+please+review+the+Se
rvice+Description%22+%22BEA+WebLogic+Server+8.1%22).
Original issue reported on code.google.com by misc%[email protected]
on 5 Jan 2011 at 3:47
I want to return a list of dictionaries, and so I try the folowing function in
web2py 1.95.1:
@service.soap('MyAdd',returns={'result':[{'a':str, 'b':int,
'apotelesma':int}]},args={'a':int,'b':int,})
def add(a,b):
s={'a':str(a),'b':b,'apotelesma':a+b}
return [s,s]
By calling the function:
client.MyAdd(a=1,b=2) returns:
{'result': [{'a': u'1'},
{'apotelesma': 3},
{'b': 2},
{'a': u'1'},
{'apotelesma': 3},
{'b': 2}]}
What I would expect to see is:
{'result': [{'a': u'1','apotelesma': 3,'b': 2},
{'a': u'1','apotelesma': 3,'b': 2}]}
Is this a bug, or I am missing something ?
Original issue reported on code.google.com by [email protected]
on 29 May 2011 at 9:10
What steps will reproduce the problem?
1. using https://apitest.authorize.net/soap/v1/Service.asmx?WSDL for my WSDL
create a client with version 1.02c
2. attempt to call GetCustomerProfile with a profile ID that includes a
paymentProfile that has a 'creditCard' payment associated with it
What is the expected output? What do you see instead?
I expect the response to be properly parsed and include all information.
Instead SimpleXML throws an error that 'creditCard' is an invalid type. Upon
inspection i see that the 'payment' field of 'CustomerPaymentProfile' has
expected types of 'None'. I dug in and figured out that this was because the
'payment' field has a 'choice' element.
What version of the product are you using? On what operating system?
version 1.02c, in web2py, running from source with the GAE development
environment.
Please provide any additional information below.
The solution that works for me is the following change (diff based off of
web2py release Version 1.92.1 (2011-02-16 15:04:40))
--- a/web2py/gluon/contrib/pysimplesoap/client.py Fri Mar 04 09:12:39 2011 -0800
+++ b/web2py/gluon/contrib/pysimplesoap/client.py Sun Mar 06 15:25:50 2011 -0800
@@ -356,6 +356,11 @@
if debug: print element_name,"has not children!",tag
continue #TODO: abstract?
d = OrderedDict()
+
+ if len(children)==1 and children[0].get_local_name()=='choice'
\
+ and children[0].children():
+ children=children[0].children()
+
for e in children:
t = e['type']
if not t:
Original issue reported on code.google.com by [email protected]
on 6 Mar 2011 at 11:27
What steps will reproduce the problem?
1. Create a soap service in web2py (or another framework using
dispatcher.dispatch)
2. pass in a request that causes a soap fault
3. Get the soap fault's HTTP status code
What is the expected output? What do you see instead?
HTTP response code should be 500, but is (generally) 200 (OK)
Per soap spec here, Soap faults over HTTP should return a 500 response code
with the fault, due to the underlying HTTP protocol.
http://www.w3.org/TR/2007/REC-soap12-part0-20070427/#L26866
Section 4.1.2 just above Example 11.
pysimplesoap's return from dispatcher.dispatch doesn't return if the HTTP
response should be 200 or 500, in any way that can be consumed by an external
service calling it, without parsing the XML, or doing a string search (both bad
options, for reasons detailed in the web2py bug report)
What version of the product are you using? On what operating system?
web2py 1.91.4 (2010-12-22 17:31:23)
Ubuntu 9.10, kernel version 2.6.31-14
Python 2.6.4 (r264:75706, Nov 2 2009, 14:38:03)
[GCC 4.4.1] on linux2
pysimplesoap version looks like 1.02c from the header info in the server.py
file.
Please provide any additional information below.
Patch is attached.
More information at http://code.google.com/p/web2py/issues/detail?id=153 This
is the downstream web2py bug tracking this defect in the web2py framework
(which utilizes pysimplesoap)
apply the patch from pysimplesoap root via:
patch -p4 < server.diff
Original issue reported on code.google.com by [email protected]
on 10 Jan 2011 at 5:30
Attachments:
client cannot use Soap services with (basic) authentication - although httplib2
is present.
What version of the product are you using? On what operating system?
diff -r 9dc392f4a0ec client.py
--- a/client.py Wed Oct 20 03:59:29 2010 -0300
+++ b/client.py Tue Oct 26 18:39:00 2010 +0200
@@ -75,6 +75,11 @@
##httplib2.debuglevel=4
self.http = httplib2.Http(proxy_info = httplib2.ProxyInfo(
proxy_type=socks.PROXY_TYPE_HTTP, **proxy))
+ if '@' in location and hasattr(self.http, 'add_credentials'):
+ p = location.index('://')
+ auth = location[p+3 : location.index('@', p)].split(':', 1)
+ self.http.add_credentials(*auth)
+ del p
#if self.certssl: # esto funciona para validar al server?
# self.http.add_certificate(self.keyssl, self.keyssl, self.certssl)
self.__ns = ns # namespace prefix or False to not use it
Original issue reported on code.google.com by [email protected]
on 26 Oct 2010 at 4:39
To run with older Python, just apply the following trivial patch:
diff -d -u -r a/pysimplesoap/simplexml.py b/pysimplesoap/simplexml.py
--- a/pysimplesoap/simplexml.py 2010-10-28 02:51:19.000000000 +0200
+++ b/pysimplesoap/simplexml.py 2010-10-29 06:33:58.000000000 +0200
@@ -34,7 +34,7 @@
bool_u = lambda s: {'0':False, 'false': False, '1': True, 'true': True}[s]
# aliases:
-class Alias():
+class Alias:
def __init__(self, py_type, xml_type):
self.py_type, self.xml_type = py_type, xml_type
def __call__(self, value):
diff -d -u -r a/pysimplesoap/client.py b/pysimplesoap/client.py
--- a/pysimplesoap/client.py 2010-10-28 02:51:19.000000000 +0200
+++ b/pysimplesoap/client.py 2010-10-29 06:34:32.000000000 +0200
@@ -23,7 +23,7 @@
Http = httplib2.Http
except ImportError:
import urllib2
- class Http(): # wrapper to use when httplib2 not available
+ class Http: # wrapper to use when httplib2 not available
def request(self, url, method, body, headers):
f = urllib2.urlopen(urllib2.Request(url, body, headers))
return f.info(), f.read()
Original issue reported on code.google.com by [email protected]
on 28 Oct 2010 at 3:32
I've made test suite with test code from files: simplexml.py and server.py.
I've also added some new test code.
Original issue reported on code.google.com by [email protected]
on 16 Dec 2011 at 1:52
Attachments:
I need to connect to a SOAP server which uses cookies to maintain session
information - but pysimplesoap doesn't support it.
To get round it, I wrote a replacement Http object which is based on the Http
object defined in the client library, that uses urllib2 for connections:
----
from cookielib import CookieJar
from urllib2 import build_opener, HTTPCookieProcessor, Request
class Http(object):
def __init__(self):
from cookielib import CookieJar
self.opener = build_opener(HTTPCookieProcessor(CookieJar()))
def request(self, url, method, body, headers):
f = self.opener.open(Request(url, body, headers))
return f.info(), f.read()
client.http = Http()
----
I think the client should support this directly by taking a constructor
argument of "sessions" - which if set to True will enable cookie support.
Original issue reported on code.google.com by [email protected]
on 6 May 2011 at 3:20
The universe isn't perfect, nor is the WSDL for a webservice I have to deal
with. There should be a way to fixup the incoming WSDL so that pysimplesoap
will behave correctly. SUDS does this with 'doctors', which seems a reasonable
idea. Something like:
client = SoapClient(wsdl=wsdlurl, wsdl_fixer=myfunc)
such that myfunc would be called with the retrieved wsdl (perhaps already
parsed into a SimpleXMLElement tree?) and expected to return the same thing it
was passed in, but fixed up to the user's liking.
Original issue reported on code.google.com by [email protected]
on 16 Jun 2011 at 6:23
What steps will reproduce the problem?
>> import pysimplesoap.client
>> WSDL = 'https://webservices.netsuite.com/wsdl/v2011_2_0/netsuite.wsdl'
>> cl = pysimplesoap.client.SoapClient(wsdl=WSDL, timeout=None)
What is the expected output? What do you see instead?
The last call fails with:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "c:\pypy-1.7\site-packages\pysimplesoap\client.py", line 109, in __init__
self.services = wsdl and self.wsdl_parse(wsdl, debug=trace, cache=cache)
File "c:\pypy-1.7\site-packages\pysimplesoap\client.py", line 638, in wsdl_parse
preprocess_schema(schema)
File "c:\pypy-1.7\site-packages\pysimplesoap\client.py", line 592, in preprocess_schema
preprocess_schema(imported_schema)
File "c:\pypy-1.7\site-packages\pysimplesoap\client.py", line 592, in preprocess_schema
preprocess_schema(imported_schema)
File "c:\pypy-1.7\site-packages\pysimplesoap\client.py", line 576, in preprocess_schema
for element in schema.children():
TypeError: 'NoneType' object is not iterable
What version of the product are you using? On what operating system?
Using:
* Windows XP SP3
* Python 2.7
* pysimplesoap rev 127
* httplib2 v0.7.2
Original issue reported on code.google.com by [email protected]
on 6 Feb 2012 at 7:44
For the attached WSDL, there is a requirement to provide a username, password,
and access key via custom SOAP Headers in order to use the Web Service. Python
SUDS supports this as per
https://fedorahosted.org/suds/wiki/Documentation#SOAPHEADERS ; can this be
added to pysimplesoap?
More detail can be found on page 7 of section 1.6 in the attached PDF.
Thanks in advance!
Original issue reported on code.google.com by [email protected]
on 5 Aug 2010 at 2:15
Attachments:
What steps will reproduce the problem?
1. Downloaded 1.05a release from download page and installed using setup.py
2. Running either example code from introduction page or tests/client_tests
--wsdl-client
3. Outputs:
Traceback (most recent call last):
File "client_tests.py", line 122, in <module>
client = SoapClient(wsdl='https://wswhomo.afip.gov.ar/wsfex/service.asmx?WSDL',cache="cache", trace=False)
File "/chalmers/users/edstromr/usr/lib/python2.7/site-packages/pysimplesoap/client.py", line 103, in __init__
self.http = Http(timeout=TIMEOUT, cacert=cacert, proxy=proxy, sessions=sessions)
File "/chalmers/users/edstromr/usr/lib/python2.7/site-packages/pysimplesoap/transport.py", line 88, in __init__
raise RuntimeError('timeout is not supported with urllib2 transport')
RuntimeError: timeout is not supported with urllib2 transport
Original issue reported on code.google.com by [email protected]
on 16 Jan 2012 at 10:43
Purpose of code changes on this branch:
- ability to add extra namespaces to server response
- change defined namespace aliases to this provided by client in his request
When reviewing my code changes, please focus on:
- SoapDispatcher.dispatch method which adds extra namespaces to response
- namespaces mapping in SimpleXMLElement
Original issue reported on code.google.com by [email protected]
on 20 Dec 2011 at 11:30
To run with older Python, just apply the following trivial patch:
diff -d -u -r a/pysimplesoap/simplexml.py b/pysimplesoap/simplexml.py
--- a/pysimplesoap/simplexml.py 2010-10-28 02:51:19.000000000 +0200
+++ b/pysimplesoap/simplexml.py 2010-10-29 06:33:58.000000000 +0200
@@ -34,7 +34,7 @@
bool_u = lambda s: {'0':False, 'false': False, '1': True, 'true': True}[s]
# aliases:
-class Alias():
+class Alias:
def __init__(self, py_type, xml_type):
self.py_type, self.xml_type = py_type, xml_type
def __call__(self, value):
diff -d -u -r a/pysimplesoap/client.py b/pysimplesoap/client.py
--- a/pysimplesoap/client.py 2010-10-28 02:51:19.000000000 +0200
+++ b/pysimplesoap/client.py 2010-10-29 06:34:32.000000000 +0200
@@ -23,7 +23,7 @@
Http = httplib2.Http
except ImportError:
import urllib2
- class Http(): # wrapper to use when httplib2 not available
+ class Http: # wrapper to use when httplib2 not available
def request(self, url, method, body, headers):
f = urllib2.urlopen(urllib2.Request(url, body, headers))
return f.info(), f.read()
Original issue reported on code.google.com by [email protected]
on 28 Oct 2010 at 3:31
If you use a soap client such as SUDS the example method 'adder' in the
server.py main does not work.
Suds generates slightly different xml for the call to :-
response =
client.Adder(p={'a':1,'b':2},dt='2010-07-24',c=[{'d':'1.20'},{'d':'2.01'}])
it generates:-
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://www.affinitext.com/ACSSoap/"
xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<ns1:Body>
<ns0:Adder>
<ns0:p>
<ns0:a>1</ns0:a>
<ns0:b>2</ns0:b>
</ns0:p>
<ns0:dt>2010-07-24</ns0:dt>
<ns0:c>
<ns0:d>1.20</ns0:d>
</ns0:c>
<ns0:c>
<ns0:d>2.01</ns0:d>
</ns0:c>
</ns0:Adder>
</ns1:Body>
</SOAP-ENV:Envelope>
the 2 <ns0:c> elements get collapsed to one. This is caused inside
simplexml.py in the unmarshall method. Basically if a list is encountered it
is initialized to an empty list for each <ns0:c> rather than appending to the
existing list.
the fix is simple in that the code
value = []
just needs to be changed to:-
value = d.setdefault(name, [])
I have attached a diff file to help zero in on the line.
Original issue reported on code.google.com by [email protected]
on 18 Aug 2011 at 6:25
Attachments:
For my use with the client, I need to modify the XML request before it is sent
out to the SOAP server.
Just before the XML is sent, the client code does this:
self.xml_request = request.as_xml()
I currently subclass the client, override __setattr__ to catch the xml_request
assignment, instantiate a SimpleXMLElement instance with the XML, and
manipulate it that way.
I think the client should call a method with the XML object just before it
turns it into a string to allow subclasses to manipulate it. For example:
self.pre_send_xml_request(request)
self.xml_request = request.as_xml()
where pre_send_xml_request is a method to be overridden by subclasses who want
to manipulate the XML before it is sent.
Original issue reported on code.google.com by [email protected]
on 6 May 2011 at 3:20
The client only supports one namespace to be used. I would like to be able to
pass multiple namespaces at construction time (maybe in a dictionary form of
{ns: namespace}).
Original issue reported on code.google.com by [email protected]
on 6 May 2011 at 3:21
I have to place the session id in the header on each client call. Using this
same WSDL (https://api.clarizen.com/v1.0/Clarizen.svc) in PHP SoapClient, I
would do the following:
$header[] = new SoapHeader("http://clarizen.com/api", 'Session', array ("ID" =>
$sessionId));
$client->__setSoapHeaders($header);
This generates:
<SOAP-ENV:Header><ns1:Session><ns1:ID>some
guid</ns1:ID></ns1:Session></SOAP-ENV:Header>
ns1="http://clarizen.com/api", btw.
In pysimplesoap, I can successfully login and get the session id. Reading some
examples, it seems that the header can be added as a normal dict entry. But I'm
not having luck.
session = response['LoginResult']['SessionId']
#at this point, I can print session and it's good
client['Session'] = { 'ID' : session }
When I try to execute a remote call, I get this as the request XML...
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header/>
<soap:Body>
The server obviously responds that the session is missing:
<s:Envelope
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode>
s:Client</faultcode><faultstring xml:lang="en-US">Authentication header
(Session) is missing. Did you forget to
login?</faultstring></s:Fault></s:Body></s:Envelope>
If a login is needed for Clarizen, they are easy to obtain. I could create a
dummy one for my company if needed temporarily.
Thanks.
John
Original issue reported on code.google.com by [email protected]
on 27 Jan 2012 at 10:19
Trying this (using pysimplesoap 1.02b):
>>> from pysimplesoap.client import SoapClient
>>> client =
SoapClient(wsdl="http://greg.froh.ca/fun/random_bushism/soap/index.php?wsdl",
trace=False)
I got the following error message:
--------------------------------------------------------------------------
/tmp/pysimplesoap/client.py in __init__(self, location, action, namespace,
cert, trace, exceptions, proxy, ns, soap_ns, wsdl)
65 self.__soap_ns = soap_ns
66
---> 67 self.services = wsdl and self.wsdl(wsdl) # parse wsdl url
68 self.service_port = None # service port for late binding
69
/tmp/pysimplesoap/client.py in wsdl(self, url, debug)
350 element = {}
351 if part:
--> 352 element_name = get_local_name(part['element'])
353 element = {element_name: elements.get(element_name)}
354 messages[message['name']] = element
/tmp/pysimplesoap/client.py in <lambda>(s)
231 xsi_uri="http://www.w3.org/2001/XMLSchema-instance"
232
--> 233 get_local_name = lambda s: str((':' in s) and s.split(':')[1]
or s)
234
235 REVERSE_TYPE_MAP = dict([(v,k) for k,v in TYPE_MAP.items()])
TypeError: argument of type 'NoneType' is not iterable
--------------------------------------------------------------------------
Original issue reported on code.google.com by [email protected]
on 14 Nov 2010 at 1:20
Sorry if this is the wrong forum. First, thank you for your efforts. This is
the only Python SOAP client that is close to working for me.
I'm trying to use pysimplesoap to access a client WSDL below:
SoapClient(wsdl="https://api.clarizen.com/v1.0/Clarizen.svc",namespace='http://c
larizen.com/api',trace=True)
response = client.Login(userName="foo",password="bar");
This generates an incorrect namespace on the call:
<soap:Body>
<Login xmlns="http://clarizen.com/api/Imports">
<userName>foo</userName><password>bar</password></Login>
</soap:Body>
The correct namespace is: http://clarizen.com/api
It works if I do this:
client.namespace = 'http://clarizen.com/api'
response = client.Login(userName="foo",password="bar");
Is it expected that I need to manually set the namespace like this?
Also, at the very end (using real credentials), I get this:
ValueError: Tag: ServerTime: unconverted data remains: .3473526Z
Original issue reported on code.google.com by [email protected]
on 18 Jan 2012 at 6:06
What steps will reproduce the problem?
1. El servidor valida un campo sólo en caso de que se envíe la etiqueta
vacía.
2. La solicitud del cliente soap supuestamente omite las etiquetas de texto sin
contenido
3. El servidor responde con un error porque se omitió la etiqueta que debía
incluirse vacía.
What is the expected output? What do you see instead?
Respuesta del servidor con validación de datos de solicitud. Se obtiene un
error de campo vacío obligatorio.
What version of the product are you using? On what operating system?
Sistema Mandriva GNU/Linux Free 2010.1
pysimplesoap 1.03f
Please provide any additional information below.
Adjunto una propuesta para modificar client.py y simplexmlelement.py
las clases Client y SimpleXMLElement reciben un kwarg voidstr =
u"[strdeetiquetavacía]". Para contenidos de etiqueta igual al valor pasado. Se
agrega la etiqueta a request.
Original issue reported on code.google.com by [email protected]
on 9 Jun 2011 at 5:01
Attachments:
The SoapFault exception class takes the faultcode and faultstring, but doesn't
call the superconstructor with those values.
That means that if the exception is raised, it doesn't print out the faultcode
or faultstring in the representation of it,
since RuntimeError.__init__ wasn't called.
A better implementation would be:
class SoapFault(RuntimeError):
def __init__(self, faultcode, faultstring):
self.faultcode = faultcode
self.faultstring = faultstring
RuntimeError.__init__(self, faultcode, faultstring)
def __str__(self):
return '%s: %s' % (self.faultcode, self.faultstring)
Original issue reported on code.google.com by [email protected]
on 6 May 2011 at 3:20
What steps will reproduce the problem?
1. Create a simple client:
c = SoapClient(wsdl=..., trace=True)
c.method()
What is the expected output? What do you see instead?
Fetching the WSDL file fails using urllib2. I do not have httplib2 installed.
What version of the product are you using? On what operating system?
Python 2.6 on Windows.
Please provide any additional information below.
2 bugs:
1. SoapClient creates HTTP wrapper using Http(timeout=TIMEOUT) and the default
timeout is 60, which urllib2Transport complains with "timeout not supported"
2. SoapClient.fetch(url) calls the HTTP wrapper with self.http.request(url,
"GET") which complains because urllib2Transport has 5 mandatory args, but is
called only with 2.
The following patch should fix the bugs:
diff --git a/pysimplesoap/client.py b/pysimplesoap/client.py
--- a/pysimplesoap/client.py
+++ b/pysimplesoap/client.py
@@ -42,6 +42,7 @@
try:
import httplib2
except ImportError:
+ TIMEOUT = None # timeout not supported by urllib2
pass
else:
class Httplib2Transport(httplib2.Http, TransportBase):
@@ -91,7 +92,7 @@
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(CookieJar()))
self.request_opener = opener.open
- def request(self, url, method, body, headers):
+ def request(self, url, method="GET", body=None, headers={}):
try:
f = self.request_opener(urllib2.Request(url, body, headers))
except urllib2.HTTPError, f:
Original issue reported on code.google.com by [email protected]
on 6 Nov 2011 at 9:06
Currently in dispatch() if there's an error after the invocation of the
function - during the construction of the return XML - the client will be
return gibberish rather than a Fault. A simple refactoring allows errors during
result serialisation (marsalling) to also return a Fault to the client. This is
attached.
Original issue reported on code.google.com by r1chardj0n3s
on 23 Nov 2011 at 11:29
Attachments:
What steps will reproduce the problem?
1.
from pysimplesoap.client import SoapClient
client = SoapClient(wsdl="http://eklima.met.no/metdata/MetDataService?WSDL",
trace=True)
What is the expected output? What do you see instead?
Fails with:
KeyError: u'xmlns:SOAP-ENC'
What version of the product are you using? On what operating system?
pysimplesoap-1.02c
Please provide any additional information below.
Disclaimer: I'm not very familiar with WSDL and the more intricate aspects of
XML, so this might just be a bug in the WSDL (seems to be generated so one
would hope it's valid though). Sorry if that's the case.
Attached a copy of the WSDL file
Original issue reported on code.google.com by [email protected]
on 28 Jun 2011 at 6:59
Attachments:
What steps will reproduce the problem?
1. Invoke SoapClient containing a WSDL which is different from the action URL,
e.g. client = SoapClient(wsdl="http://example.com/test.wsdl") where the action
URL is http://example.com/XML/test
2. Running wireshark, you will observe the following output:
GET http://example.com/test.wsdl HTTP/1.0
Host: example.com
User-Agent: Python-urllib/1.17
3. Python stack trace:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\scott\Documents\workspace\web2py\web2py-dev\gluon\contrib\pysimplesoap\client.py", line 67, in __init__
self.services = wsdl and self.wsdl(wsdl) # parse wsdl url
File "C:\Users\scott\Documents\workspace\web2py\web2py-dev\gluon\contrib\pysimplesoap\client.py", line 241, in wsdl
wsdl = SimpleXMLElement(xml, namespace=wsdl_uri)
File "C:\Users\scott\Documents\workspace\web2py\web2py-dev\gluon\contrib\pysimplesoap\simplexml.py", line 104, in __init__
self.__document = xml.dom.minidom.parseString(text)
File "D:\Python25\lib\xml\dom\minidom.py", line 1925, in parseString
return expatbuilder.parseString(string)
File "D:\Python25\Lib\xml\dom\expatbuilder.py", line 940, in parseString
return builder.parseString(string)
File "D:\Python25\Lib\xml\dom\expatbuilder.py", line 223, in parseString
parser.Parse(string, True)
xml.parsers.expat.ExpatError: mismatched tag: line 11, column 2
What is the expected output? What do you see instead?
I expect that the WSDL would be retrieved. Unfortunately, instead of
requesting issuing a GET /test.wsdl, the SoapClient is actually performing GET
http://example.com/test.wsdl, which will fail with a 404 not found.
What version of the product are you using? On what operating system?
1.02a
Original issue reported on code.google.com by [email protected]
on 4 Aug 2010 at 3:19
I created SOAP call from example
http://code.google.com/p/pysimplesoap/wiki/SoapClient#Basic_example_using_WSDL
Headers were defined like in
http://code.google.com/p/pysimplesoap/wiki/SoapClient#WSDL_SOAP_Headers_Example
client['MyTestHeader'] = {'username': 'test', 'password': 'test'}
I expected to see "MyTestHeader" headers on message, but headers were empty
"<soap:Header/>".
Python version is 2.7.2 and pysimplesoap version is 1.05a.
Original issue reported on code.google.com by [email protected]
on 25 Jan 2012 at 10:09
What steps will reproduce the problem?
1. Tried many combinaisions for 2 hours such as :
dispatcher.register_function('get_device_list_list',
webserv.get_device_list_list,
returns={'Result': [{str: str}]},
args = {})
2. Defining my client : client = SoapClient(wsdl = "http://127.0.0.1:8080/",
trace = True)
3. I never have the answer, usually it breaks at the client definition.
What is the expected output? What do you see instead?
- Generate a message such as :
<Result><ItemA>Value1</ItemA><ItemB>Value2</ItemB>....<ItemX>Value26</ItemX></Re
sult>
- And client parse it correctly in a dict such as
{'ItemA': 'Value1', ... }
What version of the product are you using? On what operating system?
Version 1.02a on UbuntuS erver 10.04.
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 21 Aug 2010 at 11:43
see subject
Original issue reported on code.google.com by [email protected]
on 25 Aug 2010 at 2:17
What steps will reproduce the problem?
1.call a soap method that doesnt require arguments
2.the call generates an empty soap:body xml
3.the soap server excepts
What is the expected output? What do you see instead?
the expected output is a call of the method without arguments
What version of the product are you using? On what operating system?
PySimpleSOAP-1.05a.win32.exe
Please provide any additional information below.
output of the pysimplesoap client:
"""
POST http://localhost:22222/?wsdl
SOAPAction: "RecuperaEstadoDispositivos"
Content-length: 270
Content-type: text/xml; charset="UTF-8"
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-i
nstance">
<soap:Header/>
<soap:Body>
</soap:Body>
</soap:Envelope>
date: Wed, 08 Feb 2012 18:21:09 GMT
status: 500
content-length: 59
content-type: text/plain
server: WSGIServer/0.1 Python/2.6.6
A server error occurred. Please contact the administrator.
================================================================================
ERROR:A server error occurred. Please contact the administrator.
Traceback (most recent call last):
File "client_ws1.py", line 6, in <module>
print client.RecuperaEstadoDispositivos()
File "C:\Python26\Lib\site-packages\pysimplesoap\client.py", line 140, in <lambda>
return lambda *args, **kwargs: self.wsdl_call(attr,*args,**kwargs)
File "C:\Python26\Lib\site-packages\pysimplesoap\client.py", line 289, in wsdl_call
response = self.call(method, *params)
File "C:\Python26\Lib\site-packages\pysimplesoap\client.py", line 186, in call
response = SimpleXMLElement(self.xml_response, namespace=self.namespace)
File "C:\Python26\Lib\site-packages\pysimplesoap\simplexml.py", line 133, in __init__
self.__document = xml.dom.minidom.parseString(text)
File "C:\Python26\lib\site-packages\pyxml-0.8.4-py2.6-win32.egg\_xmlplus\dom\minidom.py", line 1925, in parseString
return expatbuilder.parseString(string)
File "C:\Python26\lib\site-packages\pyxml-0.8.4-py2.6-win32.egg\_xmlplus\dom\expatbuilder.py", line 942, in parseString
return builder.parseString(string)
File "C:\Python26\lib\site-packages\pyxml-0.8.4-py2.6-win32.egg\_xmlplus\dom\expatbuilder.py", line 223, in parseString
parser.Parse(string, True)
xml.parsers.expat.ExpatError: syntax error: line 1, column 0
C:\Python26\Lib\site-packages\biokit\demo\tsev2_demo\wsv2>"""
and wsdl file attached.
Original issue reported on code.google.com by [email protected]
on 8 Feb 2012 at 6:27
Attachments:
So far I used soaplib that integrate with django. I'm looking for the solution
of how to integrate Django with pysimplesoap. Django as server SOAP (WSDL). I
mean the integration with authentication and django views. Django is currently
one of the most popular Python frameworks.
Original issue reported on code.google.com by [email protected]
on 23 Aug 2010 at 8:15
What steps will reproduce the problem?
1. Import a WSDL with a schema element that uses an import.
<types>
<xsd:schema>
<xsd:import namespace="XX" schemaLocation="" />
</xsd:scema>
</types>
2. Execute a call to the operation that requires this type import.
What is the expected output? What do you see instead?
The failure is that the input of the operation may not have a value (None) so
the ordered dict routine fails because there is no dictionary in the input of
the operation.
What version of the product are you using? On what operating system?
Latest trunk
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 15 Sep 2010 at 12:10
This egg should be on pypi and installabel with easy_install or pip.
Please add a "setuo.py". The easiest way is to use ZopeSkel, Paster to generate
all needed files.
$ bin/easy_install ZopeSkel
$ bin/paster create -t basic_package pysimplesoap
...
Here some info:
http://mrtopf.de/blog/en/a-small-introduction-to-python-eggs/
http://packages.python.org/distribute/setuptools.html#id3
Original issue reported on code.google.com by [email protected]
on 3 Nov 2010 at 11:32
Attachments:
It's better to use python loggers than print statement.
With that change, we are able to see messages only from specified module, or
only critical messages.
Usage:
import logging
logging.basicConfig(level=logging.DEBUG)
logging.getLogger('pysimplesoap.server').setLevel(logging.DEBUG)
logging.getLogger('pysimplesoap.simplexml').setLevel(logging.DEBUG)
Original issue reported on code.google.com by [email protected]
on 16 Dec 2011 at 10:27
Attachments:
I'm creating client/service in pysimplesoap for testing interoperability with
gsoap framework and found small bug in response processing. By default
pysimplesoap uses default namespace in Request/Response elements like this:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<Resolve xmlns="urn:dns:service:1.0"> <!-- default namespace -->
<Name>osnews.com</Name>
</Resolve>
</soap:Body>
</soap:Envelope>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<ResolveResponse xmlns="urn:dns:service:1.0"> <!-- default namespace -->
<IP>74.86.31.159</IP>
</ResolveResponse>
</soap:Body>
</soap:Envelope>
Everything is ok and IP element has correct namespace. But gsoap generates
request in a different way creating global namespace prefix and qualifying
every element with prefix. This changes behavior of pysimplesoap which in
response also creates namespace prefix but qualifies only top response element:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ds="urn:dns:service:1.0">
<SOAP-ENV:Body>
<ds:Resolve>
<ds:Name>osnews.com</ds:Name>
</ds:Resolve>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ds="urn:dns:service:1.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ds:ResolveResponse>
<IP>74.86.31.159</IP>
</ds:ResolveResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
This time IP has default namespace which in this particular message is
undefined.
Original issue reported on code.google.com by Jan.Palus
on 23 Jan 2011 at 7:04
What steps will reproduce the problem?
1.
#the following test code:
VIES_URL='http://ec.europa.eu/taxation_customs/vies/services/checkVatService.wsd
l'
nclient = SoapClient(wsdl=VIES_URL)
vat = 'BE0897290877'
code = vat[:2]
number = vat[2:]
res = client.service.checkVat(countryCode=code, vatNumber=number)
2.
3.
What is the expected output? What do you see instead?
True
but instead i get:
In [25]: res = client.checkVat(countryCode=code, vatNumber=number)
---------------------------------------------------------------------------
SoapFault Traceback (most recent call last)
/home/AFSDFSDAFSDF/<ipython console> in <module>()
/home/AFSDFSDAFSDF/web2py/gluon/contrib/pysimplesoap/client.py in
<lambda>(self, *args, **kwargs)
103 return lambda self=self, *args, **kwargs: self.call(attr,*args,**kwargs)
104 else: # using WSDL:
--> 105 return lambda self=self, *args, **kwargs:
self.wsdl_call(attr,*args,**kwargs)
106
107 def call(self, method, *args, **kwargs):
/home/AFSDFSDAFSDF/web2py/gluon/contrib/pysimplesoap/client.py in
wsdl_call(self, method, *args, **kwargs)
205 params = kwargs and kwargs.items()
206 # call remote procedure
--> 207 response = self.call(method, *params)
208 # parse results:
209 resp = response('Body',ns=soap_uri).children().unmarshall(output)
/home/AFSDFSDAFSDF/web2py/gluon/contrib/pysimplesoap/client.py in call(self,
method, *args, **kwargs)
128 response = SimpleXMLElement(self.xml_response, namespace=self.namespace)
129 if self.exceptions and response("Fault", ns=soap_namespaces.values(), error=False):
--> 130 raise SoapFault(unicode(response.faultcode),
unicode(response.faultstring))
131 return response
132
but it works fine with the add and subtract examples. So it must be some
untested incompatibility :/
The problem is not from the server, since a the code from
http://code.google.com/p/vatnumber which is based on another python soap
implementation(suds) works fine.
What version of the product are you using? On what operating system?
web2py 1.84
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 13 Sep 2010 at 2:23
from pysimplesoap.client import SoapClient
client =
SoapClient(wsdl="http://webserviceAddress/authenticator/authenticationservice.as
mx?wdsl", trace=False)
response = client.AddIntegers(userName="x", passWord="y")
result = response['ResponseText']
print ("result")
Traceback (most recent call last):
File "C:/Program Files/ninja-ide-2.0-beta3-exe/webservice.py", line 1, in <module>
from pysimplesoap.client import SoapClient
File "C:\Python32\lib\site-packages\pysimplesoap\client.py", line 46
return u"%s: %s" % (self.faultcode, self.faultstring)
^
SyntaxError: invalid syntax
I have the latest version from the repository.
Original issue reported on code.google.com by [email protected]
on 31 Jan 2012 at 6:07
the server example given in the wiki is not working with the latest version.
SoapDispatcher is expecting a name argument missing in the example code.
existing code:
dispatcher = SoapDispatcher(
location = "http://localhost:8008/",
action = 'http://localhost:8008/', # SOAPAction
namespace = "http://example.com/sample.wsdl", prefix="ns0",
trace = True,
ns = True)
valid code:
dispatcher = SoapDispatcher(
'my_dispatcher',
location = "http://localhost:8008/",
action = 'http://localhost:8008/', # SOAPAction
namespace = "http://example.com/sample.wsdl", prefix="ns0",
trace = True,
ns = True)
Original issue reported on code.google.com by [email protected]
on 6 Sep 2010 at 10:46
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.