Custom SOAP service response

99 views
Skip to first unread message

Nicola Gramola

unread,
Nov 9, 2017, 6:00:15 AM11/9/17
to web2py-users
Hello.

I have made a SOAP service using service decorator like this:

@service.soap('fileSdIConMetadati', returns={'Esito': str}, args={'IdentificativoSdI': int, 'NomeFile': str, 'File': str, 'NomeFileMetadati': str, 'Metadati': str})
def ricevi_fatture(IdentificativoSdI, NomeFile, File, NomeFileMetadati, Metadati):
    ...
    return "ER01"

but the soap client want this response:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
                <soapenv:Body>
                               <ns2:rispostaRiceviFatture xmlns:ns2="http://www.fatturapa.gov.it/sdi/ws/ricezione/v1.0/types">
                                               <Esito>ER01</Esito>
                               </ns2:rispostaRiceviFatture>
                </soapenv:Body>
</soapenv:Envelope>

I've made this decorator to change respons bat don't work fine.

def change_response(f):
    def resp(*args, **kwargs):
        ret = f(*args, **kwargs)
        return """<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
                <soapenv:Body>
                               <ns2:rispostaRiceviFatture xmlns:ns2="http://www.fatturapa.gov.it/sdi/ws/ricezione/v1.0/types">
                                               <Esito>ER01</Esito>
                               </ns2:rispostaRiceviFatture>
                </soapenv:Body>
</soapenv:Envelope>
"""

    return resp


Have any ideas?

Thanks!

--
Nicola

Dave S

unread,
Dec 7, 2017, 7:56:44 PM12/7/17
to web2py-users

Sorry you didn't get a timely answer.  For my part, I used PySimpleSoap on the server (from contrib.pysimplesoap.client import SoapClinet). The remote call in was either a normal  Java client or normal Python client.   I think the WSDL was automatically generated  by the call() wrapper, so nothing custom about its format.  My  controller functions use the standard decorator, with the name, returns, and args only.

I also have service.xmlrpc decorator and a service.json decorator, but I haven't tried accessing in those ways.

Hope you found a way around your obstacles.

Dave
/dps



Reply all
Reply to author
Forward
0 new messages