UCCX Get XML Document Data

Version 1
    This document was generated from CDN thread

    Created by: Josh Flynn on 07-05-2010 10:24:07 PM
    Hello all,
     
    I'm trying to get a script to interact with a Web Service that queries a customer DB and returns an account number.
     
    As such, I've set up a script with the following steps:
     

    1.      1.   Create URL Doc-
    works fine
    2.       2.  Create XML Doc-
    works fine
    3.       3.  Get XML Doc Data-
    not parsing the XML doc correctly (or so it seems).
     
     
    I¿ve done Reactive Debugs on the
    script and the Create XML step (Step 2 above) produces the following XML doc:
     
    <CustomerSearchResult
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://www.melaleuca.com/">

     
    <AccountNumber>1016356229</AccountNumber>
     
    <ResultCount>1</ResultCount>
     
    <Culture>en-US</Culture>
     
    <Script>BadNumber</Script>
    </CustomerSearchResult>
     
     
    In my Get XML Data step I set a
    String Variable =¿ /CustomerSearchResult/AccountNUmber¿  
    (<<<the xPath of the string I want)
     
    Yet the variable repeatedly
    resolves to null.  I¿ve tried several iterations of the xPath to no avail.
     
    Does anyone have any ideas?
     
    Thanks!
     
    Josh

    Subject: RE: UCCX Get XML Document Data
    Replied by: Steven Pawlak on 22-09-2010 03:53:37 PM
    Your XPath is totally wrong. Look at the scripting doc Volume 2, Document Steps for how cisco wants the XPath written. There is also going to be an issue with those namespaces too. 
     
    Basically it should be like
     
    /descendant::CustomerSearchResult/child::AccountNumber
     
    might be 
     

    /descendant::CustomerSearchResult[1]/child::AccountNumber
     
    to handle the namespace. 

    Subject: RE: UCCX Get XML Document Data
    Replied by: Alexander Sanchez Maldonado on 11-09-2013 07:27:05 PM
    Steven Pawlak:
    Your XPath is totally wrong. Look at the scripting doc Volume 2, Document Steps for how cisco wants the XPath written. There is also going to be an issue with those namespaces too. 
     
    Basically it should be like
     
    /descendant::CustomerSearchResult/child::AccountNumber
     
    might be 
     

    /descendant::CustomerSearchResult[1]/child::AccountNumber
     
    to handle the namespace. 
    I have the same problem but my XPath is correct. When my XML file does'nt have a header in the first tag
    "<ArrayOfAsignatura xmlns="http://schemas.datacontract.org/2004/07/WcfServiceREST" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">"
    ; It does'nt work but if the first tag is "<ArrayOfAsignatura>" it works.
    any suggestions?

    Subject: RE: UCCX Get XML Document Data
    Replied by: Steven Pawlak on 12-09-2013 07:39:43 AM
    Alexander, 

    I think you are haviong the same Namespace issue ( the xmls="" stuff inside he <>). 

    From what I understand you have this as the start of your XPath  "/descendant::ArrayOfAsignatura" and that works fine if the tag look likes <ArrayOfAsignatura>, However, if the tag looks like 

    <ArrayOfAsignatura xmlns="http://schemas.datacontract.org/2004/07/WcfServiceREST" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">

    then you have problems. Try an XPath like this

    "/descendant::ArrayOfAsignatura[1]"

    The 1 inside the [] says to use the first occurance of namespace without having to declare what that namespace is. 

    Subject: RE: UCCX Get XML Document Data
    Replied by: Alexander Sanchez Maldonado on 12-09-2013 09:38:06 AM
    Steven thanks for you help, the problem was that namespace, the web service's developer remove that set in a variable NameSpace= "" inside of serializer class.
    Thanks for your help.