I'm trying to change my bank's registry via a webservice rest in java, the tests in webservice worked, but on the client I'm having trouble working.
Note: I use 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 test, it is working:
ButIhaveaquestion,publicStringputBanco(@PathParam("codigo") int código, String nome)
PathParam causes me to have access to this variable "code", but how will I have access to 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;
I thought of using Params.AddItem('nome', edt2.Text, TRESTRequestParameterKind.pkGETorPOST);
to get access to variable name, but when I run I get errors:
Whendebugging:
erroroccursonlineExecute;