BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Decimalseparator change on each SOAP call

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi WebServices SOAP
View previous topic :: View next topic  
Author Message
nisbus
Guest





PostPosted: Thu Apr 26, 2007 11:49 pm    Post subject: Decimalseparator change on each SOAP call Reply with quote



Hi,

I know this is an old bug but it is really annoying me now.
I have a Delphi 7 application that communicates with .NET web services
written in Delphi 8.
The problem is that after each call to the web service it seems that the
decimalseparator gets changed to '.' instead of the default ',' for my
locale.

Has there been a fix for this ?

Thanks,
nisbus
Back to top
nisbus
Guest





PostPosted: Fri Apr 27, 2007 12:49 am    Post subject: Re: Decimalseparator change on each SOAP call Reply with quote



I found the error in TypeTrans.pas

function TTypeTranslator.CastSoapToNative(Info: PTypeInfo; const
SoapData: WideString; NatData: Pointer; IsNull: Boolean): Boolean;
var
ParamTypeData: PTypeData;
begin
DecimalSeparator := '.';
etc.
end;

I changed it to:

function TTypeTranslator.CastSoapToNative(Info: PTypeInfo; const
SoapData: WideString; NatData: Pointer; IsNull: Boolean): Boolean;
var
ParamTypeData: PTypeData;
DS : char;
begin
DS := DecimalSeparator;
DecimalSeparator := '.';

***omitted code***

Decimalseparator := DS;
end;

This doesn't seem to have any adverse effect on how things work and the
problem is solved in my app.

Thanks,
nisbus

nisbus wrote:
Quote:
Hi,

I know this is an old bug but it is really annoying me now.
I have a Delphi 7 application that communicates with .NET web services
written in Delphi 8.
The problem is that after each call to the web service it seems that the
decimalseparator gets changed to '.' instead of the default ',' for my
locale.

Has there been a fix for this ?

Thanks,
nisbus
Back to top
Brian Andersen
Guest





PostPosted: Fri Apr 27, 2007 3:23 pm    Post subject: Re: Decimalseparator change on each SOAP call Reply with quote



Quote:
I changed it to:

function TTypeTranslator.CastSoapToNative(Info: PTypeInfo; const
SoapData: WideString; NatData: Pointer; IsNull: Boolean): Boolean;
var
ParamTypeData: PTypeData;
DS : char;
begin
DS := DecimalSeparator;
DecimalSeparator := '.';

***omitted code***

Decimalseparator := DS;
end;

It looks like you are on an old Soap version. Ask Bruneau for the lastest
release in this group (his is a CodeGear Developer). I did. And got it. The
CastSoapToNative looks as below. And the error is fixed in my version:

/Brian

function TTypeTranslator.CastSoapToNative(Info: PTypeInfo; const SoapData:
WideString; NatData: Pointer; IsNull: Boolean): Boolean;
var
ParamTypeData: PTypeData;
DefaultSeparator: Char;
begin
{ NOTE: The following in not threadsafe, as reported in QC:30095}
DefaultSeparator := DecimalSeparator;
DecimalSeparator := '.';
try
Result := True;
if IsNull and (Info.Kind = tkVariant) then
begin
Variant(PVarData(NatData)^) := NULL;
Exit;
end;
ParamTypeData := GetTypeData(Info);
case Info^.Kind of
tkInteger:
case ParamTypeData^.OrdType of
otSByte,
otUByte:
PByte(NatData)^ := StrToInt(Trim(SoapData));
otSWord,
otUWord:
PSmallInt(NatData)^ := StrToInt(Trim(SoapData));
otSLong,
otULong:
PInteger(NatData)^ := StrToInt(Trim(SoapData));
end;
tkFloat:
case ParamTypeData^.FloatType of
ftSingle:
PSingle(NatData)^ := StrToFloatEx(Trim(SoapData));
ftDouble:
begin
if Info = TypeInfo(TDateTime) then
PDateTime(NatData)^ := XMLTimeToDateTime(Trim(SoapData))
else
PDouble(NatData)^ := StrToFloatEx(Trim(SoapData));
end;

ftComp:
PComp(NatData)^ := StrToFloatEx(Trim(SoapData));
ftCurr:
PCurrency(NatData)^ := StrToFloatEx(Trim(SoapData));
ftExtended:
PExtended(NatData)^ := StrToFloatEx(Trim(SoapData));
end;
tkWString:
PWideString(NatData)^ := SoapData;
tkString:
PShortString(NatData)^ := SoapData;
tkLString:
PString(NatData)^ := SoapData;
tkChar:
if SoapData <> '' then
PChar(NatData)^ := Char(SoapData[1]);
tkWChar:
if SoapData <> '' then
PWideChar(NatData)^ := WideChar(SoapData[1]);
tkInt64:
PInt64(NatData)^ := StrToInt64(Trim(SoapData));

tkEnumeration:
{ NOTE: Here we assume enums to be byte-size; make sure (specially
for C++)
that enums have generated with the proper size }
PByte(NatData)^ := GetEnumValueEx(Info, Trim(SoapData));
tkClass:
;
tkSet,
tkMethod,

tkArray,
tkRecord,
tkInterface,

tkDynArray:
raise ETypeTransException.CreateFmt(SUnexpectedDataType, [
KindNameArray[Info.Kind]] );
tkVariant:
CastSoapToVariant(Info, SoapData, NatData);
end;
finally
DecimalSeparator := DefaultSeparator;
end;
end;
Back to top
Jean-Marie Babet
Guest





PostPosted: Sat Apr 28, 2007 12:09 am    Post subject: Re: Decimalseparator change on each SOAP call Reply with quote

Hello,

As Brian mentioned, this was addressed first with a try/finally. However,
the latest runtime does not even touch DecimalSeparator anymore. We use
FloatToStr/StrToFloat with a TFormatSettings.

For the latest runtime see the following link:

http://codecentral.codegear.com/Item/24535

Cheers,

Bruneau.
Back to top
nisbus
Guest





PostPosted: Sat Apr 28, 2007 2:17 am    Post subject: Re: Decimalseparator change on each SOAP call Reply with quote

Thank you,

I downloaded the update and replaced the old ones with the new ones (why
do I need to own the old ones?)
I also replaced the WSDLIntf.exe with the new one (I couldn't figure out
how to run it from Delphi without replacing the old one.)

It all seems to work fine but it leaves me with another question that I
thought would be fixed with the new WSDL importer but turns out to be a
bug in me Smile :

When I import my own web services I'm always missing the
"InvRegistry.RegisterInvokeOptions(TypeInfo(TWEBService), ioDocument);"
line from my imported file.
I tried importing web services that I didn't write myself and then it
isn't missing.
If I don't include this line my web service calls don't send any
parameters so I always have to add it manually.
I wrote my web service in Delphi 8 so is there something I'm missing
from there?

Thank you,
nisbus

Jean-Marie Babet wrote:
Quote:
Hello,

As Brian mentioned, this was addressed first with a try/finally. However,
the latest runtime does not even touch DecimalSeparator anymore. We use
FloatToStr/StrToFloat with a TFormatSettings.

For the latest runtime see the following link:

http://codecentral.codegear.com/Item/24535

Cheers,

Bruneau.

Back to top
Jean-Marie Babet
Guest





PostPosted: Sat Apr 28, 2007 2:26 am    Post subject: Re: Decimalseparator change on each SOAP call Reply with quote

Hello,

Quote:
I downloaded the update and replaced the old ones with the new ones (why
do I need to own the old ones?)

You don't need to keep around the files the runtime update replaces other
than for backup purposes - in case the new files introduce a regression.


Quote:
When I import my own web services I'm always missing the
"InvRegistry.RegisterInvokeOptions(TypeInfo(TWEBService), ioDocument);"
line from my imported file.

This is a bug that happens with earlier versions of the importer and .NET
2.0 (and above) services. I've explained that .NET services changed they way
they describe the style of the service. The new approach is just as correct
as the previous one; however, the importer only detected the previous one.
If you'd like more details see the following link:

http://groups.google.com/group/borland.public.delphi.webservices.soap/msg/80cd0981c7018e5b

The latest importer should address this issue.

Cheers,

Bruneau.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi WebServices SOAP All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.