Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: XE10 Datasnap REST client delete null string parameter and shift value



Permlink Replies: 3 - Last Post: Nov 21, 2015 6:03 AM Last Post By: Roberto Fiume Threads: [ Previous | Next ]
Roberto Fiume

Posts: 9
Registered: 2/22/14
XE10 Datasnap REST client delete null string parameter and shift value
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 14, 2015 4:07 AM
This example is for demostration error.
In the datasnap REST Server, declared this function :

TServerMethods1 = class(TDataModule)
private
public
function EchoString(A,B: string; const C: Integer): string;
end;

......

function TServerMethods1.EchoString(A,B: string; const C: Integer): string;
begin
if c= 1 then
Result := a + b
else
Result := 'b'
end;

In the client application generate client rest code by IDE and call the function:
procedure TForm3.Button1Click(Sender: TObject);
begin
ClientModule1.ServerMethods1Client.EchoString('TEST','',10);
end;

Into the server function. received this:
A = 'TEST'
B= '10' <------- This is the C parameters
C=0

If i call :ClientModule1.ServerMethods1Client.EchoString('TEST','HALLO',10);
Work fine.
How to pass null or '' string paramaters?

This example working in XE7 and XE8, only XE10 has this effect.

Why?

thx
Roby

Edited by: Roberto Fiume on Oct 14, 2015 5:16 AM

Edited by: Roberto Fiume on Oct 14, 2015 6:49 AM

Edited by: Roberto Fiume on Oct 14, 2015 1:25 PM
Roberto Fiume

Posts: 9
Registered: 2/22/14
Re: XE10 Datasnap REST Server ingore null string parameter and shift value
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 14, 2015 7:33 AM   in response to: Roberto Fiume in response to: Roberto Fiume
I have found into the uses System.Net.URLClient function TURI.EncodePath(const NewPath: string): string;
This:
LINE: 1080

Result := '/';
LSubPaths := NewPath.Split([Char('/')]);
for I := 0 to Length(LSubPaths) - 1 do
begin
if LSubPaths[I] <> '' then <----------------------------------------------------------------------------WHY ?
Result := Result + Encode(LSubPaths[I]) + '/';
end;

If pass blank parameter is ignored. Why ?

If execute in the browser this: http://localhost:8080/datasnap/rest/TServerMethods1/Echostring/TEST//10, work fine.
How to resolve this?


Roberto Fiume wrote:
This example is for demostration error.
In the datasnap REST Server, declared this function :

TServerMethods1 = class(TDataModule)
private
public
function EchoString(A,B: string; const C: Integer): string;
end;

......

function TServerMethods1.EchoString(A,B: string; const C: Integer): string;
begin
if c= 1 then
Result := a + b
else
Result := 'b'
end;

In the client application generate client rest code by IDE and call the function:
procedure TForm3.Button1Click(Sender: TObject);
begin
ClientModule1.ServerMethods1Client.EchoString('TEST','',10);
end;

Into the server function. received this:
A = 'TEST'
B= '10' <------- This is the C parameters
C=0

If i call :ClientModule1.ServerMethods1Client.EchoString('TEST','HALLO',10);
Work fine.
How to pass null or '' string paramaters?

This example working in XE7 and XE8, only XE10 has this effect.

Why?

thx
Roby

Edited by: Roberto Fiume on Oct 14, 2015 5:16 AM

Edited by: Roberto Fiume on Oct 14, 2015 6:49 AM

Edited by: Roberto Fiume on Oct 14, 2015 7:34 AM

Edited by: Roberto Fiume on Oct 14, 2015 1:23 PM
edmjunio edmjunio

Posts: 2
Registered: 7/6/05
Re: XE10 Datasnap REST client delete null string parameter and shift value
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 11, 2015 5:50 AM   in response to: Roberto Fiume in response to: Roberto Fiume
Roberto Fiume wrote:
This example is for demostration error.
In the datasnap REST Server, declared this function :

TServerMethods1 = class(TDataModule)
private
public
function EchoString(A,B: string; const C: Integer): string;
end;

......

function TServerMethods1.EchoString(A,B: string; const C: Integer): string;
begin
if c= 1 then
Result := a + b
else
Result := 'b'
end;

In the client application generate client rest code by IDE and call the function:
procedure TForm3.Button1Click(Sender: TObject);
begin
ClientModule1.ServerMethods1Client.EchoString('TEST','',10);
end;

Into the server function. received this:
A = 'TEST'
B= '10' <------- This is the C parameters
C=0

If i call :ClientModule1.ServerMethods1Client.EchoString('TEST','HALLO',10);
Work fine.
How to pass null or '' string paramaters?

This example working in XE7 and XE8, only XE10 has this effect.

Why?

thx
Roby

Edited by: Roberto Fiume on Oct 14, 2015 5:16 AM

Edited by: Roberto Fiume on Oct 14, 2015 6:49 AM

Edited by: Roberto Fiume on Oct 14, 2015 1:25 PM

I have the same problem on upgrade the xe7 to x10 seattle.
Roberto Fiume

Posts: 9
Registered: 2/22/14
Re: XE10 Datasnap REST client delete null string parameter and shift value
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 21, 2015 5:37 AM   in response to: edmjunio edmjunio in response to: edmjunio edmjunio
It was resolved with the update 1?

edmjunio edmjunio wrote:
Roberto Fiume wrote:
This example is for demostration error.
In the datasnap REST Server, declared this function :

TServerMethods1 = class(TDataModule)
private
public
function EchoString(A,B: string; const C: Integer): string;
end;

......

function TServerMethods1.EchoString(A,B: string; const C: Integer): string;
begin
if c= 1 then
Result := a + b
else
Result := 'b'
end;

In the client application generate client rest code by IDE and call the function:
procedure TForm3.Button1Click(Sender: TObject);
begin
ClientModule1.ServerMethods1Client.EchoString('TEST','',10);
end;

Into the server function. received this:
A = 'TEST'
B= '10' <------- This is the C parameters
C=0

If i call :ClientModule1.ServerMethods1Client.EchoString('TEST','HALLO',10);
Work fine.
How to pass null or '' string paramaters?

This example working in XE7 and XE8, only XE10 has this effect.

Why?

thx
Roby

Edited by: Roberto Fiume on Oct 14, 2015 5:16 AM

Edited by: Roberto Fiume on Oct 14, 2015 6:49 AM

Edited by: Roberto Fiume on Oct 14, 2015 1:25 PM

I have the same problem on upgrade the xe7 to x10 seattle.

Edited by: Roberto Fiume on Nov 21, 2015 6:02 AM
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02