Bluebird75 Bluebird75 - 2 months ago 37
Python Question

SOAP 1.2 python client

I am looking for a python SOAP 1.2 client but it seems that it does not exist . All of the existing clients are either not maintainted or only compatible with SOAP 1.1:


  • suds

  • SOAPpy

  • ZSI


Answer

The zeep library supports both SOAP 1.1 and 1.2 as long as the service's WSDL properly indicates it.

WSF/Python is supporting SOAP 1.2.

INTRODUCTION

WSF/Python is the Python language extension to WSO2 WSF/C [http://www.wso2.org/projects/wsf/c]. This version enables you to consume/provide Web Services both with REST and SOAP.

  • Support for REST
  • Support for SOAP 1.1
  • Support for SOAP 1.2

For downloading, you don't have to register. Just click "submit" at the very bottom.

Samples can be found within the downloaded archive, eg:

LOG_DIR = '/tmp/'
LOG_LEVEL = 4
WSFC_HOME = '/opt/wso2/wsf_c'
END_POINT = 'http://localhost:9090/axis2/services/echo/echoString'

if __name__ == '__main__':
    message = """
    <ns1:echoString xmlns:ns1="http://ws.apache.org/axis2/services/echo">
        <text>Hello World!</text>
    </ns1:echoString>
    """
    try:
        client = wso2.wsf.WSClient({
            'to':END_POINT,
            'WSF_LOG_DIR':LOG_DIR,
            'WSF_LOG_LEVEL':LOG_LEVEL,
            'WSFC_HOME':WSFC_HOME,
            })

        print 'Sending: ' + message

        response = client.request(message)

        if response is not None:
            print 'Respose: ' + response + '\n'
        else:
            print 'Error occurred!'
    except wso2.wsf.WSFault, e:
        print 'Exception occurred:'
        print e