Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. def makeSoapCall(self, action, service='incident.do?WSDL', session_id=None, **kwargs):
  2. url = self.url + '/' + service
  3. log.debug('Posting to URL: %s', url)
  4.  
  5. logging.getLogger('suds.client').setLevel(logging.DEBUG)
  6. # 1. Connect to the base SOAP_PATH
  7. client = Client(url, username=self.soapUsername,
  8. password=self.soapPassword)
  9. try:
  10. method = getattr(client.service, action, None)
  11. if method:
  12. response = method(**kwargs)
  13. else:
  14. log.error("Unable to bind SOAP method %s for service %s",
  15. action, service)
  16. raise ServiceNowConnectionFailure
  17. except Exception, e:
  18. log.error("SOAP Error! %s", e)
  19. raise ServiceNowConnectionFailure
  20.  
  21. log.debug("Received SOAP response: %s\n%s", url, response)
  22. return response
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement