Seven Stars

Create Context Variable as type "Document"

How can one create a context variable as type "document"? I am trying to save the tXMLMap output before sending it to tRestResponse
Thanks in advance for your help!
3 REPLIES
Employee

Re: Create Context Variable as type "Document"

I've not tried this, but I suspect you can create a context variable as type Object, save the XML Document to the Object context and when you want to use it, cast it from an Object to a Document.
So you could use a tJavaFlex to set the context variable. There is no need to cast to Object.
Main code
context.myObject = row1.document;
Then when you want to use the context variable as a Document, use it like below....
(Document)context.myObject
As I said, I've not tried this. But it should work.
Employee

Re: Create Context Variable as type "Document"

On second thoughts, I think I may have misunderstood what you are asking. You should be able to just connect the tRestResponse to the output from the tXMLMap, create the expected schema (or use one you have in the repository) and that should do it.
Seven Stars

Re: Create Context Variable as type "Document"

On second thoughts, I think I may have misunderstood what you are asking. You should be able to just connect the tRestResponse to the output from the tXMLMap, create the expected schema (or use one you have in the repository) and that should do it.

@rhall,
I need to manipulate the output (by encryption) before sending the response. The Json object is lost when doing any further manipulation. Hence, I was trying to save the output as a Document and then encrypt it before sending it via tRestResponse.
I have explained it in detail at: http://www.talendforge.org/forum/viewtopic.php?id=43734