using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using CodeScales.Http; using CodeScales.Http.Methods; using CodeScales.Http.Entity; using CodeScales.Http.Entity.Mime; using CodeScales.Http.Common; using System.IO; using System.Text; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { HttpClient ht = new HttpClient(); HttpClient client = new HttpClient(); HttpPost postMethod = new HttpPost(new Uri("http://www.inspire-geoportal.eu/INSPIREValidatorService/resources/validation/inspire")); postMethod.Headers.Add("Authorisation", "text/html"); MultipartEntity multipartEntity = new MultipartEntity(); FileInfo fileInfo = new FileInfo(@"C:\Users\10033\Desktop\WebService\Metadata_test_Inspire_DM_MedYttäckning _och_Överensst_true_ISO19139.xml"); FileBody fileBody = new FileBody("Metadata_test_Inspire_DM_MedYttäckning _och_Överensst_true_ISO19139", "Metadata_test_Inspire_DM_MedYttäckning _och_Överensst_true_ISO19139.xml", fileInfo); StringBody stringBody = new StringBody(Encoding.UTF8, "Metadata_test_Inspire_DM_MedYttäckning _och_Överensst_true_ISO19139.xml", "text/html"); multipartEntity.AddBody(stringBody); postMethod.Entity = multipartEntity; multipartEntity.IsChunked = true; postMethod.Entity.IsChunked = true; //multipartEntity.AddBody(fileBody); CodeScales.Http.Methods.HttpResponse response = client.Execute(postMethod); Response.Write(EntityUtils.ToString(response.Entity)); Console.WriteLine("Response Code: " + response.ResponseCode); Console.WriteLine("Response Content: " + EntityUtils.ToString(response.Entity)); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)