How-to enter wildcards into a SOAP query for Service Manager

Hello.

I have no idea to use a wildcard to retrieve a list of CIs from the Service Manager SOAP API while it works with an exact name.

Example of an SOAP request:

<soapenv:Envelope xmlns:soapenv="">schemas.xmlsoap.org/.../" xmlns:pws="">servicecenter.peregrine.com/PWS">
   <soapenv:Header/>
   <soapenv:Body>
      <pws:RetrieveCfgItemListRequest attachmentInfo="false" attachmentData="false" ignoreEmptyElements="true" updatecounter="" handle="" count="" start="" attachmentType="">
         <!--1 or more repetitions:-->
         <pws:keys query="" updatecounter="">
            <!--Optional:-->
            <pws:Schluesselfeld type="String" mandatory="" readonly="">SYSTEMA</pws:Schluesselfeld>
         </pws:keys>
      </pws:RetrieveCfgItemListRequest>
   </soapenv:Body>
</soapenv:Envelope>

This works fine gives me the CI with the name "SYSTEMA" and it's attributes as response.

But I want to select all systems with e.g. the pattern "SYS" in their names. I tried several wildcard characters like % or * but none works.

Do you have a hint for me?

Many thanks.

Cheers

  Sascha

 

  • Verified Answer

    This should be pretty easy to help with.  REST allows you to use the more user-friendly labels, but with SOAP, you do have to know the underlying field name and some of the basic Service Manager query syntax

    In your SOAP request, instead of passing in data in the specific field/tag of your XML, use the 'query' attribute in the keys tag

    So, for example, in your snippet below:

    <pws:keys query='logical.name#"SYSTEMA"'>

    That will give you all the CIs whose logical.name attribute starts-with SYSTEMA

    You can use regular wildcard expressions there as well, just like you can in Service Manager.  For example, to search where the logical.name attribute contains the word SYSTEM, your query would look like

    <pws:keys query='logical.name#"*SYSTEM*"'>

    (I'm using single quotes around the query expression, but you could also use a double quote and xml encoding like:

    <pws:keys query="logical.name#&quot;*SYSTEM*&quot;">

     

  • Works like a charm - many thanks. :-)

    I used the following query (unfortunately the REST API is not available so I have to live with SOAP) was successful:

    <soapenv:Envelope xmlns:soapenv="">schemas.xmlsoap.org/.../" xmlns:pws="">servicecenter.peregrine.com/PWS">
       <soapenv:Header/>
       <soapenv:Body>
          <pws:RetrieveCfgItemListRequest attachmentInfo="false" attachmentData="false" ignoreEmptyElements="true" updatecounter="" handle="" count="" start="" attachmentType="">
             <!--1 or more repetitions:-->
             <pws:keys query='logical.name#"M99*"' updatecounter="" />
          </pws:RetrieveCfgItemListRequest>
       </soapenv:Body>
    </soapenv:Envelope>

     

    Do you know in which document I could find the attributes for wich I could perform a query?