Webservice REST POST error request

Asked

Viewed 1,749 times

0

When making the request for POST is returned me this error message:

 O servidor remoto devolveu um erro: (400) Pedido incorrecto.

Iservice finds - if closed this way:

[WebInvoke(Method = "POST", UriTemplate = "insert/?id={id}&v={v}&dt={dt}&qt={qt}",
            RequestFormat = WebMessageFormat.Xml,
            ResponseFormat = WebMessageFormat.Xml)]
        [OperationContract]
        bool Insert(int id,int v, string dt, int qt);

and the Request I make as follows:

string uploadUrl = @"http://url/ServicePedido.svc/insert/?id=" + id + "&v=" + vim + "&dt=" + daregisto + "&qt=" + quantidade;
                WebRequest addRequest = WebRequest.Create(uploadUrl);
                addRequest.Method = "POST";
                addRequest.ContentLength = 0;
                WebResponse addResponse = addRequest.GetResponse();
  • What is your "Registeredroute" at the beginning of the application? Also, although I’m not sure, I think "/?" can be problematic...normally was was /insert?id=1

  • I mean, the template too (usually) was insert?id={id}&v={v}&dt={dt}&qt={qt}

1 answer

1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.