if (envelope == null) {
SOAPFactory fac = getSOAPFactory(msgContext);
envelope = fac.getDefaultEnvelope();
}
OMElement result = metadata.toOM();
if (result != null) {
AxisService service = msgContext.getAxisService();
result.declareNamespace(service.getTargetNamespace(),
service.getTargetNamespacePrefix());
envelope.getBody().addChild(result);