Here's a follow up to my question on how to monitor a service's status through web-service requests
Summary is, it works, but it could be easier. A simple REST API from CA would be highly appreciated
First, I checked Pavels suggestion and it worked
However, I did not understand what was happening behind the scenes. I needed a solution for a customer where I knew what was going on and could change things. Also, it needed to be in python
I then tried web-service request with a tool called SOAP-UI, for which there is a 'project' file available from CA which makes it work with SOI
This worked and it helped me to better understand the information exchange between a SOAP client and SOI
The tool also shows the XML files that it exchanges with SOI
I then used these XML files to send them from within my python script.
This now works for me, although I still do not understand all details
More for those who need to do it themselves:
To retrieve a services status, you have to send 2 request:
- The first, enumerate request, instructs SOI to create the required information internally. It responds with an ID called 'EnumerationContext'
- A second, pull request, then retrieves this information from SOI by submitting the EnumerationContext retrieved in step1
You send those XML via a HTTP POST request to
http://yourSOIserver:7090/sam/webservice
You must set headers for this to work: [font=Courier New]Content-Type=application/soap+xml;charset=UTF-8;action="http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate"[font]
This is the XML content of the enumerate request
<env:Envelope
xmlns:env="http://www.w3.org/2003/05/soap-envelope"
xmlns:mdo="http://schemas.wiseman.dev.java.net/metadata/messagetypes"
xmlns:mex="http://schemas.xmlsoap.org/ws/2004/09/mex"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing"
xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration"
xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"
xmlns:wsmeta="http://schemas.dmtf.org/wbem/wsman/1/wsman/version1.0.0.a/default-addressing-model.xsd"
xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<env:Header><wsa:Action xmlns:ns13="http://ns.ca.com/2009/07/usm-core" env:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</wsa:Action><wsa:ReplyTo xmlns:ns13="http://ns.ca.com/2009/07/usm-core"><wsa:Address env:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address></wsa:ReplyTo><wsa:MessageID xmlns:ns13="http://ns.ca.com/2009/07/usm-core" env:mustUnderstand="true">uuid:c189ea6b-b07f-48c4-8060-819c1dd2da12</wsa:MessageID><wsa:To xmlns:ns13="http://ns.ca.com/2009/07/usm-core" env:mustUnderstand="true">http://localhost:7090/sam/webservice</wsa:To><wsman:ResourceURI xmlns:ns13="http://ns.ca.com/2009/07/usm-core">http://ns.ca.com/2009/07/usm-core/Entity</wsman:ResourceURI><wsman:SelectorSet xmlns:ns13="http://ns.ca.com/2009/07/usm-core"><wsman:Selector Name="className">Service</wsman:Selector></wsman:SelectorSet><wsman:RequestTotalItemsCountEstimate xmlns:ns13="http://ns.ca.com/2009/07/usm-core"/></env:Header>
<env:Body>
<wsen:Enumerate xmlns:ns13="http://ns.ca.com/2009/07/usm-core">
<wsman:Filter Dialect="http://www.w3.org/TR/1999/REC-xpath-19991116">//*</wsman:Filter>
<wsman:EnumerationMode>EnumerateObjectAndEPR</wsman:EnumerationMode>
</wsen:Enumerate>
</env:Body>
</env:Envelope>
This is the XML for the pull request
Note the place (line 5) to insert the correct EnumerationContext
You also may want to change the MaxElements field
<env:Envelope
xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:mdo="http://schemas.wiseman.dev.java.net/metadata/messagetypes" xmlns:mex="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:wsmeta="http://schemas.dmtf.org/wbem/wsman/1/wsman/version1.0.0.a/default-addressing-model.xsd" xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <env:Header><wsa:Action env:mustUnderstand="true" xmlns:ns13="http://ns.ca.com/2009/01/usm-data">http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</wsa:Action><wsa:ReplyTo xmlns:ns13="http://ns.ca.com/2009/01/usm-data"><wsa:Address env:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address></wsa:ReplyTo><wsa:MessageID env:mustUnderstand="true" xmlns:ns13="http://ns.ca.com/2009/01/usm-data">uuid:a91f2f15-82dd-4407-b1d0-4e5f944a4f76</wsa:MessageID><wsa:To env:mustUnderstand="true" xmlns:ns13="http://ns.ca.com/2009/01/usm-data">http://localhost:7090/sam/webservice</wsa:To><wsman:ResourceURI xmlns:ns13="http://ns.ca.com/2009/01/usm-data">http://ns.ca.com/2009/01/usm-data/InfrastructureService</wsman:ResourceURI><wsman:OperationTimeout xmlns:ns13="http://ns.ca.com/2009/01/usm-data">P0Y0M0DT0H0M30.000S</wsman:OperationTimeout></env:Header>
<env:Body>
<wsen:Pull xmlns:ns13="http://ns.ca.com/2009/01/usm-data">
<!-- <wsen:EnumerationContext> this must be replaced </wsen:EnumerationContext> -->
<wsen:MaxTime>P0Y0M0DT0H0M30.000S</wsen:MaxTime>
<wsen:MaxElements>100</wsen:MaxElements>
</wsen:Pull>
</env:Body>
</env:Envelope>
The response will then contain info about all services, among it their health:
<ns12:Label>Customer Service MyCompany</ns12:Label>
<ns12:ServiceName>customer service</ns12:ServiceName>
<ssa_severity>2</ssa_severity>
<ssa_risk>12</ssa_risk>
<ssa_health>0</ssa_health>