ASP.NET - webservice,Rest,ASP.net - Asked By abinav shankar on 02-Nov-11 08:35 AM

hi i have used the following code to send the file using multipart post and i am getting the responsecode as 500 pl tell me what is wrong in my code

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));
    }
}

Peter Bromberg replied to abinav shankar on 02-Nov-11 11:21 AM
Check the info URL for the service:   http://www.inspire-geoportal.eu/INSPIREValidatorService/?WSDL