Esempio n. 1
0
        /// <summary>
        /// Hace una petición post al api
        /// </summary>
        /// <param name="urlBase">Url donde se encuentra el api</param>
        /// <param name="urlMethod">Url del método</param>
        /// <param name="token">token bearer de seguridad</param>
        /// <param name="item">objeto a pasar</param>
        /// <param name="isFile">si el objeto pasado es un fichero</param>
        /// <param name="fileName">nombre del parametro del fichero, en el caso de que el objeto pasado sea un fichero</param>
        public string CallPostApi(string urlBase, string urlMethod, object item, TokenBearer token = null, bool isFile = false, string fileName = "rdfFile", bool sparql = false)
        {
            HttpContent contentData = null;

            if (!isFile)
            {
                if (item != null)
                {
                    string stringData  = JsonConvert.SerializeObject(item);
                    string contentType = "application/json";
                    if (sparql)
                    {
                        stringData  = (string)item;
                        contentType = "application/x-www-form-urlencoded";
                    }
                    contentData = new StringContent(stringData, System.Text.Encoding.UTF8, contentType);
                }
            }
            else
            {
                byte[] data;
                using (var br = new BinaryReader(((IFormFile)item).OpenReadStream()))
                {
                    data = br.ReadBytes((int)((IFormFile)item).OpenReadStream().Length);
                }
                ByteArrayContent bytes = new ByteArrayContent(data);
                contentData = new MultipartFormDataContent();
                ((MultipartFormDataContent)contentData).Add(bytes, fileName, ((IFormFile)item).FileName);
            }
            string result = "";
            HttpResponseMessage response = null;

            try
            {
                HttpClient client = new HttpClient();
                if (token != null)
                {
                    client.DefaultRequestHeaders.Add("Authorization", $"{token.token_type} {token.access_token}");
                }
                response = client.PostAsync($"{urlBase}{urlMethod}", contentData).Result;
                response.EnsureSuccessStatusCode();
                result = response.Content.ReadAsStringAsync().Result;
                return(result);
            }
            catch (HttpRequestException ex)
            {
                if (response.StatusCode.Equals(HttpStatusCode.BadRequest))
                {
                    throw new BadRequestException(response.Content.ReadAsStringAsync().Result);
                }
                else if (!string.IsNullOrEmpty(response.Content.ReadAsStringAsync().Result))
                {
                    throw new HttpRequestException(response.Content.ReadAsStringAsync().Result);
                }
                else
                {
                    throw new HttpRequestException(response.ReasonPhrase);
                }
            }
        }
Esempio n. 2
0
 public CallOAIPMH(CallTokenService tokenService)
 {
     if (tokenService != null)
     {
         _token = tokenService.CallTokenOAIPMH();
     }
 }
Esempio n. 3
0
 public CallConversor(CallTokenService tokenService)
 {
     if (tokenService != null)
     {
         _token = tokenService.CallTokenConversor();
     }
 }
        /// <summary>
        /// Llama al api de gestión de tokens
        /// </summary>
        /// <param name="stringData">cadena con la información de configuración de los tokens de un api;"grant_type={grantType}&scope={scope del api}&client_id={ClienteId del Api}&client_secret={contraseña del api}"</param>
        /// <returns>token bearer</returns>
        private TokenBearer CallTokenIdentity(string stringData)
        {
            var contentData = new StringContent(stringData, System.Text.Encoding.UTF8, "application/x-www-form-urlencoded");
            HttpResponseMessage response = null;

            try
            {
                HttpClient client = new HttpClient();
                //var authString = Convert.ToBase64String(Encoding.UTF8.GetBytes("admin:Root12345678"));
                //client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", authString);
                client.Timeout = TimeSpan.FromDays(1);
                string authority = _configToken.GetAuthority();
                response = client.PostAsync($"{authority}", contentData).Result;
                response.EnsureSuccessStatusCode();
                string      result = response.Content.ReadAsStringAsync().Result;
                TokenBearer token  = JsonConvert.DeserializeObject <TokenBearer>(result);
                return(token);
            }
            catch (HttpRequestException)
            {
                if (!string.IsNullOrEmpty(response.Content.ReadAsStringAsync().Result))
                {
                    throw new HttpRequestException(response.Content.ReadAsStringAsync().Result);
                }
                else
                {
                    throw new HttpRequestException(response.ReasonPhrase);
                }
            }
        }
        /// <summary>
        /// Obtiene el resultado en formato json de la llamada al api
        /// </summary>
        /// <param name="htmlContent">contenido html</param>
        /// <param name="ocurrence">Posición de la cual hay que mirar</param>
        /// <returns>resultado de la llamada en formato json</returns>
        private string Api(string htmlContent, int ocurrence)
        {
            int first = htmlContent.IndexOf(DirectivesList.Api, ocurrence);

            first = first + DirectivesList.Api.Length;
            int         last  = htmlContent.IndexOf(DirectivesList.EndDirective, first);
            string      url   = htmlContent.Substring(first, last - first).Trim();
            TokenBearer token = null;

            if (url.Contains(_configUrlService.GetUrl()))
            {
                token = _callTokenService.CallTokenCarga();
            }
            else if (url.Contains(_configUrlService.GetUrlDocumentacion()))
            {
                token = _callTokenService.CallTokenApiDocumentacion();
            }
            else if (url.Contains(_configUrlCronService.GetUrl()))
            {
                token = _callTokenService.CallTokenCron();
            }
            string result = _callService.CallGetApi(url, "", token);

            return(result);
        }
        public IActionResult GetToken(int token_Type)
        {
            GetTokenViewModel tokenViewModel = new GetTokenViewModel();

            tokenViewModel.Token = "Token no disponible";
            TokenBearer token = null;

            if (token_Type.Equals((int)TokensEnum.TokenCarga))
            {
                token = _callTokenService.CallTokenCarga();
            }
            else if (token_Type.Equals((int)TokensEnum.TokenCron))
            {
                token = _callTokenService.CallTokenCron();
            }
            else if (token_Type.Equals((int)TokensEnum.TokenUrisFactory))
            {
                token = _callTokenService.CallTokenUrisFactory();
            }
            else if (token_Type.Equals((int)TokensEnum.TokenOAIPMH))
            {
                token = _callTokenService.CallTokenOAIPMH();
            }
            else if (token_Type.Equals((int)TokensEnum.TokenDocumentacion))
            {
                token = _callTokenService.CallTokenApiDocumentacion();
            }
            if (token != null)
            {
                tokenViewModel.Token = $"{token.token_type} {token.access_token}";
            }
            tokenViewModel.TokenOptions = LoadTokenList();
            return(View("Index", tokenViewModel));
        }
        /// <summary>
        /// Realiza la llamada para la obtención del token de acceso con el endpoint configurado en AuthorityGetToken
        /// </summary>
        /// <param name="stringData">Datos con el scope, el cliente id, el grantType y el secret</param>
        private TokenBearer CallTokenIdentity(string stringData)
        {
            //Log.Information($"CallTokenIdentity string data: {stringData}");
            var contentData = new StringContent(stringData, System.Text.Encoding.UTF8, "application/x-www-form-urlencoded");
            HttpResponseMessage response = null;

            try
            {
                HttpClient client = new HttpClient();
                client.Timeout = TimeSpan.FromDays(1);
                string authority = _configToken.GetAuthority() + "/connect/token";
                //Log.Information($"CallTokenIdentity authority {authority}");
                response = client.PostAsync($"{authority}", contentData).Result;
                response.EnsureSuccessStatusCode();
                string      result = response.Content.ReadAsStringAsync().Result;
                TokenBearer token  = JsonConvert.DeserializeObject <TokenBearer>(result);
                return(token);
            }
            catch (HttpRequestException)
            {
                if (!string.IsNullOrEmpty(response.Content.ReadAsStringAsync().Result))
                {
                    throw new HttpRequestException(response.Content.ReadAsStringAsync().Result);
                }
                else
                {
                    throw new HttpRequestException(response.ReasonPhrase);
                }
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Hace una petición get al apiCron
        /// </summary>
        /// <param name="urlBase">Url donde se encuentra el api cron, se puede omitir en este método</param>
        /// <param name="urlMethod">Url del método dentro del apiCron</param>
        /// <param name="token">token bearer de seguridad</param>
        public string CallGetApi(string urlBase, string urlMethod, TokenBearer token = null)
        {
            string result = "";
            HttpResponseMessage response = null;

            try
            {
                HttpClient client = new HttpClient();

                if (token != null)
                {
                    client.DefaultRequestHeaders.Add("Authorization", $"{token.token_type} {token.access_token}");
                }

                string url = _serviceUrl.GetUrl();
                response = client.GetAsync($"{url}{urlMethod}").Result;
                response.EnsureSuccessStatusCode();
                result = response.Content.ReadAsStringAsync().Result;
            }
            catch (HttpRequestException)
            {
                if (!string.IsNullOrEmpty(response.Content.ReadAsStringAsync().Result))
                {
                    throw new HttpRequestException(response.Content.ReadAsStringAsync().Result);
                }
                else
                {
                    throw new HttpRequestException(response.ReasonPhrase);
                }
            }
            return(result);
        }
Esempio n. 9
0
 public CallEtlApiService(ConfigUrlService serviceUrl, CallTokenService tokenService)
 {
     _serviceUrl = serviceUrl;
     if (tokenService != null)
     {
         _token = tokenService.CallTokenCarga();
     }
 }
Esempio n. 10
0
 public CallRepositoryJobService(CallCronService serviceApi, CallTokenService tokenService)
 {
     _serviceApi = serviceApi;
     if (tokenService != null)
     {
         _token = tokenService.CallTokenCron();
     }
 }
 public CallUrisFactoryApiService(CallTokenService tokenService, ConfigUrlService serviceUrl)
 {
     _serviceUrl = serviceUrl;
     if (tokenService != null)
     {
         _token = tokenService.CallTokenUrisFactory();
     }
     _urisCache = new Dictionary <string, string>();
 }
Esempio n. 12
0
 public CallEtlService(ICallService serviceApi, CallTokenService tokenService, ConfigUrlService serviceUrl)
 {
     _serviceUrl = serviceUrl;
     _serviceApi = serviceApi;
     if (tokenService != null)
     {
         _token = tokenService.CallTokenCarga();
     }
 }
 public CallUrisFactoryApiService(CallApiService serviceApi, CallTokenService tokenService, ConfigUrlService serviceUrl)
 {
     _serviceUrl = serviceUrl;
     _serviceApi = serviceApi;
     if (tokenService != null)
     {
         _token = tokenService.CallTokenUrisFactory();
     }
 }
 public ProgramingMethodsService(CallApiService serviceApi, HangfireEntityContext context, CallTokenService tokenService, ConfigUrlService configUrlService)
 {
     _serviceApi       = serviceApi;
     _context          = context;
     _configUrlService = configUrlService;
     if (tokenService != null)
     {
         _token = tokenService.CallTokenCarga();
     }
 }
Esempio n. 15
0
 public OaiPublishRDFService(EntityContext context, ICallNeedPublishData publishData, CallTokenService tokenService, ConfigUrlService configUrlService)
 {
     if (tokenService != null)
     {
         _token         = tokenService.CallTokenCarga();
         _callConversor = new CallConversor(tokenService);
     }
     _context          = context;
     _publishData      = publishData;
     _configUrlService = configUrlService;
 }
Esempio n. 16
0
        ///<summary>
        ///Realizar una llamda Post al método /etl/data-validate para verificar un rdf
        ///</summary>
        ///<param name="rdf">contenido en rdf a publicar</param>
        ///<param name="repositoryIdentifier">Identificador del repositorio</param>
        ///<param name="token">Token de tipo Bearer para la seguridad entre apis</param>
        public void CallDataValidate(string rdf, Guid repositoryIdentifier, TokenBearer token = null)
        {
            var bytes = Encoding.UTF8.GetBytes(rdf);
            MultipartFormDataContent multiContent = new MultipartFormDataContent();

            multiContent.Add(new ByteArrayContent(bytes), "rdfFile", "rdfFile.rdf");
            string      response    = CallPostApiFile("etl/data-validate", multiContent, token, "repositoryIdentifier=" + repositoryIdentifier.ToString());
            ShapeReport shapeReport = JsonConvert.DeserializeObject <ShapeReport>(response);

            if (!shapeReport.conforms && shapeReport.severity == "http://www.w3.org/ns/shacl#Violation")
            {
                throw new ValidationException(/*"Se han producido errores en la validación: " + */ JsonConvert.SerializeObject(shapeReport));
            }
        }
Esempio n. 17
0
 /// <summary>
 /// get an instance of <see cref="ITokenGainer"/>
 /// </summary>
 /// <param name="bearer">the location of token bearer, see <see cref="TokenBearer"/></param>
 /// <returns>an instance of <see cref="ITokenGainer"/></returns>
 public static ITokenGainer GetTokenGainer(TokenBearer bearer)
 {
     if (bearer == TokenBearer.Header)
     {
         return(new HeaderTokenGainer());
     }
     else if (bearer == TokenBearer.QueryString)
     {
         return(new QueryStringTokenGainer());
     }
     else
     {
         return(null);
     }
 }
Esempio n. 18
0
        public async Task <Order> GetById(Guid id, TokenBearer token)
        {
            var request = new HttpRequestMessage
            {
                Method     = HttpMethod.Get,
                RequestUri = new Uri(_configuration["APIGatewayUrl"] + "/order/" + id)
            };

            request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token.Token);

            var response = await _httpClient.SendAsync(request);

            response.EnsureSuccessStatusCode();
            var orderresponse = await response.Content.ReadAsStringAsync();

            return(JsonConvert.DeserializeObject <Order>(orderresponse));
        }
        /// <summary>
        /// Obtiene los parametros desde el appsettings.
        /// </summary>
        /// <param name="pTypeToken">Tipo del token.</param>
        /// <param name="pAccessToken">Token.</param>
        /// <returns></returns>
        private TokenBearer TokenAppsettings(string pTypeToken, string pAccessToken)
        {
            IDictionary environmentVariables = Environment.GetEnvironmentVariables();
            TokenBearer token = new TokenBearer();

            if (environmentVariables.Contains(pAccessToken) && environmentVariables.Contains(pTypeToken))
            {
                token.access_token = environmentVariables[pAccessToken] as string;
                token.token_type   = environmentVariables[pTypeToken] as string;
            }
            else
            {
                token.access_token = _configuration[pAccessToken];
                token.token_type   = _configuration[pTypeToken];
            }

            return(token);
        }
 public CallApiVirtualPath(CallTokenService tokenService, ConfigUrlService serviceUrl, ICallService serviceApi)
 {
     _serviceUrl = serviceUrl;
     _serviceApi = serviceApi;
     if (tokenService != null)
     {
         bool tokenCargado = false;
         while (!tokenCargado)
         {
             try
             {
                 _token       = tokenService.CallTokenApiDocumentacion();
                 tokenCargado = true;
             }
             catch (Exception ex)
             {
                 tokenCargado = false;
             }
         }
     }
 }
Esempio n. 21
0
        /// <summary>
        /// Hace una petición get
        /// </summary>
        /// <param name="urlBase">Url donde se encuentra el api</param>
        /// <param name="urlMethod">Url del método</param>
        /// <param name="token">token bearer de seguridad</param>
        public string CallGetApi(string urlBase, string urlMethod, TokenBearer token = null)
        {
            string result = "";
            HttpResponseMessage response = null;

            try
            {
                HttpClient client = new HttpClient();
                if (token != null)
                {
                    client.DefaultRequestHeaders.Add("Authorization", $"{token.token_type} {token.access_token}");
                }
                response = client.GetAsync($"{urlBase}{urlMethod}").Result;
                response.EnsureSuccessStatusCode();
                result = response.Content.ReadAsStringAsync().Result;
            }
            catch (HttpRequestException)
            {
                StringBuilder except = new StringBuilder();
                except.AppendLine($"Url del intento de llamada: {urlBase}{urlMethod} --------- error: ");
                if (!string.IsNullOrEmpty(response.Content.ReadAsStringAsync().Result))
                {
                    except.AppendLine(response.Content.ReadAsStringAsync().Result);
                    throw new HttpRequestException(except.ToString());
                }
                else
                {
                    except.AppendLine(response.ReasonPhrase);
                    throw new HttpRequestException(except.ToString());
                }
            }
            catch (Exception ex)
            {
                StringBuilder except = new StringBuilder();
                except.AppendLine($"Url del intento de llamada: {urlBase}{urlMethod} --------- error: ");
                except.AppendLine(ex.Message);
                throw new Exception(except.ToString());
            }
            return(result);
        }
Esempio n. 22
0
        /// <summary>
        /// Realiza la llamada para la obtención del token de acceso con el endpoint configurado en AuthorityGetToken
        /// </summary>
        /// <param name="stringData">Datos con el scope, el cliente id, el grantType y el secret</param>
        private TokenBearer CallTokenIdentity(string stringData)
        {
            var contentData = new StringContent(stringData, System.Text.Encoding.UTF8, "application/x-www-form-urlencoded");
            HttpResponseMessage response = null;

            try
            {
                HttpClient client = new HttpClient();
                client.Timeout = TimeSpan.FromDays(1);

                IDictionary environmentVariables = Environment.GetEnvironmentVariables();
                string      authority            = "";
                if (environmentVariables.Contains("Authority"))
                {
                    authority = environmentVariables["Authority"] as string;
                }
                else
                {
                    authority = _configuration["Authority"];
                }
                authority += "/connect/token";
                response   = client.PostAsync($"{authority}", contentData).Result;
                response.EnsureSuccessStatusCode();
                string      result = response.Content.ReadAsStringAsync().Result;
                TokenBearer token  = JsonConvert.DeserializeObject <TokenBearer>(result);
                return(token);
            }
            catch (HttpRequestException)
            {
                if (!string.IsNullOrEmpty(response.Content.ReadAsStringAsync().Result))
                {
                    throw new HttpRequestException(response.Content.ReadAsStringAsync().Result);
                }
                else
                {
                    throw new HttpRequestException(response.ReasonPhrase);
                }
            }
        }
Esempio n. 23
0
 private void LoadToken()
 {
     if (_token == null)
     {
         bool tokenCargado = false;
         while (!tokenCargado)
         {
             try
             {
                 //Stopwatch sw = new Stopwatch();
                 //sw.Start(); // Iniciar la medición.
                 _token       = _tokenService.CallTokenApiDocumentacion();
                 tokenCargado = true;
                 //sw.Stop();
                 //Log.Information($"llamar al token de documentacion : {sw.Elapsed.ToString("hh\\:mm\\:ss\\.fff")}\n");
             }
             catch (Exception ex)
             {
                 tokenCargado = false;
             }
         }
     }
 }
        /// <summary>
        /// Obtiene los parametros desde el appsettings.
        /// </summary>
        /// <param name="pTypeToken">Tipo del token.</param>
        /// <param name="pAccessToken">Token.</param>
        /// <returns></returns>
        private TokenBearer TokenAppsettings(string pTypeToken, string pAccessToken)
        {
            IDictionary environmentVariables = Environment.GetEnvironmentVariables();
            TokenBearer token = new TokenBearer();

            if (environmentVariables.Contains(pAccessToken) && environmentVariables.Contains(pTypeToken))
            {
                token.access_token = environmentVariables[pAccessToken] as string;
                token.token_type   = environmentVariables[pTypeToken] as string;
            }
            else
            {
                var builder = new ConfigurationBuilder()
                              .SetBasePath(Directory.GetCurrentDirectory())
                              .AddJsonFile("appsettings.json");

                IConfigurationRoot Configuration = builder.Build();
                token.access_token = Configuration[pAccessToken];
                token.token_type   = Configuration[pTypeToken];
            }

            return(token);
        }
Esempio n. 25
0
        public async Task <Order> CreateOrder(CartViewModel cartvm, TokenBearer token)
        {
            var orderMapped = MapCartToOrder(cartvm);
            var orderJSON   = JsonConvert.SerializeObject(orderMapped);

            var orderContent = new StringContent(orderJSON, System.Text.Encoding.UTF8, "application/json");

            //construct request with token
            var request = new HttpRequestMessage
            {
                Method     = HttpMethod.Post,
                Content    = orderContent,
                RequestUri = new Uri(_configuration["APIGatewayUrl"] + "/order/add")
            };

            request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token.Token);

            var response = await _httpClient.SendAsync(request);

            var orderResponse = await response.Content.ReadAsStringAsync();

            return(JsonConvert.DeserializeObject <Order>(orderResponse));
        }
        ///<summary>
        ///Hace llamadas Post
        ///</summary>
        ///<param name="urlMethod">url del método a llamar, esta url se encdaenará con url configurada</param>
        ///<param name="item">objeto a pasar</param>
        ///<param name="token">Token del tipo Bearer para incluir seguridad si hiciese falta a la llamada de las apis</param>
        public string CallPostApi(string urlMethod, object item, TokenBearer token = null)
        {
            string stringData            = JsonConvert.SerializeObject(item);
            var    contentData           = new StringContent(stringData, System.Text.Encoding.UTF8, "application/json");
            string result                = "";
            HttpResponseMessage response = null;

            try
            {
                HttpClient client = new HttpClient();
                if (token != null)
                {
                    client.DefaultRequestHeaders.Add("Authorization", $"{token.token_type} {token.access_token}");
                }
                client.Timeout = TimeSpan.FromDays(1);
                string url = _serviceUrl.GetUrl();
                response = client.PostAsync($"{url}{urlMethod}", contentData).Result;
                response.EnsureSuccessStatusCode();
                result = response.Content.ReadAsStringAsync().Result;
                return(result);
            }
            catch (HttpRequestException)
            {
                if (response.StatusCode.Equals(HttpStatusCode.BadRequest))
                {
                    throw new BadRequestException(response.Content.ReadAsStringAsync().Result);
                }
                else if (!string.IsNullOrEmpty(response.Content.ReadAsStringAsync().Result))
                {
                    throw new HttpRequestException(response.Content.ReadAsStringAsync().Result);
                }
                else
                {
                    throw new HttpRequestException(response.ReasonPhrase);
                }
            }
        }
        ///<summary>
        ///Simula realizar una llamada para la obtención de unos datos ficticios que harían esas llamadas
        ///</summary>
        ///<param name="urlMethod">método a llamar</param>
        public string CallGetApi(string urlMethod, TokenBearer token = null)
        {
            string xml = "";

            if (urlMethod.Contains("ListIdentifiers"))
            {
                xml = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?><OAI-PMH xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd\" xmlns=\"http://www.openarchives.org/OAI/2.0/\"><responseDate>2020-05-18T16:44:51Z</responseDate><request verb=\"ListIdentifiers\" metadataPrefix=\"rdf\" from=\"2020-05-17 17:05:04Z\" until=\"2020-05-19 17:05:04Z\">http://herc-as-front-desa.atica.um.es/oai-pmh-cvn/OAI_PMH</request><ListIdentifiers><header><identifier>100</identifier><datestamp>2020-05-18T15:04:53Z</datestamp><setSpec>cvn</setSpec></header></ListIdentifiers></OAI-PMH>";
            }
            else if (urlMethod.Contains("GetRecord"))
            {
                StringBuilder rdfFile = new StringBuilder();
                //rdfFile.Append("<? xml version = \"1.0\" encoding = \"utf - 8\" standalone = \"no\" ?>");
                rdfFile.Append("<OAI-PMH xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd\" xmlns=\"http://www.openarchives.org/OAI/2.0/\">");
                rdfFile.Append("<responseDate>2020-05-18T16:56:06Z</responseDate>");
                rdfFile.Append("<request verb=\"GetRecord\" identifier=\"1\" metadataPrefix=\"rdf\">http://herc-as-front-desa.atica.um.es/oai-pmh-cvn/OAI_PMH</request>");
                rdfFile.Append("<GetRecord>");
                rdfFile.Append("<record>");
                rdfFile.Append("<header>");
                rdfFile.Append("<identifier>1</identifier>");
                rdfFile.Append("<datestamp>2020-02-09T15:16:54Z</datestamp>");
                rdfFile.Append("<setSpec>cvn</setSpec>");
                rdfFile.Append("</header>");
                rdfFile.Append("<metadata>");
                rdfFile.Append("<rdf:RDF xmlns:bibo=\"http://purl.org/roh/mirror/bibo#\" xmlns:foaf=\"http://purl.org/roh/mirror/foaf#\" xmlns:obobfo=\"http://purl.org/roh/mirror/obo/bfo#\" xmlns:oboro=\"http://purl.org/roh/mirror/obo/ro#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:roh=\"http://purl.org/roh#\" xmlns:rohes=\"http://purl.org/rohes#\" xmlns:vcard=\"http://purl.org/roh/mirror/vcard#\" xmlns:vivo=\"http://purl.org/roh/mirror/vivo#\">");
                rdfFile.Append("	<rdf:Description rdf:about=\"http://graph.um.es/res/person/1\">");
                rdfFile.Append("		<rdf:type rdf:resource = \"http://purl.org/roh/mirror/foaf#Person\" />");
                rdfFile.Append("		<roh:hasRole rdf:nodeID=\"N13102d9d82124e479f8d7042a8fab61a\" />");
                rdfFile.Append("		<foaf:phone rdf:datatype=\"http://www.w3.org/2001/XMLSchema#string\">tel:666666666</foaf:phone>");
                rdfFile.Append("		<foaf:name rdf:datatype=\"http://www.w3.org/2001/XMLSchema#string\">Nombre Apellido</foaf:name>");
                rdfFile.Append("		<foaf:firstName rdf:datatype=\"http://www.w3.org/2001/XMLSchema#string\">Nombre</foaf:firstName>");
                rdfFile.Append("		<foaf:surname rdf:datatype=\"http://www.w3.org/2001/XMLSchema#string\">Apellido</foaf:surname>");
                rdfFile.Append("		<vivo:identifier rdf:datatype=\"http://www.w3.org/2001/XMLSchema#string\">Identificador 1</vivo:identifier>");
                rdfFile.Append("	</rdf:Description>");
                rdfFile.Append("	<rdf:Description rdf:nodeID=\"N13102d9d82124e479f8d7042a8fab61a\">");
                rdfFile.Append("		<vivo:relates rdf:resource=\"http://graph.um.es/res/project/1\" />");
                rdfFile.Append("		<vivo:dateTimeInterval rdf:nodeID=\"N2552ff6c9f41464d85917e5286ac26d6\" />");
                rdfFile.Append("		<roh:roleOf rdf:resource=\"http://graph.um.es/res/person/1\" />");
                rdfFile.Append("		<rdf:type rdf:resource=\"http://purl.org/roh/mirror/vivo#MemberRole\" />");
                rdfFile.Append("	</rdf:Description>");
                rdfFile.Append("	<rdf:Description rdf:about=\"http://graph.um.es/res/project/1\">");
                rdfFile.Append("		<roh:title rdf:datatype=\"http://www.w3.org/2001/XMLSchema#string\">IMPLICACIONES QUIMICAS Y BIOQUIMICAS EN EL COLOR Y AROMAS DEMOSTOS Y VINOS</roh:title>");
                rdfFile.Append("		<vivo:relatedBy rdf:nodeID=\"N92b3d38e204e40439f1ec47abd63b35e\" />");
                rdfFile.Append("		<rdf:type rdf:resource=\"http://purl.org/roh/mirror/vivo#Project\" />");
                rdfFile.Append("		<vivo:dateTimeInterval rdf:nodeID=\"Ncd7b021fabbd4f768a5c2f3869e85132\" />");
                rdfFile.Append("		<vivo:relates rdf:nodeID=\"N13102d9d82124e479f8d7042a8fab61a\" />");
                rdfFile.Append("		<roh:isSupportedBy rdf:nodeID=\"N0f320d4ca3184adb88ba7d1afdf624b1\" />");
                rdfFile.Append("	</rdf:Description>");
                rdfFile.Append("	<rdf:Description rdf:nodeID=\"N0f320d4ca3184adb88ba7d1afdf624b1\">");
                rdfFile.Append("		<roh:supports rdf:resource=\"http://graph.um.es/res/project/1\" />");
                rdfFile.Append("		<vivo:identifier rdf:datatype=\"http://www.w3.org/2001/XMLSchema#string\">PCT89-4</vivo:identifier>");
                rdfFile.Append("		<rdf:type rdf:resource=\"http://purl.org/roh#Funding\" />");
                rdfFile.Append("		<oboro:BFO_0000051 rdf:nodeID=\"N5c0b27570e19415188b29776607abf7d\" />");
                rdfFile.Append("	</rdf:Description>");
                rdfFile.Append("	<rdf:Description rdf:nodeID=\"N5c0b27570e19415188b29776607abf7d\">");
                rdfFile.Append("		<oboro:BFO_0000050 rdf:nodeID=\"N0f320d4ca3184adb88ba7d1afdf624b1\" />");
                rdfFile.Append("		<rdf:type rdf:resource=\"http://purl.org/roh#FundingAmount\" />");
                rdfFile.Append("		<roh:monetaryAmount rdf:datatype=\"http://www.w3.org/2001/XMLSchema#decimal\">21035.42</roh:monetaryAmount>");
                rdfFile.Append("	</rdf:Description>");
                rdfFile.Append("	<rdf:Description rdf:nodeID=\"N2552ff6c9f41464d85917e5286ac26d6\">");
                rdfFile.Append("		<rdf:type rdf:resource=\"http://purl.org/roh/mirror/vivo#DateTimeInterval\" />");
                rdfFile.Append("		<vivo:start rdf:nodeID=\"N87c73ed5cf5e4d6d979fc46f2872d1fd\" />");
                rdfFile.Append("	</rdf:Description>");
                rdfFile.Append("	<rdf:Description rdf:nodeID=\"N87c73ed5cf5e4d6d979fc46f2872d1fd\">");
                rdfFile.Append("		<rdf:type rdf:resource=\"http://purl.org/roh/mirror/vivo#DateTimeValue\" />");
                rdfFile.Append("		<vivo:dateTime rdf:datatype=\"http://www.w3.org/2001/XMLSchema#dateTime\">1990-01-01T00:00:00.000+01:00</vivo:dateTime>");
                rdfFile.Append("	</rdf:Description>");
                rdfFile.Append("	<rdf:Description rdf:about=\"http://graph.um.es/res/project/1\">");
                rdfFile.Append("		<roh:title rdf:datatype=\"http://www.w3.org/2001/XMLSchema#string\">IMPLICACIONES QUIMICAS Y BIOQUIMICAS EN EL COLOR Y AROMAS DEMOSTOS Y VINOS</roh:title>");
                rdfFile.Append("		<vivo:relatedBy rdf:nodeID=\"N92b3d38e204e40439f1ec47abd63b35e\" />");
                rdfFile.Append("		<rdf:type rdf:resource=\"http://purl.org/roh/mirror/vivo#Project\" />");
                rdfFile.Append("		<vivo:dateTimeInterval rdf:nodeID=\"Ncd7b021fabbd4f768a5c2f3869e85132\" />");
                rdfFile.Append("		<roh:isSupportedBy rdf:nodeID=\"N0f320d4ca3184adb88ba7d1afdf624b1\" />");
                rdfFile.Append("	</rdf:Description>");
                rdfFile.Append("	<rdf:Description rdf:nodeID=\"N92b3d38e204e40439f1ec47abd63b35e\">");
                rdfFile.Append("		<vivo:relates rdf:resource=\"http://graph.um.es/res/person/1\" />");
                rdfFile.Append("		<vivo:relates rdf:resource=\"http://graph.um.es/res/project/1\" />");
                rdfFile.Append("		<rdf:type rdf:resource=\"http://purl.org/roh/mirror/vivo#PrincipalInvestigatorRole\" />");
                rdfFile.Append("	</rdf:Description>");
                rdfFile.Append("	<rdf:Description rdf:nodeID=\"Ncd7b021fabbd4f768a5c2f3869e85132\">");
                rdfFile.Append("		<vivo:start rdf:nodeID=\"Na1caef70b2c54896a3a246a3c7033677\" />");
                rdfFile.Append("		<rdf:type rdf:resource=\"http://purl.org/roh/mirror/vivo#DateTimeInterval\" />");
                rdfFile.Append("	</rdf:Description>");
                rdfFile.Append("	<rdf:Description rdf:nodeID=\"Na1caef70b2c54896a3a246a3c7033677\">");
                rdfFile.Append("		<vivo:dateTime rdf:datatype=\"http://www.w3.org/2001/XMLSchema#dateTime\">1990-01-02T00:00:00.000+01:00</vivo:dateTime>");
                rdfFile.Append("		<rdf:type rdf:resource=\"http://purl.org/roh/mirror/vivo#DateTimeValue\" />");
                rdfFile.Append("	</rdf:Description>");
                rdfFile.Append("</rdf:RDF>");
                rdfFile.Append("</metadata>");
                rdfFile.Append("</record>");
                rdfFile.Append("</GetRecord>");
                rdfFile.Append("</OAI-PMH>");

                xml = rdfFile.ToString();
            }
            else if (urlMethod.Contains("ListMetadataFormats"))
            {
                xml = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>  <OAI-PMH xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd\" xmlns=\"http://www.openarchives.org/OAI/2.0/\">    <responseDate>2021-02-10T14:24:38Z</responseDate>    <request verb=\"ListMetadataFormats\">http://herc-as-front-desa.atica.um.es/oai-pmh-cvn/OAI_PMH</request>    <ListMetadataFormats>      <metadataFormat>        <metadataPrefix>rdf</metadataPrefix>      </metadataFormat>    </ListMetadataFormats>  </OAI-PMH>";
            }
            if (urlMethod.Contains("Identify"))
            {
                xml = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?><OAI-PMH xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd\" xmlns=\"http://www.openarchives.org/OAI/2.0/\"><responseDate>2021-03-04T16:26:09Z</responseDate><request verb=\"Identify\">http://herc-as-front-desa.atica.um.es/oai-pmh-cvn/OAI_PMH</request><Identify>      <repositoryName>OAI_PMH_CVN</repositoryName><baseURL>http://herc-as-front-desa.atica.um.es/oai-pmh-cvn/OAI_PMH</baseURL><protocolVersion>2.0</protocolVersion><adminEmail>[email protected]</adminEmail>      <earliestDatestamp>1987-02-16T00:00:00Z</earliestDatestamp><deletedRecord>no</deletedRecord><granularity>YYYY-MM-DDThh:mm:ssZ</granularity></Identify></OAI-PMH>";
            }

            return(xml);
        }
 public void CallDataValidate(string rdf, Guid repositoryIdentifier, TokenBearer token = null)
 {
 }
 public void CallDataPublish(string rdf, string jobId = null, bool discoverProcessed = false, TokenBearer token = null)
 {
 }
 public string CallPostApiFile(string urlMethod, MultipartFormDataContent item, TokenBearer token = null, string parameters = null)
 {
     return("");
 }