[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Error using a custom object as input parameter in a web service

Robin Prosch via .NET 247

9/23/2004 5:55:00 PM

Hi. I'm sorry I don't have a solution for this, I just want to say that I have the same error when I try to use a custom object library inside my web service.

I tested with an output object and works fine, but when I try to pass an object to my web method I get this error:

Additional information: System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (1, 326). ---> System.StackOverflowException : Exception of type System.StackOverflowException was thrown.
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
--- End of inner exception stack trace ---
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.Invoke()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()


My custom object library is a object model where I have objects inside objects and also I use object collections. I already tested my custom object library with a win app and everything works fine, so Im sure the problem is in the web service

Assume I do this in my web service:
<WebMethod()> _
Public Function MyProcess(ByVal CustomerInfo As RequestObject) As ResponseObject
Dim ResultCustomer As New ResponseObject
Dim Message As String
...
<set paratemers to ResultCustomer after save in the DB. This object only return status info>
...
return ResultCustomer
End Function

Then in my window application I do this in a button click event:

Dim MyWebService As New WS.Service1
Dim CustomerInfo1 As New localhost.RequestObject
Dim ResultCustomer1 As New localhost.ResponseObject
Dim CredentialCache As System.Net.CredentialCache
Dim Results As String
MyWebService.Credentials = CredentialCache.DefaultCredentials
CustomerInfo1.Address = New localhost.Address 'If I don't instance the object explicity, I 'get an error
CustomerInfo1.CustomerName = TextCustomerName.Text
CustomerInfo1.Address.AddressLine = "Calle Perales 123"
....<set more parameters>
ResultCustomer1 = MyWebService.MyProcess(CustomerInfo1)

TextResults.txt = ResultCustomer1.StatusDescription


Note: dont forget this is just an example, my object have a 3 levels of hierarchy objects.
Thanks in advance
Paola

-----------------------
Posted by a user from .NET 247 (http://www.dotn...)

<Id>/tyZg3ocqkijDKNC5tDckQ==</Id>