| View previous topic :: View next topic |
| Author |
Message |
Graham Harris Guest
|
Posted: Thu Mar 29, 2007 11:13 am Post subject: New problem with MapPoint.NET |
|
|
Hi
I have an interesting problem with the above webservice. If I use the wsdl
import from Delphi 2007 and build it in Delphi 2007 I get the following error:
---------------------------
Error
---------------------------
ERemotableException Server was unable to read request. --> There is an error
in XML document (12, 1177). --> The specified type was not recognized: name='ViewByBoundingLocations',
namespace='urn:mappoint', at <MapView xmlns='http://s.mappoint.net/mappoint-30/'>.
---------------------------
OK
---------------------------
Then when I build the application in Delphi 2005 I do not get the error.
Then when I use the Delphi 2005 import in Delphi 2007 I get the error.
The ViewByBoundingLocations in both is defined as:
ViewByBoundingLocations = class(MapView)
private
FLocation: ArrayOfLocation;
published
property Locations: ArrayOfLocation read FLocation write FLocation;
end;
TIA
Graham Harris |
|
| Back to top |
|
 |
Jean-Marie Babet Guest
|
Posted: Thu Mar 29, 2007 10:18 pm Post subject: Re: New problem with MapPoint.NET |
|
|
Hello,
This indicates that the runtime does not have a type registered for this
name/namespace. This will happen if 'ViewByBoundingLocations' was added
*manually* but the corresponding registration for it was not added [If you
don't register a type, we assign it a default name/namespace - that's fine
for Servers but not for Client where the WSDL dictates the name/namespace].
How was ViewByBoundingLocations generated? If it was by the WSDL importer,
there's a problem if the importer did not register the type.
Cheers,
Bruneau. |
|
| Back to top |
|
 |
Jean-Marie Babet Guest
|
Posted: Fri Mar 30, 2007 1:20 am Post subject: Re: New problem with MapPoint.NET |
|
|
Hello,
It seems that the declaration was added by hand and no registration code was
added. Here's what the current importer generates:
//
************************************************************************ //
// XML : ViewByBoundingLocations, global, <complexType>
// Namespace : http://s.mappoint.net/mappoint-30/
//
************************************************************************ //
ViewByBoundingLocations = class(MapView)
private
FLocations: ArrayOfLocation;
FLocations_Specified: boolean;
procedure SetLocations(Index: Integer; const AArrayOfLocation:
ArrayOfLocation);
function Locations_Specified(Index: Integer): boolean;
public
destructor Destroy; override;
published
property Locations: ArrayOfLocation Index (IS_OPTN) read FLocations
write SetLocations stored Locations_Specified;
end;
And the corresponding registration:
RemClassRegistry.RegisterXSClass(ViewByBoundingLocations,
'http://s.mappoint.net/mappoint-30/', 'ViewByBoundingLocations');
The above line is missing is the mappoint.pas you posted. That should remedy
the problem. It tells the runtime what class can handle this name/namespace
combination.
Cheers,
Bruneau.
PS: Also not the IS_OPTN. It's not the 'Route' property you mentioned in the
other post but that's the flag that determines whether we let it go or send
a nil node if the property is not set. I noticed that was missing in your
definition. |
|
| Back to top |
|
 |
Graham Harris Guest
|
Posted: Fri Mar 30, 2007 6:53 am Post subject: Re: New problem with MapPoint.NET |
|
|
Hi Bruneau
As your next post indicates it was added mannually as the WSDL importer does
not seem to pick it up.
Thanks
Graham Harris
| Quote: | Hello,
This indicates that the runtime does not have a type registered for
this name/namespace. This will happen if 'ViewByBoundingLocations' was
added *manually* but the corresponding registration for it was not
added [If you don't register a type, we assign it a default
name/namespace - that's fine for Servers but not for Client where the
WSDL dictates the name/namespace].
How was ViewByBoundingLocations generated? If it was by the WSDL
importer, there's a problem if the importer did not register the type.
Cheers,
Bruneau.
|
|
|
| Back to top |
|
 |
Graham Harris Guest
|
Posted: Fri Mar 30, 2007 7:03 am Post subject: Re: New problem with MapPoint.NET |
|
|
Hi Bruneau
Is that for Delphi 2007?
And is the class body is as follows (I assume):
procedure ViewByBoundingLocations.SetLocations(Index: Integer;
const AArrayOfLocation: ArrayOfLocation);
begin
FLocations := AArrayOfLocation;
FLocations_Specified := True;
end;
destructor ViewByBoundingLocations.Destroy;
var
i: Integer;
begin
for i := 0 to Length(FLocations) do
FLocations[i].Free;
SetLength(FLocations, 0);
inherited;
end;
function ViewByBoundingLocations.Locations_Specified(Index: Integer): boolean;
begin
Result := FLocations_Specified;
end;
TIA
Grarham Harris |
|
| Back to top |
|
 |
Jean-Marie Babet Guest
|
Posted: Fri Mar 30, 2007 10:57 pm Post subject: Re: New problem with MapPoint.NET |
|
|
Hello,
The importer does not emit the type because the importer *sees* that it's
not used by any of the operation exposed by the service. That's a flaw for
polymorphic types as the service may only refer to base types while defining
a host of derived ones. I've fixed the importer to address this issue couple
weeks ago: A type considers itself 'used' even if no one refers to it as
long as there's a reference to its base type.
In the mean time you can use the -Ot+ to tell the importer to emit all types
encountered irrespective of whether they are referred to or not. This will
ensure that you not only have the type but you also have the XML information
needed for the runtime to know how to convert that type to and from XML.
Cheers,
Bruneau. |
|
| Back to top |
|
 |
Jean-Marie Babet Guest
|
Posted: Fri Mar 30, 2007 11:01 pm Post subject: Re: New problem with MapPoint.NET |
|
|
Almost - tweak the for loop to go until "Length(FLocations)-1":
| Quote: | destructor ViewByBoundingLocations.Destroy;
var
i: Integer;
begin
for i := 0 to Length(FLocations) do
|
The rest is good.
Cheers,
Bruneau. |
|
| Back to top |
|
 |
|