SOAPModelBuilder builder = OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory,
new StringReader(orgEnvelope.toString()));
if (supportsOptimization) {
// To detect if the child element is instantiated or not, we register a custom
// builder that throws an exception.
((StAXSOAPModelBuilder)builder).registerCustomBuilderForPayload(new CustomBuilder() {
public OMElement create(String namespace, String localPart,
OMContainer parent, XMLStreamReader reader, OMFactory factory)
throws OMException {
throw new AssertionFailedError("Custom builder called.");
}