Skip to content

Instantly share code, notes, and snippets.

@ChendrayanV
Last active January 13, 2018 14:12
Show Gist options
  • Save ChendrayanV/75f569e3381ce1561f8238b8770c471f to your computer and use it in GitHub Desktop.
Save ChendrayanV/75f569e3381ce1561f8238b8770c471f to your computer and use it in GitHub Desktop.
A sample code to query HPSM9 incident using python
from zeep import Client
from zeep.transports import Transport
from requests import Session
from requests.auth import HTTPBasicAuth
session = Session()
session.auth = HTTPBasicAuth('userName' , 'password')
wsdl = "http://hostname:xxxx/sc62server/PWS/IncidentManagement.wsdl"
client = Client(wsdl=wsdl,transport=Transport(session=session))
factory = client.type_factory('ns0')
type_String = client.get_type('ns1:StringType')
incidentID = type_String("IM123456", type="String")
IncidentKeysType = factory.IncidentKeysType(IncidentID=incidentID)
IncidentInstanceType = factory.IncidentInstanceType(IncidentID=incidentID)
IncidentModelType = factory.IncidentModelType(keys=IncidentKeysType,instance=IncidentInstanceType)
RetrieveIncidentRequest = client.get_element('ns0:RetrieveIncidentRequest')
result = RetrieveIncidentRequest(model=IncidentModelType)
serviceResult = client.service.RetrieveIncident(model=IncidentModelType)
print(serviceResult)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment