Missing value for parameter

hi folks, well im testing the xdata atm, just doing the classic hello
world example well is actually a Sum(a + b) example and everything is
great when i use the xdataclient in other delphi application.

The
problem im facing is when i try to call the service using a external
http requester tool, well i usually test my rest server in php with one
of this tools: HttpResquest (Firefox add-on) or Advanced Rest Client
(Chrome extension),  but both are faling when i call the xdata service.

what i have so far is:

  [ServiceContract]
  IMyService = interface(IInvokable)
    ['{BAD477A2-86EC-45B9-A1B1-C896C58DD5E0}']
    function Sum(A, B : Integer) : Integer;
  end;

and this is what i get basically:

Status
400 Bad Request
Request headers 
<div response_view_erspanel="" style="align-items: flex-start; display: -webkit-flex; flex-direction: column;">
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36
Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
Content-Type: application/json 
Accept: /
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8
Response headers 
<div response_view_erspanel="" style="align-items: flex-start; display: -webkit-flex; flex-direction: column;">
Content-Length: 120 
Content-Type: application/json 
Server: Microsoft-HTTPAPI/2.0 
Date: Wed, 28 Jan 2015 16:59:57 GMT 
<div response_view_result="" style="margin-top: 10px; margin-right: 5px; align-items: center; display: -webkit-; -webkit--orient: vertical; -webkit--flex: 1;">
{
<div -element="0" style=": relative; white-space: nowrap; margin-bottom: 5px; word-wrap: break-word; color: rgb0, 0, 0; font-family: monospace; font-size: 13.3333330154419px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-trans: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin-left: 25px; : rgba254, 254, 254, 0.992157;">error: 
{
<div -element="1" style=": relative; white-space: nowrap; margin-bottom: 5px; word-wrap: break-word; margin-left: 25px;">code: "MissingParameter"
<div -element="2" style=": relative; white-space: nowrap; margin-bottom: 5px; word-wrap: break-word; margin-left: 25px;">message: "Missing value for parameter "A""
}
<div -toggle="0" style=": ; top: 0px; left: -9px; font-size: 14px; cursor: pointer; font-weight: bold;">-
}
so
the question is, im missing something with my service, do xdata can be
access by other languages instead of delphi, are there any specific
header/parameter/encode i should pass when i made the resquest?

thx in advance

You must provide the parameters to the service method in json format, according to the manual:


http://www.tmssoftware.biz/business/xdata/doc/web/index.html?invoking_operations_using_http.htm

Have you checked those?

thx for the answer, yeah i miss that part, now is everything working.

Hi!

I have a similar problem. The link you provided (Wagner) gives a wrong page.

If I set the method as GET, then works, but if set as POST, I get the bad request error

    "error": {
        "code": "MissingParameter",
        "message": "Missing value for parameter \"UserName\""
    }

Probably is just a small issue, but I can't find it.. :)

Here is the updated page explaining how parameter binding works:
https://doc.tmssoftware.com/biz/xdata/guide/service.html#parameter-binding

You should provide the code where you declare your method in service operation. But if you didn't explicitly the binding method, then if the method is GET, then the parameter must be passed in query string, if the method is POST it must be passed in JSON body.

1 Like