cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1377
Views
1
Helpful
7
Replies

pass java objects between cvp applications

jim_manning1
Level 1
Level 1

Is there a way to pass java objects between cvp applications using subdialog elements?...or is there another way to do this?

1 Accepted Solution

Accepted Solutions

laxminarasimha
Level 7
Level 7

Yes, you can pass the java objects within application or from application to application using CVP Sessions.

For example,

You like to pass a String from One application to other application.

STEP-1: You add it into Session from Java at Decision/Action Element in Call Studio.

              Command: String name=(String) dataObject.setSessionData("name");

STEP-2: To transfer this, you add this session name at Application Transfer element in Data Tab.

STEP-3: After deployed into VXML Application, you will get

View solution in original post

7 Replies 7

ptindall
Cisco Employee
Cisco Employee

You can't pass a Java object directly but you could pass a reference to data stored in either a back-end repository or global data in the VoiceXML server.  If you adopt the global data approach, then be aware of the following:

  • The subdialog would have to reside on the same server
  • Global data can only be accessed via a custom element (I can give you one if you need it)
  • You'd have to manage the data and delete it after use because as it's global there is no automatic clean-up mechanism.

Paul

Thank you for the response. Upon further review we have decided to try a different tactic which is not working as expected. We are trying to pass a java object that has been converted into its json representation using the Subdialog Invoke parameter. We set the json string as such:

String jsonInString = mapper.writeValueAsString(obj);... and set jsonInString to session data...the try to pass the value using the Subdialog Invoke parameter. The application fails after entering the Subdialog Invoke. Any ideas?...thanks

ptindall
Cisco Employee
Cisco Employee

You will hit problems with JSON as populating variables with '{}' characters denotes variable substitution. Check the subdialog errorlog or even the globalerrorlog depending on the point it failed.

Thank you fro the response. We did have issues with the '{}' and "" characters. We modified the string to get the subdialog to accept it as a parameter. Then we convert it back to the original string in the receiving app but the conversion back to an object is failing. We are using:

obj = mapper.readValue(jsonString, obj.getClass());...to convert the string back to the original object but get the following error:

com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.Class out of START_OBJECT token

at [Source: {"tfn":"8888888888","dnis":null,"bgn":null,"ucid":null,"appName":null,"ani":null,"stateCode":"MN","commonWavURL":null,"commonGrammarURL":null,"applicationBaseWavURL":null,"applicationBaseGrammarURL":null}

ptindall
Cisco Employee
Cisco Employee

And if you do the same JSON --> object deserialisation using standalone code, does it work? 

laxminarasimha
Level 7
Level 7

Yes, you can pass the java objects within application or from application to application using CVP Sessions.

For example,

You like to pass a String from One application to other application.

STEP-1: You add it into Session from Java at Decision/Action Element in Call Studio.

              Command: String name=(String) dataObject.setSessionData("name");

STEP-2: To transfer this, you add this session name at Application Transfer element in Data Tab.

STEP-3: After deployed into VXML Application, you will get

The end of your message seems to have been cut off.  Could you please post the rest of STEP-3 ?

And does this mean the two applications will share the same Session ?

Thanks

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: