How to retrieve all the Change from HP Service Manager using ChangeManagement wsdl

HI,

I am using ChangeManagement.wsdl and my requirement is to fetch all the records for change available in the HP service Manager. What is the query i have to use to fetch the records using the WSDL. 

Appreciate if the query for problem and interaction is also mentioned here.

 

Thanks,

Pradeep.

  • Verified Answer

    Hi,

    First of all, if you are using 9.4x or 9.3x latest version, you can use the restful API which is easier to consume.

    To your question, you can communicate with HPE SM with any language you like. Following example is based on command line, so that you can see what's the request and what's the response.

    To get the change records, you need to

    1. get the change ID list.

    2. get the change detail based on change ID. (By using SOAP, you need to use the session persist to save the system resource and get better performance)

    1. get the change ID list.

    you can get the change ID list by running following command, in my example, I'm getting all the changes which impact=3:

    curl -XPOST -H "Content-Type: text/xml;charset=UTF-8" -H "SOAPAction: "RetrieveKeysList"" -H "Authorization: Basic ZmFsY29uOjE=" -d "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ns='http://schemas.hp.com/SM/7' xmlns:com='http://schemas.hp.com/SM/7/Common' xmlns:xm='http://www.w3.org/2005/05/xmlmime'> <soapenv:Header/> <soapenv:Body> <ns:RetrieveChangeKeysListRequest ignoreEmptyElements='true'> <ns:model> <ns:keys> </ns:keys> <ns:instance> <Impact>3</Impact> </ns:instance> </ns:model> </ns:RetrieveChangeKeysListRequest> </soapenv:Body> </soapenv:Envelope>" -i "">http://localhost:13941/SM/7/"

    Regarding the http header Authorization, you need to convert your username:password to base64 by using base64 encoder online. In my example, "ZmFsY29uOjE=" is "falcon:1".

    the system will response like below:

    Server: Apache-Coyote/1.1
    Set-Cookie: JSESSIONID=448ABBE186A04ED2A4AB6CC17BCB274A; Path=/SM/; HttpOnly
    Keep-Alive: timeout=1200000, max=1000
    Connection: Keep-Alive
    Content-Type: text/xml;charset=utf-8
    Content-Length: 1083
    Date: Sat, 07 May 2016 08:54:57 GMT

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><RetrieveChangeKeysListResponse message="Success" query="" returnCode="0" schemaRevisionDate="2014-12-07" schemaRevisionLevel="6" status="SUCCESS" xmlns="http://schemas.hp.com/SM/7" xmlns:cmn="http://schemas.hp.com/SM/7/Common" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.hp.com/SM/7 /Change.xsd"><keys><ChangeID type="String">C10001</ChangeID></keys><keys><ChangeID type="String">C10007</ChangeID></keys><keys><ChangeID type="String">C10009</ChangeID></keys><keys><ChangeID type="String">C10023</ChangeID></keys><keys><ChangeID type="String">C10024</ChangeID></keys><keys><ChangeID type="String">C10028</ChangeID></keys><keys><ChangeID type="String">C10030</ChangeID></keys><keys><ChangeID type="String">C10036</ChangeID></keys><keys><ChangeID type="String">C10037</ChangeID></keys></RetrieveChangeKeysListResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

    2. get the change detail based on change ID. (By using SOAP, you need to use the session persist to save the system resource and get better performance)

    curl -XPOST -H "Content-Type: text/xml;charset=UTF-8" -H "SOAPAction: "Retrieve"" -H "Authorization: Basic ZmFsY29uOjE=" -H "cookie: JSESSIONID=448ABBE186A04ED2A4AB6CC17BCB274A; Path=/SM/;" -d "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ns='http://schemas.hp.com/SM/7' xmlns:com='http://schemas.hp.com/SM/7/Common' xmlns:xm='http://www.w3.org/2005/05/xmlmime'> <soapenv:Header/> <soapenv:Body> <ns:RetrieveChangeRequest attachmentData='false' attachmentInfo='false' ignoreEmptyElements='true'> <ns:model> <ns:keys query='number=&quot;C10001&quot;'/> </ns:model> <ns:instance /> </ns:RetrieveChangeRequest> </soapenv:Body> </soapenv:Envelope>" -i "">http://localhost:13941/SM/7/"

    The system will response like below:

    Server: Apache-Coyote/1.1
    Keep-Alive: timeout=1200000, max=1000
    Connection: Keep-Alive
    Content-Type: text/xml;charset=utf-8
    Content-Length: 4692
    Date: Sat, 07 May 2016 09:05:55 GMT
    <?xml version="1.0"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><RetrieveChangeResponse message="Success" returnCode="0" schemaRevisionDate="2014-12-07" schemaRevisionLevel="6" status="SUCCESS" xmlns="http://schemas.hp.com/SM/7" xmlns:cmn="http://schemas.hp.com/SM/7/Common" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.hp.com/SM/7 /Change.xsd"><model><keys><ChangeID type="String">C10001</ChangeID></keys><instance recordid="C10001 - Take Data Base Backup" uniquequery="header,number=&quot;C10001&quot;">...</instance></model></RetrieveChangeResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

     

    For more details you may also read following topic:

    http://community.hpe.com/t5/Service-Manager-Service-Center/Curl-command-for-HPSM-webservices/td-p/6852377

    http://community.hpe.com/t5/Service-Manager-Service-Center/Service-manager-9-32-rest-api/td-p/6857080

    I described the restful & SOAP request by command lines, you can view the request and response easily.

    And also you can take a look at https://www.youtube.com/watch?v=-GGZo5KPlIo, and web service guide:

    https://softwaresupport.hpe.com/km/KM01824642

    Hope it helps,

    Ling-Yan