kartagis / pysimplesoap

Automatically exported from code.google.com/p/pysimplesoap
0 stars 0 forks source link

not working with europa.eu, tax service. #8

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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 smog...@gmail.com on 13 Sep 2010 at 2:23

GoogleCodeExporter commented 8 years ago
The SoapFault says there is a problem with the namespace parsed from WSDL.
I will look it ASAP.

You can use this workaround in the meantime:

client = SoapClient(
            location = "http://ec.europa.eu/taxation_customs/vies/services/checkVatService",
            action = '', 
            namespace = "urn:ec.europa.eu:taxud:vies:services:checkVat:types",
            trace = True
            )
vat = 'BE0897290877'
code = vat[:2]
number = vat[2:]
res = client.checkVat(countryCode=code, vatNumber=number)
print res('countryCode')
print res('vatNumber')
print res('name')
print res('address')

This works because it set manually correct namespace from WSDL.

Original comment by reingart@gmail.com on 13 Sep 2010 at 3:32

GoogleCodeExporter commented 8 years ago
Fixed in recent commits (revision a823096e2b)

See attached example.

Original comment by reingart@gmail.com on 27 Sep 2010 at 1:55

Attachments: