Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

UCCX 8.5: Updating XML Document and Read Issue

I have two issues that I need assistance with.

  1. I am running into an issue of updating XML document suing a script. I am trying to update the XML file by calling into a script to change a digit value. I am a beginner when it comes to advance scripting and lacking the understanding how to make this work. I am using Get_Digit logic to have the caller enter digit, which supposed to write an an existing XML file. Please see the attached script and XML files.
  2. I have another script that is supposed to use the XML file data and route the call accordingly for next step. I manually updated the XML file but it get gives me an error: the file is empty.; nested exception is: java.io.ioexception: the file is empty.

Can someone please look into this and correct my mistakes?

Update XML script is used to update the XML file

CTCNetwork script is supposed to use the XML file for its call flow.

  • Contact Center
1 ACCEPTED SOLUTION

Accepted Solutions

Re: UCCX 8.5: Updating XML Document and Read Issue

You have several errors with your script, and there is not a simple answer.

Start small.  First, learn how to read from an XML document.  It only takes 1 document, 2 variables, and 2 script steps to accomplish.

Documents

Filename

CTCOverRide.xml

Contents

2

Variables

Document xml_doc = DOC[CTCOverRide.xml]

String xpath_result = ""

Script

Start

xml_doc = Create XML Document (xml_doc)

xpath_result = Get XML Document Data(xml_doc, "//flag")

/* xpath_result is now holding the value of the flag */

End

Now let's build upon that concept of reading from an XML document, and let's increment the flag number by 1.  This addition requires 1 new document, 3 new variables, and 5 new script steps.

Documents

Filename

CTCOverRide.xml

Contents

2

Filename

CTCOverRide_template.xml

Contents

%FLAG%

Variables

Document xml_doc = DOC[CTCOverRide.xml]

Document xml_template = DOC[CTCOverRide_template.xml]

String xpath_result = ""

int current_flag = 0

User repo_user = USER[aholloway]

Script

Start

xml_doc = Create XML Document (xml_doc)

xpath_result = Get XML Document Data(xml_doc, "//flag")

Set current_flag = Integer.parseInt(xpath_result)

Increment current_flag

/* On this next step you need to add a keyword: name = "FLAG"; value = current_flag */

xml_doc = Keyword Transform Document (xml_template)

Authenticate User Password (repo_user, "hello_world!")

     Successful

          Upload Document (xml_doc to L[en_US], "CTCOverRide.xml")

               Successful

                    /* The document has been modified */

               Unsuccessful

                    /* Something went wrong during the upload */

     Unsuccessful

          /* Something went wrong authenticating the user */

End

Now build from there.  Separate the reading of the document into the script that needs to know the current value: CTCNetworks.aef, and the modifying of the document into the script that needs to manage the value: Update XML.aef (also, avoid spaces in file names).

See how far that gets you, and post back any problems you encounter.

Anthony Holloway Please use the star ratings to help drive great content to the top of searches.
20 REPLIES
Cisco Employee

UCCX 8.5: Updating XML Document and Read Issue

Hello,

This is for the latter error nested exception error about the file being empty

-If this is a HA server setup, check if the app manager on either node is in service or partial

-Also the MIVR logs have to be turned on to identify which .xml file is empty(engine debugging has to be turned on)

-Then we will have to look into the MIVR files and confirm which XML file is empty

Thanks,

Prashanth

New Member

UCCX 8.5: Updating XML Document and Read Issue

Hi Prashanth,

Thank you for your reply!  We currently don't have HA server. I will have to look at MIVR logs and see if it reports any specifics.

Re: UCCX 8.5: Updating XML Document and Read Issue

You have several errors with your script, and there is not a simple answer.

Start small.  First, learn how to read from an XML document.  It only takes 1 document, 2 variables, and 2 script steps to accomplish.

Documents

Filename

CTCOverRide.xml

Contents

2

Variables

Document xml_doc = DOC[CTCOverRide.xml]

String xpath_result = ""

Script

Start

xml_doc = Create XML Document (xml_doc)

xpath_result = Get XML Document Data(xml_doc, "//flag")

/* xpath_result is now holding the value of the flag */

End

Now let's build upon that concept of reading from an XML document, and let's increment the flag number by 1.  This addition requires 1 new document, 3 new variables, and 5 new script steps.

Documents

Filename

CTCOverRide.xml

Contents

2

Filename

CTCOverRide_template.xml

Contents

%FLAG%

Variables

Document xml_doc = DOC[CTCOverRide.xml]

Document xml_template = DOC[CTCOverRide_template.xml]

String xpath_result = ""

int current_flag = 0

User repo_user = USER[aholloway]

Script

Start

xml_doc = Create XML Document (xml_doc)

xpath_result = Get XML Document Data(xml_doc, "//flag")

Set current_flag = Integer.parseInt(xpath_result)

Increment current_flag

/* On this next step you need to add a keyword: name = "FLAG"; value = current_flag */

xml_doc = Keyword Transform Document (xml_template)

Authenticate User Password (repo_user, "hello_world!")

     Successful

          Upload Document (xml_doc to L[en_US], "CTCOverRide.xml")

               Successful

                    /* The document has been modified */

               Unsuccessful

                    /* Something went wrong during the upload */

     Unsuccessful

          /* Something went wrong authenticating the user */

End

Now build from there.  Separate the reading of the document into the script that needs to know the current value: CTCNetworks.aef, and the modifying of the document into the script that needs to manage the value: Update XML.aef (also, avoid spaces in file names).

See how far that gets you, and post back any problems you encounter.

Anthony Holloway Please use the star ratings to help drive great content to the top of searches.
New Member

Re: UCCX 8.5: Updating XML Document and Read Issue

Hi Anthony,

Thanks a million for your step by step assistance.  It was really helpful for me to understand.  I have resolved the issue of reading from an XML file.  However, I am still struggling with the UpdateXML file script.  I followed your instructions and built a simple script.  And I am getting a following error at the Upload Document step.

In addition, I wanted to understand why we need an "increment" step in there.  It seems to increase the value by one.  I purposely left this out.

Re: UCCX 8.5: Updating XML Document and Read Issue

I'm not sure I understand where the problem is.  Could you please explain it a little more?  Also, could you screenshot your Upload Document step and it's property window? (upload a PNG please)

As for the Increment step, no it's not necessary.  I was using it to simply change the value of the flag, such that when you put a new copy of the file, you will notice the value has increaed by 1.

Anthony Holloway Please use the star ratings to help drive great content to the top of searches.
New Member

Re: UCCX 8.5: Updating XML Document and Read Issue

Hi Anthony,

I am having the same issue Sriaz above and am receiving the error "result of invalid length..."  I have included a screen shot of the document step.  One question I have, is in your script, the values are either blank or null for DocumentName and OverRideXML.  Are these poplutaed from within the script?

At this point, I am having issues with the upload step.  I have added a few extra Labels so I can see values as I am stepping through the script.  I have also attached my script and documents. 

Any assistance would be appreciated!

Keith

UploadDocument.png

Re: UCCX 8.5: Updating XML Document and Read Issue

Keith,

What I said above to sriaz0001 above, applies to your script as well:

You have several errors with your script, and there is not a simple answer.

Start  small.  First, learn how to read from an XML document.  It only takes 1  document, 2 variables, and 2 script steps to accomplish.

And my following examples show the exact components necessary to accomplish a read/write to/from an XML document; no more, no less.

As an example of a step you shouldn't be using: you are using the write document step in your script.  This will not do anything useful for you, and you should delete it.

As an example of an error in your script: you typed in the keyword transform document the name "%Destination%", however, this step does not require the percent sign as apart of the name.

Another error example: you are trying to upload the document within the variable LoansRerouteXML, however, it's never assigned any value, just null from the beginning.

I see a few other problems with your script, which is why I will not go into debugging the whole thing.  You should really just start over and start small, testing each new piece of code before adding another piece of code.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

Anthony Holloway Please use the star ratings to help drive great content to the top of searches.

Re: UCCX 8.5: Updating XML Document and Read Issue

Hi Anthony

Thank you very much for your sample steps.

i managed to get those working in no time.

I'm new to this UCCX and started learning scripting couple of weeks ago.

and the advice you provided on these posts really helped me to start something small and builed a complex ones.

I used one of yours holiday script sample and it worked like charm

Really appriciate your posts and thank you once again

Regards

shameer

UCCX 8.5: Updating XML Document and Read Issue

Thank you for the kind words Shameer.  It sounds like your are having fun learning and scripting in UCCX.  It's a great product to be involved with.  I hope to see more of your great questions around the forums.  That's exactly why this community exists.  Take care.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

Anthony Holloway Please use the star ratings to help drive great content to the top of searches.
6079
Views
25
Helpful
20
Replies
This widget could not be displayed.