At one of my clients a developer was hitting the following BEA-382000 error in a OSB proxy:
org.apache.xmlbeans.impl.values.XmlValueDisconnectedException at org.apache.xmlbeans.impl.values.XmlObjectBase.check_orphaned(XmlObjectBase.java:1258) at org.apache.xmlbeans.impl.values.XmlObjectBase.newCursor(XmlObjectBase.java:286) at stages.transform.runtime.ForEachMessageContext.initVariableValue(ForEachMessageContext.java:80) at stages.transform.runtime.ForEachRuntimeStep.processMessage(ForEachRuntimeStep.java:95) at com.bea.wli.sb.pipeline.debug.DebuggerRuntimeStep.processMessage(DebuggerRuntimeStep.java:74)
The exception occurred from within a For-Each operation within the proxy pipeline, in which a Service Callout was invoked multiple times and its output concatenated into the $body.
Fearing for a bug in Apache’s XMLBeans, I was relieved to find out that the cause was much more innocent: when using a For-Each operation in which a ServiceCallout is done, don’t manipulate the $body context variable. Use a (temporary) copy, and assign the results afterwards outside of the For-Each. Then you should be fine.