 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Graham Harris Guest
|
Posted: Thu Mar 29, 2007 9:39 am Post subject: Map is not rendered when no route is defined. Using MapPoint |
|
|
Hi
This is for anyone who has run into the following problem when rendering
a map with no route defined:
At least one of the following arguments is required. Argument:
specification.Route.CalculatedRepresentation,specification.Route.Specification
I have traced this to the fact that Delphi inserts the following into the
SOAP request:
<Route xsi:nil="true"/>
By inserting the following code:
procedure TForm1.HTTPRIORenderBeforeExecute(const MethodName: string;
var SOAPRequest: WideString);
var
ReplaceString, SearchString: WideString;
begin
ReplaceString := '><';
SearchString := '><Route xsi:nil="true"/><';
SOAPRequest := StringReplace(SOAPRequest, SearchString, ReplaceString,
[rfReplaceAll]);
end;
This apparently resolves the issue.
HTH
Graham Harris |
|
| Back to top |
|
 |
Jean-Marie Babet Guest
|
Posted: Thu Mar 29, 2007 10:28 pm Post subject: Re: Map is not rendered when no route is defined. Using MapP |
|
|
Hello Graham,
I'm making a note to research this but if you have more info. regarding
whether the importer mis-tagged something that's optional, please let me
know. D2007 did not handle xsd:choice properly [I've addressed that issues
since]. Basically, choice elements were not properly tagged as optional.
IOW, if 'Route' is marked as 'minOccurs="0"' or is an element of a <choice>
compositor node, the runtime should not send "<Route xsi:nil="true">" unless
you explicitly set the ".Route' property.
Cheers,
Bruneau. |
|
| Back to top |
|
 |
Jean-Marie Babet Guest
|
Posted: Fri Mar 30, 2007 2:02 am Post subject: Re: Map is not rendered when no route is defined. Using MapP |
|
|
Hello,
| Quote: | I have traced this to the fact that Delphi inserts the following into the
SOAP request:
Route xsi:nil="true"/
|
I grep for all instance of the 'Route' property and noticed that the
importer flags them all as optional - as in:
property Route: Route Index (IS_OPTN)
read FRoute '
write SetRoute
stored Route_Specified;
If you're using the runtime from D2006 or before, yes I can see the problem
as we had no support for 'minOccurs="0"' back then. As of D2007 (and D2007
updates ported back for D7/D2005/D2006) the runtime should refrain from
sending any optional property unless the property was explicitly specified
(the setter, SetRoute, sets a flag). So unless someone said xxxx.Route :=
nil, this should not happen with the latest runtime.
If this happened with the D2007 runtime update (or D2007 itself), please
forward me the snippet of code so I may investigate further.
Cheers,
Bruneau.
"Graham Harris" <ng (AT) bmsgharr (DOT) globalnet.co.uk> wrote in message
news:7c6eb66219a058c94005ad9b6757 (AT) newsgroups (DOT) borland.com...
| Quote: | Hi
This is for anyone who has run into the following problem when rendering
a map with no route defined:
At least one of the following arguments is required. Argument:
specification.Route.CalculatedRepresentation,specification.Route.Specificati |
on
| Quote: |
I have traced this to the fact that Delphi inserts the following into the
SOAP request:
Route xsi:nil="true"/
By inserting the following code:
procedure TForm1.HTTPRIORenderBeforeExecute(const MethodName: string;
var SOAPRequest: WideString);
var
ReplaceString, SearchString: WideString;
begin
ReplaceString := '><';
SearchString := '><Route xsi:nil="true"/><';
SOAPRequest := StringReplace(SOAPRequest, SearchString, ReplaceString,
[rfReplaceAll]);
end;
This apparently resolves the issue.
HTH
Graham Harris
|
|
|
| Back to top |
|
 |
Graham Harris Guest
|
Posted: Fri Mar 30, 2007 6:51 am Post subject: Re: Map is not rendered when no route is defined. Using MapP |
|
|
Hi Bruneau
Here is a code snippet of where I build up the map request before invoking
the render service:
MapSpec := MapSpecification.Create;
MapSpec.Options := MapOptions.Create;
MapSpec.Options.Format := ImageFormat.Create;
MapSpec.Options.Format.Height := Height;
MapSpec.Options.Format.Width := Width;
MapSpec.Options.Format.MimeType := 'image/jpeg';
MapSpec.Options.Zoom := 5;
MapSpec.Options.PreventIconCollisions := True;
MapSpec.Options.Style := DefaultStyle
MapSpec.DataSourceName := 'MapPoint.EU';
MapSpec.HideEntityTypes := 'All';
MapSpec.Route := Nil;
TIA
Graham Harris |
|
| Back to top |
|
 |
Jean-Marie Babet Guest
|
Posted: Fri Mar 30, 2007 11:23 pm Post subject: Re: Map is not rendered when no route is defined. Using MapP |
|
|
Hello,
Thank you.
Yes, that's what I suspected.
The importer generates:
property Route: Route Index (IS_OPTN) read FRoute write SetRoute stored
Route_Specified;
procedure MapSpecification.SetRoute(Index: Integer; const ARoute: Route);
begin
FRoute := ARoute;
FRoute_Specified := True;
end;
function MapSpecification.Route_Specified(Index: Integer): boolean;
begin
Result := FRoute_Specified;
end;
IOW, 'Route' is optional. By explicitly setting it to 'nil' with
| Quote: | MapSpec.Route := Nil;
|
...you're invoking 'SetRoute' and enabling the flag 'FRoute_Specified',
telling the runtime you want to serialize that field. Some frameworks rely
on whether an optional field is nil or not to determine whether to serialize
it. And when the field is also nillable, then they generate a additional
field named 'FieldNameSpecified' that you have to set. In some cases that
'xxxxSpecified' field is not automatically set by the setter
( see
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=114807 )
I opted to have the field automatically set by the Setter. However, that can
easily be changed since it's all controlled by the importer. In the case
above the runtime will calls the 'Route_Specified' method to determine
whether to serialize 'Route' or not. Whether 'Route_Specified' returns true
based on the FRoute_Specified flag, or whether 'Route' is nil, etc can be
changed.
I'm open to suggestions on how to best manage minOccurs="0" elements. This
area is new and can use some fine-tuning.
Cheers,
Bruneau. |
|
| Back to top |
|
 |
|
|
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
|
|