IT Process Automation

  • 1.  Parsing the returned XML from SOAP WS getListValues

    Posted May 06, 2013 05:31 PM
    Hi all, getting close to my goal of querying SD for the data I need and then I can move on to actually automating some processes! I have some experience with XPath and XML parsing however I can’t figure out and/or find anything out there on how to parse the relatively hideous return from the WS call, I am returning all attributes as an exercise. Any help would be appreciated … obviously I am befuddled by the formatting. (snippet below)

    <soapenv:Body>
    <getListValuesResponse xmlns="http://www.ca.com/UnicenterServicePlus/ServiceDesk">
    <getListValuesReturn xmlns="">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
    &lt;UDSObjectList&gt;
    &lt;UDSObject&gt;
    &lt;Handle&gt;cnt:02752626B3FA044A9F50020D97CF2F40&lt;/Handle&gt;
    &lt;Attributes&gt;
    &lt;Attribute DataType="2002"&gt;
    &lt;AttrName&gt;pgroups&lt;/AttrName&gt;
    &lt;AttrValue&gt;(0)&lt;/AttrValue&gt;
    &lt;/Attribute&gt;
    &lt;Attribute DataType="2002"&gt;
    &lt;AttrName&gt;userid&lt;/AttrName&gt;
    &lt;AttrValue&gt;donaldB&lt;/AttrValue&gt;
    &lt;/Attribute&gt; …

    Thank you!!

    David


  • 2.  RE: Parsing the returned XML from SOAP WS getListValues

    Posted May 06, 2013 06:10 PM
    Hey David,

    Which operator are you using? They all give you access to the XML response but depending on the operator there may be another way to get to the results you want.

    Thanks,
    Tom


  • 3.  RE: Parsing the returned XML from SOAP WS getListValues

    Posted May 07, 2013 12:47 PM
    Hi Tom, I am using the Web Services "Invoke SOAP" Method Operator. I am trying to ensure that I am able to query SD for whatever data I will need more or less as a POC before I move forward and start automating my first processes. I want to use WS calls to avoid the overhead of login/logouts by the out of the box Ops. If I had more time I suppose I could "roll my own" parsing hack" but there must be an appropriate method to accomplish this ........

    Thanks for the reply .. again any help is great

    --David


  • 4.  RE: Parsing the returned XML from SOAP WS getListValues
    Best Answer

    Posted May 07, 2013 03:30 PM

    davethecoder wrote:

    Hi Tom, I am using the Web Services "Invoke SOAP" Method Operator. I am trying to ensure that I am able to query SD for whatever data I will need more or less as a POC before I move forward and start automating my first processes. I want to use WS calls to avoid the overhead of login/logouts by the out of the box Ops. If I had more time I suppose I could "roll my own" parsing hack" but there must be an appropriate method to accomplish this ........

    Thanks for the reply .. again any help is great

    --David
    So I'm not exactly sure why SDM does this, but the relevant information is returned as part of a CDATA structure inside of the main XML response. And then within that CDATA, the tags are escaped.

    So here's what you need to do to get to the relevant info:
    [list]
    [*]Using the Call Results page of the Invoke Soap Method operator, extract //doSelectReturn and put it in an Operator Dataset variable (for example, innerXml). This method automatically unescapes the XML structure for you.
    [*]In the post execution, call the applyXPath function to parse the XML retrieved in the first step. For example, Process.ticketUserId = applyXPath(Process[OpName].innerXml, "//Attribute[AttrName='userid']/AttrValue/text()")
    [list]

    Let me know if this helps.

    Thanks,
    Tom


  • 5.  RE: Parsing the returned XML from SOAP WS getListValues

    Posted May 07, 2013 04:50 PM
    Hi TOM!!! perfect buddy! Exactly what I was looking for and worked like a charm. Appreciate the XPath code snippet as well. In my previous project working in MS InfoPath, I was really only using Node Itterators and the XML was a tad less mucked up (even being a MS product lol) so i was not required to go that deep into parsing.

    Again appreciated, this will probs not be the last time I post a question however we sure can mark this one as resolved!

    Thanks!!

    David


  • 6.  RE: Parsing the returned XML from SOAP WS getListValues

    Posted May 06, 2013 07:41 PM
    Check the 'Call Results' section within the SOAP operator. There are some checkboxes there with options to assist, notably "Strip XML Namespaces from Response". I believe there is information within the Tutorials, https://support.ca.com/phpdocs/0/common/impcd/r11/Catalyst/CA_PA_VIDEOS.html that you may find of benefit.


    Derek-




    davethecoder wrote:

    Hi all, getting close to my goal of querying SD for the data I need and then I can move on to actually automating some processes! I have some experience with XPath and XML parsing however I can’t figure out and/or find anything out there on how to parse the relatively hideous return from the WS call, I am returning all attributes as an exercise. Any help would be appreciated … obviously I am befuddled by the formatting. (snippet below)

    <soapenv:Body>
    <getListValuesResponse xmlns="http://www.ca.com/UnicenterServicePlus/ServiceDesk">
    <getListValuesReturn xmlns="">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
    &lt;UDSObjectList&gt;
    &lt;UDSObject&gt;
    &lt;Handle&gt;cnt:02752626B3FA044A9F50020D97CF2F40&lt;/Handle&gt;
    &lt;Attributes&gt;
    &lt;Attribute DataType="2002"&gt;
    &lt;AttrName&gt;pgroups&lt;/AttrName&gt;
    &lt;AttrValue&gt;(0)&lt;/AttrValue&gt;
    &lt;/Attribute&gt;
    &lt;Attribute DataType="2002"&gt;
    &lt;AttrName&gt;userid&lt;/AttrName&gt;
    &lt;AttrValue&gt;donaldB&lt;/AttrValue&gt;
    &lt;/Attribute&gt; …

    Thank you!!

    David


  • 7.  RE: Parsing the returned XML from SOAP WS getListValues

    Posted May 06, 2013 07:41 PM
    Check the 'Call Results' section within the SOAP operator. There are some checkboxes there with options to assist, notably "Strip XML Namespaces from Response". I believe there is information within the Tutorials, https://support.ca.com/phpdocs/0/common/impcd/r11/Catalyst/CA_PA_VIDEOS.html that you may find of benefit.


    Derek-




    davethecoder wrote:

    Hi all, getting close to my goal of querying SD for the data I need and then I can move on to actually automating some processes! I have some experience with XPath and XML parsing however I can’t figure out and/or find anything out there on how to parse the relatively hideous return from the WS call, I am returning all attributes as an exercise. Any help would be appreciated … obviously I am befuddled by the formatting. (snippet below)

    <soapenv:Body>
    <getListValuesResponse xmlns="http://www.ca.com/UnicenterServicePlus/ServiceDesk">
    <getListValuesReturn xmlns="">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
    &lt;UDSObjectList&gt;
    &lt;UDSObject&gt;
    &lt;Handle&gt;cnt:02752626B3FA044A9F50020D97CF2F40&lt;/Handle&gt;
    &lt;Attributes&gt;
    &lt;Attribute DataType="2002"&gt;
    &lt;AttrName&gt;pgroups&lt;/AttrName&gt;
    &lt;AttrValue&gt;(0)&lt;/AttrValue&gt;
    &lt;/Attribute&gt;
    &lt;Attribute DataType="2002"&gt;
    &lt;AttrName&gt;userid&lt;/AttrName&gt;
    &lt;AttrValue&gt;donaldB&lt;/AttrValue&gt;
    &lt;/Attribute&gt; …

    Thank you!!

    David


  • 8.  RE: Parsing the returned XML from SOAP WS getListValues

    Posted May 07, 2013 12:57 PM
    Hi Derek, I already have the checkbox enabled fo "Strip XML Namespaces from Response". It does not appear to assist. I am currently toying" with the ohter options.

    Our PC's are so locked down at work lol that I currently have a look at the videos that your suggesting. Perhaps when I have access to another machine

    Thanks

    --David