Hi,
I'm trying to connect to the SOAP interface of an innovaphone system. I'm using the following code to connect to the WSDL file:
from suds.client import Client
from suds.xsd.doctor import ImportDoctor, Import from suds.transport.http import HttpAuthenticated
imp = Import('http://schemas.xmlsoap.org/soap/encoding/') imp.filter.add('http://innovaphone.com/pbx') imp.filter.add('http://innovaphone.com/binding')
d = ImportDoctor(imp) url = 'http://localhost/pbx800.wsdl' t = HttpAuthenticated(username='****', password='****')
client = Client(url, transport=t, doctor=d)
print client print client.service.Version()
The WSDL file I'm using is the same as at: http://www.innovaphone.com/wsdl/pbx800.wsdl
With the 5th to last line (soap:address location) edited to point to our PBX server.
running the above script results in the following error:
File "sudstest.py", line 16, in <module>
print client.service.Version()
File "/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/client.py", line 542, in __call__ return client.invoke(args, kwargs) File "/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/client.py", line 602, in invoke result = self.send(soapenv) File "/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/client.py", line 643, in send result = self.succeeded(binding, reply.message) File "/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/client.py", line 678, in succeeded reply, result = binding.get_reply(self.method, reply) File "/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/bindings/binding.py", line 149, in get_reply soapenv.promotePrefixes() AttributeError: 'NoneType' object has no attribute 'promotePrefixes'
When I quote out the "print client.service.Version()" line, it displays all the methods from the WSDL file, but when I leave it uncommented, the "print client" line doesn't get printed before the error comes up.
Any idea what's causing this error?
I'm using python version 2.6.6 and suds version 0.4
Thanks in advance!
-Remy
Hi, it'd help us to understand the issue, if you'd capture the network traffic with a tool like Wireshark or tcpdump, and post it to the mailing list with any sensitive information (including the base64-encoded credentials in the Authorization HTTP header) removed.
Regards, András Veres-Szentkirályi
2011. november 30. szerda 15:40:44 dátummal Remy de Boer ezt írta:
Hi,
I'm trying to connect to the SOAP interface of an innovaphone system. I'm using the following code to connect to the WSDL file:
from suds.client import Client
from suds.xsd.doctor import ImportDoctor, Import from suds.transport.http import HttpAuthenticated
imp = Import('http://schemas.xmlsoap.org/soap/encoding/') imp.filter.add('http://innovaphone.com/pbx') imp.filter.add('http://innovaphone.com/binding')
d = ImportDoctor(imp) url = 'http://localhost/pbx800.wsdl' t = HttpAuthenticated(username='****', password='****')
client = Client(url, transport=t, doctor=d)
print client print client.service.Version()
The WSDL file I'm using is the same as at: http://www.innovaphone.com/wsdl/pbx800.wsdl
With the 5th to last line (soap:address location) edited to point to our PBX server.
running the above script results in the following error:
File "sudstest.py", line 16, in <module>
print client.service.Version()
File
"/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/client.py", line 542, in __call__
return client.invoke(args, kwargs)
File
"/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/client.py", line 602, in invoke
result = self.send(soapenv)
File
"/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/client.py", line 643, in send
result = self.succeeded(binding, reply.message)
File
"/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/client.py", line 678, in succeeded
reply, result = binding.get_reply(self.method, reply)
File
"/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/bindings/bindin g.py", line 149, in get_reply
soapenv.promotePrefixes()
AttributeError: 'NoneType' object has no attribute 'promotePrefixes'
When I quote out the "print client.service.Version()" line, it displays all the methods from the WSDL file, but when I leave it uncommented, the "print client" line doesn't get printed before the error comes up.
Any idea what's causing this error?
I'm using python version 2.6.6 and suds version 0.4
Thanks in advance!
-Remy
Hi again, took a while..
So I captured some stuffs. Turns out suds is sending the following:
<?xml version="1.0" encoding="UTF-8" ?> <SOAP-ENV:Envelope xmlns:ns3="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://innovaphone.com/pbx" xmlns:ns2="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:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/%22%3E SOAP-ENV:Header/ ns2:Body ns1:Initialize ns1:Initialize <user xsi:type="xsd:string">SOAP</user> <appl xsi:type="xsd:string">Python SOAP Wrapper</appl> <v xsi:type="xsd:boolean">true</v> <v501 xsi:type="xsd:boolean">true</v501> <v700 xsi:type="xsd:boolean">true</v700> <v800 xsi:type="xsd:boolean">true</v800> </ns1:Initialize> </ns2:Body> </SOAP-ENV:Envelope>
When I try to use the Initialize method of the WSDL file.
So what should be happening is that it uses SOAP-ENV:Body, but it's using ns2:Body instead, which is making the server not recognise the commands. I also don't understand why I have ns0 through ns3, is this something to do with the importdoctor?
-Remy
On 30 November 2011 17:09, Veres-Szentkiralyi Andras vsza@vsza.hu wrote:
Hi, it'd help us to understand the issue, if you'd capture the network traffic with a tool like Wireshark or tcpdump, and post it to the mailing list with any sensitive information (including the base64-encoded credentials in the Authorization HTTP header) removed.
Regards, András Veres-Szentkirályi
- november 30. szerda 15:40:44 dátummal Remy de Boer ezt írta:
Hi,
I'm trying to connect to the SOAP interface of an innovaphone system. I'm using the following code to connect to the WSDL file:
from suds.client import Client
from suds.xsd.doctor import ImportDoctor, Import from suds.transport.http import HttpAuthenticated
imp = Import('http://schemas.xmlsoap.org/soap/encoding/') imp.filter.add('http://innovaphone.com/pbx') imp.filter.add('http://innovaphone.com/binding')
d = ImportDoctor(imp) url = 'http://localhost/pbx800.wsdl' t = HttpAuthenticated(username='****', password='****')
client = Client(url, transport=t, doctor=d)
print client print client.service.Version()
The WSDL file I'm using is the same as at: http://www.innovaphone.com/wsdl/pbx800.wsdl
With the 5th to last line (soap:address location) edited to point to our PBX server.
running the above script results in the following error:
File "sudstest.py", line 16, in <module>
print client.service.Version()
File
"/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/client.py", line 542, in __call__
return client.invoke(args, kwargs)
File
"/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/client.py", line 602, in invoke
result = self.send(soapenv)
File
"/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/client.py", line 643, in send
result = self.succeeded(binding, reply.message)
File
"/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/client.py", line 678, in succeeded
reply, result = binding.get_reply(self.method, reply)
File
"/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/bindings/bindin
g.py", line 149, in get_reply
soapenv.promotePrefixes()
AttributeError: 'NoneType' object has no attribute 'promotePrefixes'
When I quote out the "print client.service.Version()" line, it displays
all
the methods from the WSDL file, but when I leave it uncommented, the
client" line doesn't get printed before the error comes up.
Any idea what's causing this error?
I'm using python version 2.6.6 and suds version 0.4
Thanks in advance!
-Remy
Using ns2 is not a problem in itself, if you send out a _really_ plain request, Body always gets nsX (where 0 <= X <= 9), but if you look at the xmlns declarations, it's the same URL as in case of SOAP-ENV:
xmlns:ns2="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
Following the rules of XML, ns2:Body is fine, since prefix is only a "pointer" to the XML namespace URL, which qualifies the tag name (or attribute). On the other hand, the reason behind this nsX:Body solution is quite an obscure one -- I think, it's related to the suds.sax namespace, the one and only XML library used by SUDS historically.
I tried using the service using CXF, but it reported the following message: WSDLToJava Error: Rpc/encoded wsdls are not supported with CXF
If you manage to make it work with any other SOAP solution, that would make things easier, as we'd have a working example as an aid for improvement.
Regards, András Veres-Szentkirályi
2011. december 5. hétfő 22:19:20 dátummal Remy de Boer ezt írta:
Hi again, took a while..
So I captured some stuffs. Turns out suds is sending the following:
<?xml version="1.0" encoding="UTF-8" ?> <SOAP-ENV:Envelope xmlns:ns3="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://innovaphone.com/pbx" xmlns:ns2="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:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Header/> <ns2:Body> <ns1:Initialize>
ns1:Initialize <user xsi:type="xsd:string">SOAP</user> <appl xsi:type="xsd:string">Python SOAP Wrapper</appl> <v xsi:type="xsd:boolean">true</v> <v501 xsi:type="xsd:boolean">true</v501> <v700 xsi:type="xsd:boolean">true</v700> <v800 xsi:type="xsd:boolean">true</v800> </ns1:Initialize> </ns2:Body> </SOAP-ENV:Envelope>
When I try to use the Initialize method of the WSDL file.
So what should be happening is that it uses SOAP-ENV:Body, but it's using ns2:Body instead, which is making the server not recognise the commands. I also don't understand why I have ns0 through ns3, is this something to do with the importdoctor?
-Remy
On 30 November 2011 17:09, Veres-Szentkiralyi Andras vsza@vsza.hu wrote:
Hi, it'd help us to understand the issue, if you'd capture the network traffic with a tool like Wireshark or tcpdump, and post it to the mailing list with any sensitive information (including the base64-encoded credentials in the Authorization HTTP header) removed.
Regards, András Veres-Szentkirályi
- november 30. szerda 15:40:44 dátummal Remy de Boer ezt írta:
Hi,
I'm trying to connect to the SOAP interface of an innovaphone system. I'm using the following code to connect to the WSDL file:
from suds.client import Client
from suds.xsd.doctor import ImportDoctor, Import from suds.transport.http import HttpAuthenticated
imp = Import('http://schemas.xmlsoap.org/soap/encoding/') imp.filter.add('http://innovaphone.com/pbx') imp.filter.add('http://innovaphone.com/binding')
d = ImportDoctor(imp) url = 'http://localhost/pbx800.wsdl' t = HttpAuthenticated(username='****', password='****')
client = Client(url, transport=t, doctor=d)
print client print client.service.Version()
The WSDL file I'm using is the same as at: http://www.innovaphone.com/wsdl/pbx800.wsdl
With the 5th to last line (soap:address location) edited to point to our PBX server.
running the above script results in the following error: File "sudstest.py", line 16, in <module>
print client.service.Version()
File
"/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/client.py", line 542, in __call__
return client.invoke(args, kwargs)
File
"/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/client.py", line 602, in invoke
result = self.send(soapenv)
File
"/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/client.py", line 643, in send
result = self.succeeded(binding, reply.message)
File
"/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/client.py", line 678, in succeeded
reply, result = binding.get_reply(self.method, reply)
File
"/usr/lib/python2.6/site-packages/suds-0.4-py2.6.egg/suds/bindings/bindin
g.py", line 149, in get_reply
soapenv.promotePrefixes()
AttributeError: 'NoneType' object has no attribute 'promotePrefixes'
When I quote out the "print client.service.Version()" line, it displays
all
the methods from the WSDL file, but when I leave it uncommented, the
client" line doesn't get printed before the error comes up.
Any idea what's causing this error?
I'm using python version 2.6.6 and suds version 0.4
Thanks in advance!
-Remy