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

Passing object as parameter to web service

[es] :: .NET :: Passing object as parameter to web service

[ Pregleda: 1969 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Simke
Marko Simic
Sandfield Associates (Solution
Developer)
Novi Zeland

Član broj: 1158
Poruke: 751
*.avenue.co.nz

ICQ: 71578686
Sajt: www.sandfield.co.nz


Profil

icon Passing object as parameter to web service14.10.2003. u 03:34 - pre 250 meseci
Imam sledeci problem:
Napisao sam web service koji u sebi ima funckiju koja prima objekte kao parametre.
Kada god pokusam da pozovem tu funkciju iz aplikacije, dobijem sledecu poruku:

An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll
Additional information: There was an error generating the XML document.

Inace imam 2 classes,
Public Class Workstation i
Public Class Server

Funkcija koja se nalazi u web service je
<WebMethod(Description:="Log installation steps into the database.")> _
Public Sub LogProgress(ByVal oWorkstation As Object, _
ByVal oServer As Object, _
ByVal strStage As String, ByVal bolSuccess As Boolean, ByVal strMessage As String)

Dim objServer As New MaxiomBusinessObjects.Server
Dim objWorkstation As New MaxiomBusinessObjects.Workstation

objWorkstation = CType(oWorkstation, MaxiomBusinessObjects.Workstation)
objServer = CType(oServer, MaxiomBusinessObjects.Server)
....

ovde sam morao da koristim ctype jer funkcija nije htela da primi Workstation i Server objekte kao parametre.

Code koji zove ovu funkciju u klijent aplikaciji izgleda ovako:
Dim MyWebService As New MaxiomWeb.Service1
Dim oWorkstation As New MaxiomBusinessObjects.Workstation(GetWorkstation(), GetOS(), GetCPU(), GetMemory(), GetFreeSpace("C:\"), CType(GetTotalSpace("C:\"), Long))
Dim oServer As New MaxiomBusinessObjects.Server(GetServerName(), GetServerID())

MyWebService.LogProgress(oWorkstation, oServer, "Test stage", True, "Testing, testing...")

Pomozite ako znate, mucim se vec pola dana oko ovoga...
All beer is good. Some beer is better.
 
Odgovor na temu

havramm
Miroslav Havram
Software Developer / Engineer
Beograd

Član broj: 4603
Poruke: 255
212.62.55.*



Profil

icon Re: Passing object as parameter to web service14.10.2003. u 10:38 - pre 250 meseci
Citat:
ovde sam morao da koristim ctype jer funkcija nije htela da primi Workstation i Server objekte kao parametre.


Zasto ti ovo nece? Treba da moze, bitno je samo da servis ima referencu na assembly gde se nalaze definisane te klase...

E sada, da bi mogao da koristis tu funkciju servisa iz klijentskog koda i da joj u klijentskom kodu prosledis instance tih klasa, te klase moraju da mogu da se serijalizuju u XML (konkretno klase Workstation i Server moraju da mogu da se serijalizuju...). Potrazi o serijalizaciji vise u MSDN-u, ne znam tacno adresu...
If it's a girl then they're gonna call it Sigourney, after an actress. If it's a boy, then they're gonna call it Rodney, after Dave!
 
Odgovor na temu

Simke
Marko Simic
Sandfield Associates (Solution
Developer)
Novi Zeland

Član broj: 1158
Poruke: 751
*.avenue.co.nz

ICQ: 71578686
Sajt: www.sandfield.co.nz


Profil

icon Re: Passing object as parameter to web service15.10.2003. u 01:14 - pre 250 meseci
Serijalizacija mi bas i zadaje probleme, procitao sam par stvari, ali idalje nista... pogedacu jos kad budem imao malo vise vremena.
All beer is good. Some beer is better.
 
Odgovor na temu

[es] :: .NET :: Passing object as parameter to web service

[ Pregleda: 1969 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

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