Highlighted
SaschaS Valued Contributor.
Valued Contributor.
1364 views

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

Jump to solution

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="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pws="http://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

 

0 Likes
1 Solution

Accepted Solutions
Acclaimed Contributor.. Jacob Heubner Acclaimed Contributor..
Acclaimed Contributor..

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

Jump to solution

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;">

 

2 Replies
Acclaimed Contributor.. Jacob Heubner Acclaimed Contributor..
Acclaimed Contributor..

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

Jump to solution

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;">

 

SaschaS Valued Contributor.
Valued Contributor.

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

Jump to solution

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="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pws="http://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?

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.