Last active
January 13, 2018 14:12
-
-
Save ChendrayanV/75f569e3381ce1561f8238b8770c471f to your computer and use it in GitHub Desktop.
A sample code to query HPSM9 incident using python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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