Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Asmx web service - problem sa vracanjem liste

[es] :: .NET :: Asmx web service - problem sa vracanjem liste

[ Pregleda: 1712 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Valerij Zajcev

Član broj: 40886
Poruke: 1374
*.static.isp.telekom.rs.



+2 Profil

icon Asmx web service - problem sa vracanjem liste04.03.2011. u 13:57 - pre 159 meseci
Metoda iz asmx web servisa mi vraca listu custom objekata...
Code:

[WebMethod]
public List<CustomObjects> ...
List<CustomObject> list = GetCustomObjects();
return list;
...

I dobijem sledeci XML...
Code:

-<ArrayOfCustomObjects>
     -<CustomObject>
     ....
....

E ovo ' ArrayOfCustomObjects' hocu da mi bude 'CustomObjects' probao sam sa atributima ali ne ide...neka ideja?
 
Odgovor na temu

Dejan Carić
Oslo, Norway

Član broj: 230976
Poruke: 232
*.dynamic.isp.telekom.rs.

Sajt: www.dcaric.com


+26 Profil

icon Re: Asmx web service - problem sa vracanjem liste05.03.2011. u 10:52 - pre 159 meseci
Code:

[Serializable]
public class CustomObject
{
    public string Foo { get; set; }
}

[Serializable]
[XmlRoot(ElementName="CustomObjects")]
public class CustomObjectCollection : List<CustomObject>
{
            
}


Code:

[WebMethod]
public CustomObjectCollection GetCustomObjectst()
{
    var collection = new CustomObjectCollection { new CustomObject { Foo = "boo" } };
    return collection;
}

 
Odgovor na temu

[es] :: .NET :: Asmx web service - problem sa vracanjem liste

[ Pregleda: 1712 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.