Service Operations Insight

 View Only
  • 1.  How to use WS-Enumerate XPath in filter dialect to search Entities

    Posted Jun 26, 2014 04:37 PM

    Hi all!

    I'm trying to get a list of Entities/CIs using WS-MAN Webservice but the only way I'm able to do it is using the filter //*, that brings me all CIs.

    Anyone here knows how can I create a XPath filter to select only a piece of information from CIs?

    Actually I have knowledge about XPath convention but I don't know the "XML structure" of data stored in SOI so I don't know how do build the XPath query i.e.: Entity/ComputerSystem[starts-with(item-name,'app')]

     

    Follow the XML I'm using:

    <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/Enumerate</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:3e75e154-e0be-4468-b340-f935d21caaa4</wsa:MessageID>
            <wsa:To env:mustUnderstand="true" xmlns:ns13="http://ns.ca.com/2009/01/usm-data">http://app1casoism1p.sicredi.net:7090/sam/webservice</wsa:To>
            <wsman:ResourceURI xmlns:ns13="http://ns.ca.com/2009/01/usm-data">http://ns.ca.com/2009/07/usm-core/Entity</wsman:ResourceURI>
            <wsman:RequestTotalItemsCountEstimate xmlns:ns13="http://ns.ca.com/2009/01/usm-data"/>
        </env:Header>
        <env:Body>
            <wsen:Enumerate xmlns:ns13="http://ns.ca.com/2009/01/usm-data">
                <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>
    
    

     

    Thanks for your help!!

     

    Rodrigo Werle



  • 2.  Re: How to use WS-Enumerate XPath in filter dialect to search Entities

    Posted Jul 15, 2014 09:27 PM

    After opening a case at CA' support I got the answer I was looking for. The resource URI must be http://ns.ca.com/2009/01/usm-data/BaseCI.

     

    The working xml is this:

     

    <s:Envelope
          xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"
          xmlns:s="http://www.w3.org/2003/05/soap-envelope"
          xmlns:n="http://schemas.xmlsoap.org/ws/2004/09/enumeration"
          xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing">
      <s:Header>
        <a:To>http://app1casoism1p.sicredi.net:7090/sam/webservice</a:To>
        <w:ResourceURI s:mustUnderstand="true">http://ns.ca.com/2009/01/usm-data/BaseCI</w:ResourceURI>
        <a:ReplyTo>
          <a:Address s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
        </a:ReplyTo>
        <a:Action s:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action>
        <a:MessageID>uuid:207BB4D6-0C82-11E4-8390-4B3D9C9BB6A5</a:MessageID>
      </s:Header>
      <s:Body>
        <n:Enumerate xmlns:ns13="http://ns.ca.com/2009/01/usm-data">
          <w:OptimizeEnumeration/>
          <w:MaxElements>10000</w:MaxElements>
          <w:EnumerationMode>EnumerateObjectAndEPR</w:EnumerationMode>
          <w:Filter Dialect="http://www.w3.org/TR/1999/REC-xpath-19991116">/ns13:BaseCI[starts-with(ns13:item_label,'app1server')]</w:Filter>
        </n:Enumerate>
      </s:Body>
    </s:Envelope>
    

     

    Thanks.