public string FindMetadataEndpointAddress(ServiceLocation serviceLocation) { FunctionalErrorList errorList = new FunctionalErrorList(); if (serviceLocation != null) { if (String.IsNullOrEmpty(serviceLocation.Name) || String.IsNullOrEmpty(serviceLocation.Profile)) { errorList.Add(new FunctionalErrorDetail { Message = "Name or Profile is null" }); throw new FaultException <FunctionalErrorList>(errorList); } try { if (serviceLocation.Version == null) { return(_datamapper.FindMetadataEndpointAddress(serviceLocation.Name, serviceLocation.Profile)); } return(_datamapper.FindMetadataEndpointAddress(serviceLocation.Name, serviceLocation.Profile, serviceLocation.Version)); } catch (MultipleRecordsFoundException ex) { errorList.Add(new FunctionalErrorDetail { Message = ex.Message, Data = ex.Data }); } catch (NoRecordsFoundException ex) { errorList.Add(new FunctionalErrorDetail { Message = ex.Message, Data = ex.Data }); } catch (VersionedRecordFoundException ex) { errorList.Add(new FunctionalErrorDetail { Message = ex.Message, Data = ex.Data }); } } if (errorList.HasErrors) { throw new FaultException <FunctionalErrorList>(errorList); } return(null); }