public Stream GetFragment(string collectionId, string fragmentId) { try { var format = GetRequestedFormat(); if (format.Equals("nt")) { var woc = WebOperationContext.Current; woc.OutgoingResponse.ContentType = "text/plain"; } else { var woc = WebOperationContext.Current; woc.OutgoingResponse.ContentType = "application/xml; charset=utf-8"; woc.OutgoingResponse.Format = WebMessageFormat.Xml; } var fragment = _serverCore.GetFragment(collectionId, fragmentId, format); if (fragment == null) { RaiseNotFound("No collection with id " + collectionId + " or fragement " + fragmentId); } return(fragment); } catch (Exception ex) { if (!(ex is WebFaultException <string>)) { RaiseServerException(ex, "Error processing GetFragment for " + collectionId + " fragment id " + fragmentId + " see server logs for details."); return(null); } throw; } }