Hi Kenneth,
I solved the problem. I write you the solution, in the hope that it can be
useful.

The error is generated because in my XML template were missing the nodes

<PrintLayout>
    <ResourceId></ResourceId>
</PrintLayout>

as childs of <Command xsi:type="PrintCommandType"> node, even if these nodes
are not generated from MGMaestro saving a new WebLayout as XML, and the
PrintLayout element is descripted as optional (minOccurs="0") in
WebLayout-1.0.0.xsd schema file.


Thanks for your help.
Fabio

------------------------------------------------------------------------------------------------------


sekko970 wrote:
> 
> This is the result of posting:
> 
>   <?xml version="1.0" encoding="UTF-8" ?> 
> - <ResourceList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:noNamespaceSchemaLocation="ResourceList-1.0.0.xsd">
> - <ResourceDocument>
>   <ResourceId>Library://MyApp/AppLayouts/MyLayout.WebLayout</ResourceId> 
>   <Depth>3</Depth> 
>   <Owner>Administrator</Owner> 
>   <CreatedDate>2009-03-04T15:50:26Z</CreatedDate> 
>   <ModifiedDate>2009-03-04T17:02:27Z</ModifiedDate> 
> - <ResourceDocumentHeader
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:noNamespaceSchemaLocation="ResourceDocumentHeader-1.0.0.xsd">
> - <Security xsi:noNamespaceSchemaLocation="ResourceSecurity-1.0.0.xsd">
>   <Inherited>true</Inherited> 
> - <Groups>
> - <Group>
>   <Name>Everyone</Name> 
>   <Permissions>r,w</Permissions> 
>   </Group>
>   </Groups>
>   </Security>
>   </ResourceDocumentHeader>
>   </ResourceDocument>
>   </ResourceList>
> 
> I also found that the error is originated if the XML has nodes like
> <Function>Command</Function>; if the XML has nodes like
> <Function>Separator</Function>, there aren't errors.
> 
> 
> Fabio
> 
> ------------------------------------------------------------------------------------------------------
> 
> 
> Kenneth Skovhede, GEOGRAF A/S wrote:
>> 
>> Have you tried posting the document to the webform?
>> http://localhost/mapguide/mapagent/index.html
>> 
>> Regards, Kenneth Skovhede, GEOGRAF A/S
>> 
>> 
>> 
>> sekko970 skrev:
>>> Dear all,
>>> I just found the cause of my problem.
>>>
>>> My web-layout xml template is a copy of a new layout XML structure
>>> created
>>> from MGMaestro:
>>>
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <WebLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>>> xsi:noNamespaceSchemaLocation="WebLayout-1.0.0.xsd">
>>>     <Title>MyMapTitle</Title>
>>>     <Map>
>>>             <ResourceId>MyMap.MapDefinition</ResourceId>
>>>             <HyperlinkTarget>TaskPane</HyperlinkTarget>
>>>     </Map>
>>>     <ToolBar>
>>>             <Visible>true</Visible>
>>>             <Button xsi:type="CommandItemType">
>>>                     <Function>Command</Function>
>>>                     <Command>Print</Command>
>>>             </Button>
>>>                           .............
>>>     </ToolBar>
>>>     <InformationPane>
>>>             <Visible>true</Visible>
>>>             <Width>200</Width>
>>>             <LegendVisible>true</LegendVisible>
>>>             <PropertiesVisible>true</PropertiesVisible>
>>>     </InformationPane>
>>>     <ContextMenu>
>>>             <Visible>true</Visible>
>>>             <MenuItem xsi:type="CommandItemType">
>>>                     <Function>Command</Function>
>>>                     <Command>Select</Command>
>>>             </MenuItem>
>>>                          .............
>>>     </ContextMenu>
>>>     <TaskPane>
>>>             <Visible>true</Visible>
>>>             <Width>280</Width>
>>>             <TaskBar>
>>>                     <Visible>true</Visible>
>>>                     <Home>
>>>                             <Name>Home</Name>
>>>                             <Tooltip>Return to home task page</Tooltip>
>>>                             <Description>Return to home task 
>>> page</Description>
>>>                             <ImageURL>../stdicons/icon_home.gif</ImageURL>
>>>                     
>>> <DisabledImageURL>../stdicons/icon_home_disabled.gif</DisabledImageURL>
>>>                     </Home>
>>>                     <Forward>
>>>                             <Name>Forward</Name>
>>>                             <Tooltip>Forward to next task page</Tooltip>
>>>                             <Description>Forward to next task 
>>> page</Description>
>>>                             
>>> <ImageURL>../stdicons/icon_forward.gif</ImageURL>
>>>                     
>>> <DisabledImageURL>../stdicons/icon_forward_disabled.gif</DisabledImageURL>
>>>                     </Forward>
>>>                     <Back>
>>>                             <Name>Back</Name>
>>>                             <Tooltip>Return to previous task page</Tooltip>
>>>                             <Description>Return to previous task 
>>> page</Description>
>>>                             <ImageURL>../stdicons/icon_back.gif</ImageURL>
>>>                     
>>> <DisabledImageURL>../stdicons/icon_back_disabled.gif</DisabledImageURL>
>>>                     </Back>
>>>                     <Tasks>
>>>                             <Name>Tasks</Name>
>>>                             <Tooltip>Task list</Tooltip>
>>>                             <Description>View a list of available 
>>> tasks</Description>
>>>                             <ImageURL>../stdicons/icon_tasks.gif</ImageURL>
>>>                     
>>> <DisabledImageURL>../stdicons/icon_tasks_disabled.gif</DisabledImageURL>
>>>                     </Tasks>
>>>                     <MenuButton xsi:type="CommandItemType">
>>>                             <Function>Command</Function>
>>>                             <Command>Measure</Command>
>>>                     </MenuButton>
>>>                                       .............
>>>             </TaskBar>
>>>     </TaskPane>
>>>     <StatusBar>
>>>             <Visible>true</Visible>
>>>     </StatusBar>
>>>     <ZoomControl>
>>>             <Visible>true</Visible>
>>>     </ZoomControl>
>>>     <CommandSet>
>>>             <Command xsi:type="BasicCommandType">
>>>                     <Name>Pan</Name>
>>>                     <Label>Pan</Label>
>>>                     <Tooltip>Pan mode</Tooltip>
>>>                     <Description>Drag the map to view areas out of 
>>> range</Description>
>>>                     <ImageURL>../stdicons/icon_pan.gif</ImageURL>
>>>             
>>> <DisabledImageURL>../stdicons/icon_pan_disabled.gif</DisabledImageURL>
>>>                     <TargetViewer>All</TargetViewer>
>>>                     <Action>Pan</Action>
>>>             </Command>
>>>                           .............
>>>     </CommandSet>
>>> </WebLayout>
>>>
>>>
>>> If the XML layout definition contains a <button> node chilld of
>>> <toolbar>
>>> node, or a <MenuItem> node chilld of <ContextMenu> node, or a
>>> <MenuButton>
>>> chilld of <TaskPane><TaskBar> node, or a <Command> node chilld of
>>> <CommandSet> node, it is generated the following error:
>>>
>>> The type 'OSGeo.MapGuide.MgNullArgumentException' nell'assembly
>>> 'MapGuideDotNetApi, Version = 2.0.2.3011, Culture = neutral,
>>> PublicKeyToken
>>> = null' is not marked as serializable.
>>>
>>>
>>> How can I fix it?
>>> Thanks in advance.
>>> Fabio
>>>
>>>
>>> ------------------------------------------------------------------------------------------------------
>>>
>>>
>>> Kenneth Skovhede, GEOGRAF A/S wrote:
>>>   
>>>> There are/were problems reading data using the MgByteReader, as it
>>>> would 
>>>> not return more than 8K.
>>>> You are using the native API, which, IMO, has some quirks.
>>>> Maestro uses the http interface to store the file, so that is
>>>> equivalent 
>>>> to posting using the webform.
>>>>
>>>> Regards, Kenneth Skovhede, GEOGRAF A/S
>>>>
>>>>
>>>>
>>>> sekko970 skrev:
>>>>     
>>>>> The file is 21K.
>>>>> I tryed also to load it directly from Maestro, and I have had no
>>>>> problem.
>>>>>
>>>>> ------------------------------------------------------------------------------------------------------
>>>>>
>>>>>
>>>>> Kenneth Skovhede, GEOGRAF A/S wrote:
>>>>>   
>>>>>       
>>>>>> Just to be sure...
>>>>>>
>>>>>> The xml you posted is the ResourceHeader, and not the
>>>>>> ResourceContent, 
>>>>>> so it does not really show what the problem may be.
>>>>>> The error from the log states that the runtime map is not created,
>>>>>> which 
>>>>>> is strange because a WebLayout cannot reference a runtime map.
>>>>>> The other error you posted seemed to indicate that the Print command
>>>>>> was 
>>>>>> invalid inside the WebLayout.
>>>>>>
>>>>>> Can you try so save the xml, just before you write it to the
>>>>>> MgByteStream?
>>>>>> Then try to post the file, using the SetResource in the webform 
>>>>>> mentioned earlier.
>>>>>> If you get the same error, try to post the file somewhere, and
>>>>>> provide a 
>>>>>> link.
>>>>>> Be carefull not to copy/paste, but post the actual file.
>>>>>>
>>>>>> Btw. how large is the file? larger than 8K?
>>>>>>
>>>>>> Regards, Kenneth Skovhede, GEOGRAF A/S
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> mapguide-users mailing list
>>>>>> [email protected]
>>>>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>>>>
>>>>>>
>>>>>>     
>>>>>>         
>>>>>   
>>>>>       
>>>> _______________________________________________
>>>> mapguide-users mailing list
>>>> [email protected]
>>>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>>>
>>>>
>>>>     
>>>
>>>   
>> 
>> _______________________________________________
>> mapguide-users mailing list
>> [email protected]
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>> 
>> 
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/Create-programmatically-a-map-tp2314238p2429177.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to