Hi,
I would like to know the best method to add new elements and results to a xml document in Mediator.
I have two situations. In one I have a request xml document from which I create a soap call. I then want to add the result to the original document but in a new element that does not exist. In the other I want to add xml from a fixed xml document (using payloadsetter).
An example, here is the input document.
RequestClient
121
I would like to add the result of the soap call below payload enclosed in an element “soap result here”.
So far the only solution I can think of is to put the result of the call in a new message and then do a transformation. But is that effective, is there a performance penalty? Isn’t there an easier way, like adding the result tags arround the xpath statement for the result?
For the second situation where I use the payloadSetter, I have two options. Either a transformation or a replicate statement with a cut and paste. Which is better?
I’m mainly concerned of performance when my documents start getting bigger and volumes increase.
Regards,
Jean
Hi Jean,
Starting with 7.3.1.1 (just released) a new attribute “createTarget=” is allowed on the statement. It functions the same as the existing “target=” attribute except that it will create any elements that are not present in the document. So in your example you could specify:
Hope this helps.
Best regards,
Mike
Thanks Mike, just one more question although I think I already know it can’t be done.
Is it possible to use properties to temporarily store xml not just the values? Let’s say I want to use a part of the document in a different sequence but want to pass it as a property.
Jean
Hi Jean,
Currently property values are only strings. You can, however, use other message parts to contain temporary XML documents and fragments.
Best regards,
Mike