Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def makeSoapCall(self, action, service='incident.do?WSDL', session_id=None, **kwargs):
- url = self.url + '/' + service
- log.debug('Posting to URL: %s', url)
- logging.getLogger('suds.client').setLevel(logging.DEBUG)
- # 1. Connect to the base SOAP_PATH
- client = Client(url, username=self.soapUsername,
- password=self.soapPassword)
- try:
- method = getattr(client.service, action, None)
- if method:
- response = method(**kwargs)
- else:
- log.error("Unable to bind SOAP method %s for service %s",
- action, service)
- raise ServiceNowConnectionFailure
- except Exception, e:
- log.error("SOAP Error! %s", e)
- raise ServiceNowConnectionFailure
- log.debug("Received SOAP response: %s\n%s", url, response)
- return response
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement