Service Operations Insight

  • 1.  Monitor Service status through web services

    Posted Apr 25, 2013 02:41 PM
    HI,

    has anyone a working example of how to retrieve the status of a SOI service through calls to the SOAP interface?

    As far as I can see, the Universal connector web services interface does not allow this kind of interaction
    But the description of the 'real' WebServices interface frightens me a bit, I cant really see where to start there

    Hence the question, has anyone done this already and can show me how to do it?

    Many Thanks
    Jan


  • 2.  RE: Monitor Service status through web services

    Posted May 17, 2013 10:21 AM
    Hello Community:

    Any assistance here for Jan?

    Thanks,
    Mary


  • 3.  RE: Monitor Service status through web services
    Best Answer

    Posted May 17, 2013 12:48 PM
      |   view attached
    Hi Jan,

    Attached is an example Eclipse project that reads this from Java. I extracted this piece of code mainly directly from SOI, so it might be a bit complex, using Tuscany Service Data Objects, but I hope that helps.

    To run that, change in WSManClient.java the wsmanUrl string and userName and password strings. Then run the WSExampleMain class, it should print out all the top level services with their statuses, and also to show something else it takes the first service and reads all the relationships within that service.


    Pavel

    Attachment(s)

    zip
    SOIWSExample.zip   3.79 MB 1 version


  • 4.  RE: Monitor Service status through web services

    Posted May 28, 2013 06:31 AM
    Hi Pavel,

    thanks a lot, I will test this as soon as possible and share my experience

    Regards
    Jan


  • 5.  RE: Monitor Service status through web services

    Posted Aug 21, 2013 05:39 AM
    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>


  • 6.  RE: Monitor Service status through web services

    Posted Aug 21, 2013 07:43 AM
    Look forward to SOI 3.2! REST service will be there :) Using Atom+XML as an output format.

    Get paged list of services, using a text filter if needed:
    GET https://czpr-cat-devel2:7403/rest/service?start=15&size=5

    It will return links to the individual services, so you will be able to follow e.g. to
    GET https://cpr-devel:7403/rest/service/4503599627370531/status

    And get (snippet):
    <entry>
    <title>A0ComplexTree0</title>
    <link rel="entry" href="http://cpr-devel:7070/rest/service/4503599627370531/entry" title="entry" />
    <author>
    <name>CA SOI</name>
    </author>
    <id>http://cpr-devel:7070/rest/service/4503599627370531/entry</id>
    <published>2011-10-03T09:55:58Z</published>
    <content type="application/xml">
    <ServiceStatus xmlns="">
    <statuses>
    <status name="subservicesCount">
    <value>5</value>
    </status>
    <status name="Availability">
    <value>0</value>
    </status>
    <status name="Risk">
    <value>4</value>
    </status>
    ....