c# - Passing list to JSON web service -


i trying pass list json list service bringing last item im repeating 9 times amount of objects. when calling code within dll fine in loop when called webservice not thinking more serialize method??

public list<viewpresentation> getcolumnsfromxml(string columnsxmlstring, string xpath) {     xdocument doc = xdocument.parse(columnsxmlstring);     xnamespace ns = xnamespace.get("http://schemas.microsoft.com/systemcenter/common/ui/views/gridview");     var expressions = (from ds in doc.root.descendants(ns + "column")                        select ds).tolist();     viewpresentation vp = new viewpresentation();     list<viewpresentation> listcolumns = new list<viewpresentation>();      (int = 0; < expressions.count; i++)     {         viewpresentation vp = new viewpresentation();          var xml = xelement.parse(expressions[i].tostring());          vp.columname = xml.attribute("name").value;         vp.displayname = xml.attribute("displayname").value;         vp.memberbinding = xml.attribute("displaymemberbinding").value;         vp.property = xml.attribute("property").value;         vp.datatype = xml.attribute("datatype").value;          listcolumns.add(vp);     }     return listcolumns; } 

i calling method through webservice , returning object showing last item on list when debug through code of dll being filled in fine ideas call web service method such

[webmethod] [scriptmethod(responseformat = responseformat.json)] public string  getcolumnsfromviews() {     string itemsource, critera;     parser viewsparserobject = new parser();     viewsparserobject.xmlfilename = @"c:\development\source\portal\svnmostrecent\portal\customview.xml";     itemsource= viewsparserobject.loadfromxml();     critera = viewsparserobject.getcriterafromxmlfile("/data");     list<viewpresentation> mycolumns = viewsparserobject.getcolumnsfromxml(critera, "/data");     system.web.script.serialization.javascriptserializer jsearializer = new system.web.script.serialization.javascriptserializer();     return jsearializer.serialize(mycolumns); } 

the value return follows:

<string xmlns="http://tempuri.org/"> [     {         "id": -1,         "viewname": "",         "columname": "{binding path=impact.displayname, mode=oneway}",         "memberbinding": "{binding path=impact.displayname, mode=oneway}",         "displayname": "impact.f412c72e91104455b1695ef1ccca4e91",         "property": "impact.displayname",         "datatype": "s:string",         "viewstrings": []     },     {         "id": -1,         "viewname": "",         "columname": "{binding path=impact.displayname, mode=oneway}",         "memberbinding": "{binding path=impact.displayname, mode=oneway}",         "displayname": "impact.f412c72e91104455b1695ef1ccca4e91",         "property": "impact.displayname",         "datatype": "s:string",         "viewstrings": []     },     {         "id": -1,         "viewname": "",         "columname": "{binding path=impact.displayname, mode=oneway}",         "memberbinding": "{binding path=impact.displayname, mode=oneway}",         "displayname": "impact.f412c72e91104455b1695ef1ccca4e91",         "property": "impact.displayname",         "datatype": "s:string",         "viewstrings": []     },     {         "id": -1,         "viewname": "",         "columname": "{binding path=impact.displayname, mode=oneway}",         "memberbinding": "{binding path=impact.displayname, mode=oneway}",         "displayname": "impact.f412c72e91104455b1695ef1ccca4e91",         "property": "impact.displayname",         "datatype": "s:string",         "viewstrings": []     },     {         "id": -1,         "viewname": "",         "columname": "{binding path=impact.displayname, mode=oneway}",         "memberbinding": "{binding path=impact.displayname, mode=oneway}",         "displayname": "impact.f412c72e91104455b1695ef1ccca4e91",         "property": "impact.displayname",         "datatype": "s:string",         "viewstrings": []     },     {         "id": -1,         "viewname": "",         "columname": "{binding path=impact.displayname, mode=oneway}",         "memberbinding": "{binding path=impact.displayname, mode=oneway}",         "displayname": "impact.f412c72e91104455b1695ef1ccca4e91",         "property": "impact.displayname",         "datatype": "s:string",         "viewstrings": []     },     {         "id": -1,         "viewname": "",         "columname": "{binding path=impact.displayname, mode=oneway}",         "memberbinding": "{binding path=impact.displayname, mode=oneway}",         "displayname": "impact.f412c72e91104455b1695ef1ccca4e91",         "property": "impact.displayname",         "datatype": "s:string",         "viewstrings": []     },     {         "id": -1,         "viewname": "",         "columname": "{binding path=impact.displayname, mode=oneway}",         "memberbinding": "{binding path=impact.displayname, mode=oneway}",         "displayname": "impact.f412c72e91104455b1695ef1ccca4e91",         "property": "impact.displayname",         "datatype": "s:string",         "viewstrings": []     },     {         "id": -1,         "viewname": "",         "columname": "{binding path=impact.displayname, mode=oneway}",         "memberbinding": "{binding path=impact.displayname, mode=oneway}",         "displayname": "impact.f412c72e91104455b1695ef1ccca4e91",         "property": "impact.displayname",         "datatype": "s:string",         "viewstrings": []     } ] </string>  

xml source

<?xml version="1.0" encoding="utf-8" ?> <data>   <view>     <adapters>       <adapter adaptername="dataportal:enterprisemanagementobjectadapter">         <adapterassembly>microsoft.enterprisemanagement.ui.sdkdataaccess</adapterassembly>         <adaptertype>microsoft.enterprisemanagement.ui.sdkdataaccess.dataadapters.enterprisemanagementobjectadapter</adaptertype>       </adapter>       <adapter adaptername="viewframework://adapters/advancedlist">         <adapterassembly>microsoft.enterprisemanagement.ui.viewframework</adapterassembly>         <adaptertype>microsoft.enterprisemanagement.ui.viewframework.advancedlistsupportadapter</adaptertype>       </adapter>       <adapter adaptername="omsdk://adapters/criteria">         <adapterassembly>microsoft.enterprisemanagement.ui.sdkdataaccess</adapterassembly>         <adaptertype>microsoft.enterprisemanagement.ui.sdkdataaccess.dataadapters.sdkcriteriaadapter</adaptertype>       </adapter>     </adapters>     <itemssource>       <advancedlistsupportclass datatypename="" adaptername="viewframework://adapters/advancedlist" fullupdateadapter="dataportal:enterprisemanagementobjectadapter" datasource="mom:managementgroup" fullupdatefrequency="1" streaming="true" isrecurring="true" recurrencefrequency="{x:static s:int32.maxvalue}" xmlns="clr-namespace:microsoft.enterprisemanagement.ui.viewframework;assembly=microsoft.enterprisemanagement.ui.viewframework" xmlns:av="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:system;assembly=mscorlib">         <advancedlistsupportclass.parameters>           <queryparameter parameter="managementpackclassid" value="$mpelement[name='coreincident!system.workitem.incident']$" />         </advancedlistsupportclass.parameters>       </advancedlistsupportclass>     </itemssource>     <criteria />     <presentation>       <columns>         <mux:columncollection xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:mux="http://schemas.microsoft.com/systemcenter/common/ui/views/gridview" xmlns:s="clr-namespace:system;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:datebinding="clr-namespace:microsoft.enterprisemanagement.ui.extensions;assembly=microsoft.enterprisemanagement.ui.extensions" xmlns:data="clr-namespace:microsoft.enterprisemanagement.ui.extensions;assembly=microsoft.enterprisemanagement.ui.extensions" xmlns:appcommon="clr-namespace:microsoft.enterprisemanagement.servicemanager.application.common;assembly=microsoft.enterprisemanagement.servicemanager.application.common" xmlns:toolbox="clr-namespace:microsoft.enterprisemanagement.ui.wpftoolbox;assembly=microsoft.enterprisemanagement.ui.formsinfra" xmlns:slabinding="clr-namespace:microsoft.enterprisemanagement.servicemanager.sla.common;assembly=microsoft.enterprisemanagement.servicemanager.sla.common">           <mux:column name="actualcost" displaymemberbinding="{binding path=actualcost, mode=oneway}" width="100" displayname="actualcost.c8e7234bdd574f8097fd3b0d7fb35851" property="actualcost" datatype="s:double" />           <mux:column name="actualdowntimeenddate" displaymemberbinding="{datebinding:datebinding path=actualdowntimeenddate, mode=oneway}" width="100" displayname="actualdowntimeenddate.ed1a5af04f814341a88766f2fa18c447" property="actualdowntimeenddate" datatype="s:datetime" />           <mux:column name="actualdowntimestartdate" displaymemberbinding="{datebinding:datebinding path=actualdowntimestartdate, mode=oneway}" width="100" displayname="actualdowntimestartdate.34daa34691ed435597c3a230ff5d8c60" property="actualdowntimestartdate" datatype="s:datetime" />           <mux:column name="actualwork" displaymemberbinding="{binding path=actualwork, mode=oneway}" width="100" displayname="actualwork.4afb1225100040ef8cf93871389b3380" property="actualwork" datatype="s:double" />           <mux:column name="description" displaymemberbinding="{binding path=description, mode=oneway}" width="100" displayname="description.f461792cf5d64b10aae47e4c980792e4" property="description" datatype="s:string" />           <mux:column name="displayname" displaymemberbinding="{binding path=displayname, mode=oneway}" width="100" displayname="displayname.ef4712b1ecbf4f4d9dcea38daa28269e" property="displayname" datatype="s:string" />           <mux:column name="$displayname$" displaymemberbinding="{binding path=$displayname$, mode=oneway}" width="100" displayname="displayname.99931bcb16c142cb944c3c2e43467548" property="$displayname$" datatype="s:string" />           <mux:column name="$fullname$" displaymemberbinding="{binding path=$fullname$, mode=oneway}" width="100" displayname="fullname.a1b287d94ab04324857568c878defda9" property="$fullname$" datatype="s:string" />           <mux:column name="impact.displayname" displaymemberbinding="{binding path=impact.displayname, mode=oneway}" width="100" displayname="impact.f412c72e91104455b1695ef1ccca4e91" property="impact.displayname" datatype="s:string" />         </mux:columncollection>       </columns>       <additonalproperties />       <viewstrings>         <viewstring id="actualcost.c8e7234bdd574f8097fd3b0d7fb35851">$mpelement[name="actualcost.c8e7234bdd574f8097fd3b0d7fb35851"]$</viewstring>         <viewstring id="actualdowntimeenddate.ed1a5af04f814341a88766f2fa18c447">$mpelement[name="actualdowntimeenddate.ed1a5af04f814341a88766f2fa18c447"]$</viewstring>         <viewstring id="actualdowntimestartdate.34daa34691ed435597c3a230ff5d8c60">$mpelement[name="actualdowntimestartdate.34daa34691ed435597c3a230ff5d8c60"]$</viewstring>         <viewstring id="actualwork.4afb1225100040ef8cf93871389b3380">$mpelement[name="actualwork.4afb1225100040ef8cf93871389b3380"]$</viewstring>         <viewstring id="description.f461792cf5d64b10aae47e4c980792e4">$mpelement[name="description.f461792cf5d64b10aae47e4c980792e4"]$</viewstring>         <viewstring id="displayname.ef4712b1ecbf4f4d9dcea38daa28269e">$mpelement[name="displayname.ef4712b1ecbf4f4d9dcea38daa28269e"]$</viewstring>         <viewstring id="displayname.99931bcb16c142cb944c3c2e43467548">$mpelement[name="displayname.99931bcb16c142cb944c3c2e43467548"]$</viewstring>         <viewstring id="fullname.a1b287d94ab04324857568c878defda9">$mpelement[name="fullname.a1b287d94ab04324857568c878defda9"]$</viewstring>         <viewstring id="impact.f412c72e91104455b1695ef1ccca4e91">$mpelement[name="impact.f412c72e91104455b1695ef1ccca4e91"]$</viewstring>       </viewstrings>     </presentation>   </view> </data> 


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -