I'm trying to process an XML message and in the middle of the process, I need to query an XML DB to see if the message has already previously handled.
Depending upon the result of the request, I have to route the message through different stage.
I thought to use the HttpClient and the Router Stage. However, the XML message needed for the query is not the same as the original message. Therefore I need to find a way to temporary transform the message to issue the XML database query, then I have to take back the original message and process it.
I thought to use the Domify stage to temporary saved the original message but I don't find an esay way to get it back as document content.
Does anybody have an idea to solve this type of flow?
Thanks,
--ERic
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
One thing you could do is to assign the original content as an attribute of the PipelineDocument. You could do this, for example, using a scripting pipeline stage. Then after you do your transformations, etc., you would still have access to the original array of bytes by retrieving the attrbibute.
I am trying it and get
<2004-04-13 12:43:01,870> ERROR [main] : [DefaultPipelineStageErrorHandler.hand
lePipelineStageError] PipelineStage name: docfromattribute Error: com.babeldoc.c
ore.pipeline.PipelineException: Script processing failed
<2004-04-13 12:43:01,885> ERROR [main] : [PipelineFeeder.process]
com.babeldoc.core.pipeline.PipelineException: Script processing failed
....
-- Removed some of the errors....
....
Caused by: org.apache.bsf.BSFException: JavaScript Error: Internal Error: Syntax
Error: identifier is a reserved word (<BABELDOC>; )
after
document.setBytes(
(byte[])document.get("originalContent"));
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Some kind of extension to XPathExtract to get an attribute from and external file (Or an equivalent to SQL enrich for an XML file) would be less convoluted but...
Hi,
I'm trying to process an XML message and in the middle of the process, I need to query an XML DB to see if the message has already previously handled.
Depending upon the result of the request, I have to route the message through different stage.
I thought to use the HttpClient and the Router Stage. However, the XML message needed for the query is not the same as the original message. Therefore I need to find a way to temporary transform the message to issue the XML database query, then I have to take back the original message and process it.
I thought to use the Domify stage to temporary saved the original message but I don't find an esay way to get it back as document content.
Does anybody have an idea to solve this type of flow?
Thanks,
--ERic
One thing you could do is to assign the original content as an attribute of the PipelineDocument. You could do this, for example, using a scripting pipeline stage. Then after you do your transformations, etc., you would still have access to the original array of bytes by retrieving the attrbibute.
eg:
document.put("originalContent",
document.getBytes());
//then later to do the reset...
document.setBytes(
(byte[])document.get("originalContent");
I think this should work...
Did this work?
I am trying it and get
<2004-04-13 12:43:01,870> ERROR [main] : [DefaultPipelineStageErrorHandler.hand
lePipelineStageError] PipelineStage name: docfromattribute Error: com.babeldoc.c
ore.pipeline.PipelineException: Script processing failed
<2004-04-13 12:43:01,885> ERROR [main] : [PipelineFeeder.process]
com.babeldoc.core.pipeline.PipelineException: Script processing failed
....
-- Removed some of the errors....
....
Caused by: org.apache.bsf.BSFException: JavaScript Error: Internal Error: Syntax
Error: identifier is a reserved word (<BABELDOC>; )
after
document.setBytes(
(byte[])document.get("originalContent"));
Some kind of extension to XPathExtract to get an attribute from and external file (Or an equivalent to SQL enrich for an XML file) would be less convoluted but...
with a slight change it works
document.put("originalContent", document.getBytes());
and then
document.setBytes(document.get("originalContent"));