Guest User

Untitled

a guest
Nov 18th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. class SoapRequestor(object):
  2.  
  3. def request(self, method_name, *args, **kwargs):
  4. try:
  5. request = SoapRequest(
  6. method_name=method_name,
  7. args=args,
  8. kwargs=kwargs
  9. )
  10. self.logger.info("Starting request to method `%s`", method_name)
  11. self.logger.debug(request)
  12. result, envelope_sent, envelope_received = self.soap_client.request(
  13. method_name,
  14. *args,
  15. **kwargs)
  16. except SoapServerException:
  17. self.logger.exception("SOAP server exception on method `%s`", method_name)
  18. raise
  19. except Exception:
  20. self.logger.exception(
  21. "SOAP request method `%s` failed with unexpected exception", method_name)
  22. raise
  23. else:
  24. response = SoapResponse(
  25. result=result,
  26. request=request,
  27. envelope_sent=envelope_sent,
  28. envelope_received=envelope_received
  29. )
  30. self.logger.info("Successful request to method `%s`", method_name)
  31. self.logger.debug(response)
  32. return response
Add Comment
Please, Sign In to add comment