SOAP

Invoking a SOAP service

  • Use Dashboard to create an outgoing connection to a SOAP server.
  • Note that the client object is based on Suds and offers everything Suds does.
  • In the usage example below, we take the WSDL from here to find details of a bank by its code

Dashboard

Python code

# -*- coding: utf-8 -*-

# Zato
from zato.server.service import Service

class MyService(Service):
   """ Obtains BLZ bank details for input bank code.
   More about BLZ on Wikipedia - https://en.wikipedia.org/wiki/Bankleitzahl.
   """
   def handle(self):

         with self.outgoing.soap.get('BLZ').conn.client() as client:

            # Prepare input data
            bank_code = '12070000'

            # Only pure-Python objects are used to invoke a remote service
            output = client.service.getBank(bank_code)

            # Log response received
            self.logger.info('BIC `%s`', output.bic)
            self.logger.info('Name `%s`', output.bezeichnung)

In server.log:

INFO - BIC `DEUTDEBB160`
INFO - Name `Deutsche Bank Ld Brandenburg`