//serialize children
OMElement header = getHeader();
if ((header != null) && (header.getFirstOMChild() != null)) {
((SOAPHeaderImpl) header).internalSerialize(writer, true);
}
SOAPBody body = getBody();
//REVIEW: getBody has statements to return null..Can it be null in any case?
if (body != null) {
((SOAPBodyImpl) body).internalSerialize(writer, true);
}
OMSerializerUtil.serializeEndpart(writer);
} else {
//Now the caching is supposed to be off. However caching been switched off
//has nothing to do if the element is already built!
if (state == COMPLETE || (this.builder == null)) {
OMSerializerUtil.serializeStartpart(this, writer);
OMElement header = getHeader();
if ((header != null) && (header.getFirstOMChild() != null)) {
serializeInternally((OMNodeImpl) header, writer);
}
SOAPBody body = getBody();
if (body != null) {
serializeInternally((OMNodeImpl) body, writer);
}
OMSerializerUtil.serializeEndpart(writer);
} else {