0
I am trying to change the registration of my bank through a web service in java Rest, the tests in the webservice worked, but in the client I am having problem to work.
Note: Using Delphi XE8(Client) and Netbeans(WS))
WS:
@PUT
@Consumes(MediaType.APPLICATION_JSON)
@Path ("Banco/put/{codigo}")
public String putBanco(@PathParam("codigo") int codigo, String nome) {
BancoCTR ctr = new BancoCTR();
ctr.setBcoNome(nome);
BancoDAO dao = new BancoDAO();
String resposta = dao.editBanco(codigo, ctr);
Gson gson = new Gson();
return gson.toJson(resposta);
}
When I do the direct test, it works:
but I have a doubt, public String putBanco(@PathParam("codigo") int código, String nome)
Pathparam gives me access to this variable "code", but how I will have access to the variable "name" in the client?
Client:
procedure TForm1.btn2Click(Sender: TObject);
var
LJson: TJSONValue;
begin
rstrspns1.RootElement := 'object';
with rstrqst1 do
begin
Resource := '/Banco/put/{codigo}';
Method := rmPUT;
Params.AddUrlSegment('codigo', edt1.Text);
Params.AddItem('nome', edt2.Text, TRESTRequestParameterKind.pkGETorPOST);
Execute;
LJson := Response.JSONValue As TJSONObject;
MessageDlg(LJson.ToString, mtInformation, [mbOK], 0);
end;
end;
thought I’d use Params.AddItem('nome', edt2.Text, TRESTRequestParameterKind.pkGETorPOST);
to access the name variable, but when I run I get the errors:
when having debug:
the error occurs on the line Execute;