问题
I have recently started using OSB and i came across the feature "replace entire node or replace node contents". Could anyone help me in listing out the difference between the two with examples. This is a very basic question but i just started learning osb and wanted to get this right.
Thanks in advance.
Cheers..
回答1:
OK, let's assume you have a variable, $body
. Your proxy has done some stuff, and already has $body set, and you want to run it through an xquery transform before you return it.
$body will be something like
<soap:Body xmlns:soap="etc">
<ns0:response xmlns:ns0="etc2">
<ns0:item>
<!-- etc etc -->
</ns0:item>
</ns0:response>
</soap:Body>
If you replace the entire node, you must replace it with a <soap:Body>
. (I mean, you could replace it with something different, but you'll encounter an error somewhere because OSB expects $body to be a certain type)
If you replace the node contents, you may replace it with anything: perhaps a transformed <ns0:response>
, but it's common to replace it with totally different elements. Either way, the <soap:Body>
element is unaffected, and all the insides are scooped out and replaced.
Most of the time, you'll replace node contents of $body rather than replacing the entire node, but if it's a variable you've created yourself, it could go either way depending on what you want.
来源:https://stackoverflow.com/questions/35226354/difference-between-replace-entire-node-and-replace-node-contents-in-osb