<div dir="ltr">Un saluto a tutti.<div style>sto cercando di accedere ad un webservice tramite un client soap.</div><div style>Sono assolutamente digiuno del protocollo e facendo delle prove sono arrivato a questo...</div><div style>
Per verificare le funzionalitą del webservice ho installato soapUI e riesco a richiamare il metodo "dir" che compone la richesta</div><div style>soap come riportato in coda...</div><div style>Ad occhio noto che nella richiesta emessa dal mio script ho:</div>
<div style><br></div><div style>SOAP-ENV:Envelope<br></div><div style><div>xmlns:ns1</div><div>ns1:Body<br></div><div>ns0:dir</div><div><br></div><div style>mentre in quella di soapUI ho:</div><div style><br></div><div style>
soapenv:Envelope</div><div style>xmlns:web<br></div><div style><div>soapenv:Body</div><div>web:dir</div><div><br></div></div><div style>avete idea di come risolvere?</div><div style><br></div><div style>Vi seguo con passione anche se scrivo poco,</div>
<div style>grazie a tutti ;-))</div><div style><br></div><div style><br></div><div style># INIZIO SCRIPT</div></div><div style><div><i><font face="courier new, monospace">#!/usr/bin/python</font></i></div><div><i><font face="courier new, monospace"><br>
</font></i></div><div><i><font face="courier new, monospace">from suds.client import Client</font></i></div><div><i><font face="courier new, monospace">import logging, sys</font></i></div><div><i><font face="courier new, monospace"><br>
</font></i></div><div><i><font face="courier new, monospace">class OutgoingFilter(logging.Filter):</font></i></div><div><i><font face="courier new, monospace"> def filter(self, record):</font></i></div><div><i><font face="courier new, monospace"> return record.msg.startswith('sending:')</font></i></div>
<div><i><font face="courier new, monospace"><br></font></i></div><div><i><font face="courier new, monospace"><br></font></i></div><div><i><font face="courier new, monospace">if __name__ == '__main__':</font></i></div>
<div><i><font face="courier new, monospace"><br></font></i></div><div><i><font face="courier new, monospace"> handler = logging.StreamHandler(sys.stderr)</font></i></div><div><i><font face="courier new, monospace"> handler.addFilter(OutgoingFilter())</font></i></div>
<div><i><font face="courier new, monospace"> logger = logging.getLogger('suds.transport.http')</font></i></div><div><i><font face="courier new, monospace"> logger.setLevel(logging.DEBUG)</font></i></div><div><i><font face="courier new, monospace"> handler.setLevel(logging.DEBUG)</font></i></div>
<div><i><font face="courier new, monospace"> logger.addHandler(handler)</font></i></div><div><i><font face="courier new, monospace"><br></font></i></div><div><i><font face="courier new, monospace"> username = 'username' # ovviamente ho messo dati validi</font></i></div>
<div><i><font face="courier new, monospace"> password = 'password'</font></i></div><div><i><font face="courier new, monospace"> </font></i></div><div><i><font face="courier new, monospace"> wsdl_url = 'file:///home/aabate/Documenti/PROGR/webDAA/TelematicoFtp.wsdl'</font></i></div>
<div><i><font face="courier new, monospace"> soap_url = '<a href="https://ws-telematico.agenziadogane.it/TelematicoFtpEjbHttpRouter/TelematicoFtpWsBindingImplService">https://ws-telematico.agenziadogane.it/TelematicoFtpEjbHttpRouter/TelematicoFtpWsBindingImplService</a>'</font></i></div>
<div><i><font face="courier new, monospace"><br></font></i></div><div><i><font face="courier new, monospace"> client = Client(wsdl_url,location=soap_url, username=username, password=password)</font></i></div><div><i><font face="courier new, monospace"> print client</font></i></div>
<div><i><font face="courier new, monospace"><br></font></i></div><div><i><font face="courier new, monospace"> res = client.service.dir('?')</font></i></div><div><i><font face="courier new, monospace"> print res</font></i></div>
<div><br></div><div># FINE SCRIPT<br></div><div><br></div><div><br></div><div># INIZIO RISPOSTA<br></div><div style>riporto la risposta dello script...</div><div style><br></div><div>Suds ( <a href="https://fedorahosted.org/suds/">https://fedorahosted.org/suds/</a> ) version: 0.4.1 (beta) build: R703-20101015</div>
<div><br></div><div>Service ( TelematicoFtpWsBindingImplService ) tns="<a href="http://webservices.ftp.telematico.dogana.dogane.ag_dogane.finanze.it">http://webservices.ftp.telematico.dogana.dogane.ag_dogane.finanze.it</a>"</div>
<div> Prefixes (0)</div><div> Ports (1):</div><div> (TelematicoFtpWsBindingImpl)</div><div> Methods (6):</div><div> dir(xs:string pattern, )</div><div> get(xs:string fileName, )</div>
<div> getlog()</div><div> ls(xs:string pattern, )</div><div> mget(xs:string mGetInput_Nome, xs:string mGetInput_Prog, )</div><div> put(xs:base64Binary fileMsg_Content, xs:string fileMsg_Nome, )</div>
<div> Types (0):</div><div><br></div><div><br></div><div>sending:</div><div>URL:<a href="https://ws-telematico.agenziadogane.it/TelematicoFtpEjbHttpRouter/TelematicoFtpWsBindingImplService">https://ws-telematico.agenziadogane.it/TelematicoFtpEjbHttpRouter/TelematicoFtpWsBindingImplService</a></div>
<div>HEADERS: {'SOAPAction': '"dir"', 'Content-Type': 'text/xml; charset=utf-8', 'Content-type': 'text/xml; charset=utf-8', 'Soapaction': '"dir"'}</div>
<div>MESSAGE:</div><div><?xml version="1.0" encoding="UTF-8"?></div><div><SOAP-ENV:Envelope xmlns:ns0="<a href="http://webservices.ftp.telematico.dogana.dogane.ag_dogane.finanze.it">http://webservices.ftp.telematico.dogana.dogane.ag_dogane.finanze.it</a>" xmlns:ns1="<a href="http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.org/soap/envelope/</a>" xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>" xmlns:SOAP-ENV="<a href="http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.org/soap/envelope/</a>"></div>
<div><SOAP-ENV:Header/></div><div><ns1:Body></div><div> <ns0:dir><pattern>?</pattern></ns0:dir></div><div></ns1:Body></div><div></SOAP-ENV:Envelope></div><div><br></div><div>
Traceback (most recent call last):</div><div> File "webdaa.py", line 32, in <module></div><div> res = client.service.dir('?')</div><div> File "/usr/lib/python2.7/dist-packages/suds/client.py", line 542, in __call__</div>
<div> return client.invoke(args, kwargs)</div><div> File "/usr/lib/python2.7/dist-packages/suds/client.py", line 602, in invoke</div><div> result = self.send(soapenv)</div><div> File "/usr/lib/python2.7/dist-packages/suds/client.py", line 647, in send</div>
<div> result = self.succeeded(binding, reply.message)</div><div> File "/usr/lib/python2.7/dist-packages/suds/client.py", line 684, in succeeded</div><div> reply, result = binding.get_reply(self.method, reply)</div>
<div> File "/usr/lib/python2.7/dist-packages/suds/bindings/binding.py", line 145, in get_reply</div><div> replyroot = sax.parse(string=reply)</div><div> File "/usr/lib/python2.7/dist-packages/suds/sax/parser.py", line 136, in parse</div>
<div> sax.parse(source)</div><div> File "/usr/lib/python2.7/xml/sax/expatreader.py", line 107, in parse</div><div> xmlreader.IncrementalParser.parse(self, source)</div><div> File "/usr/lib/python2.7/xml/sax/xmlreader.py", line 123, in parse</div>
<div> self.feed(buffer)</div><div> File "/usr/lib/python2.7/xml/sax/expatreader.py", line 211, in feed</div><div> self._err_handler.fatalError(exc)</div><div> File "/usr/lib/python2.7/xml/sax/handler.py", line 38, in fatalError</div>
<div> raise exception</div><div>xml.sax._exceptions.SAXParseException: <unknown>:1:0: syntax error</div><div><br></div><div><br></div><div># FINE RISPOSTA<br></div><div><br></div><div># richiesta methodo "dir" con soapUI</div>
<div><br></div><div><soapenv:Envelope xmlns:soapenv="<a href="http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.org/soap/envelope/</a>" xmlns:web="<a href="http://webservices.ftp.telematico.dogana.dogane.ag_dogane.finanze.it">http://webservices.ftp.telematico.dogana.dogane.ag_dogane.finanze.it</a>"></div>
<div> <soapenv:Header/></div><div> <soapenv:Body></div><div> <web:dir></div><div> <pattern>?</pattern></div><div> </web:dir></div><div> </soapenv:Body></div>
<div></soapenv:Envelope></div></div></div>