/// <summary>
        /// Replaces a single file by adding a new revision to an existing representation
        /// </summary>
        /// <param name="iePid">PID of the IE</param>
        /// <param name="repPid">PID of the representation for which a new revision will be created</param>
        /// <param name="filePid">PID of the file being replaced</param>
        /// <param name="submissionReason">A text note which indicates why the revision is being created</param>
        /// <param name="filePath">Path of file on remote server</param>
        /// <param name="localPath">Local path of file, optional. If provided, fixity will be calculated and provided to Rosetta.</param>
        public void ReplaceFileInRep(string iePid, string repPid, string filePid, string submissionReason, string filePath, string localPath = null)
        {

            IEWebServices ws = new IEWebServices();
            ws.Url = String.Format("http://{0}:{1}/dpsws/repository/IEWebServices",
                Host, Port);

            fixity fixity = new fixity();

            // If local path exists, calculate fixity
            if (!String.IsNullOrEmpty(localPath))
            {
                fixity.algorithmType = "MD5";
                var md5 = MD5.Create();
                using (var stream = File.OpenRead(localPath))
                {
                    fixity.value = BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", "").ToLower();
                }
            }

            // Call service
            updateRepresentationResponse resp = ws.updateRepresentation(new updateRepresentation() 
                {   pdsHandle = PdsHandle, 
                    iePid = iePid, 
                    repPid = repPid, 
                    representationContent = new representationContent[] { 
                        new representationContent() {
                            oldFilePid = filePid,
                            newFile = filePath,
                            operation = operation.REPLACE,
                            operationSpecified = true, // c# oddity when serializing enums
                            fixity = fixity,
                            fileOriginalPath = Path.GetFullPath(localPath)
                        }
                    }, 
                    submissionReason = "updated by vendor" 
                });
        }
        /// <summary>
        /// Get the METS of an IE
        /// </summary>
        /// <param name="iePid">PID of the requested IE</param>
        /// <returns></returns>
        public string GetIEMets(string iePid)
        {
            IEWebServices ws = new IEWebServices();
            ws.Url = String.Format("http://{0}:{1}/dpsws/repository/IEWebServices",
                Host, Port);

            IEWebService.getIEResponse resp = ws.getIE(new IEWebService.getIE() 
                {   pdsHandle = PdsHandle, 
                    iePid = iePid, 
                    flags = 0  // Get Full IE with only last revision
                });

            return resp.getIE;

            #region Old
            /*
            // Old method- used delivery since GetIE using PDS was not available
             
            string dvs = ExtractDvsIdFromDelivery(GetWebResponse(string.Format("http://{0}:{1}/delivery/DeliveryManagerServlet?dps_pid={2}",
                host, port, iePid)));

            DeliveryAccessWS ws = new DeliveryAccessWS();
            ws.Url = String.Format("http://{0}:{1}/dpsws/delivery/DeliveryAccessWS",
                host, port);
            getFullIEByDVS req = new getFullIEByDVS();
            getFullIEByDVSResponse resp = ws.getFullIEByDVS(new getFullIEByDVS() { dvs = dvs });
            return resp.@return;
             */
            #endregion

        }