I have written a Web service in .Net 2008, with following Web method -
<WebMethod()> _
Public Function GetCurrency(ByVal ID As Guid) As Currency
Dim mCurrency As Currency = Currency.GetCurrency(ID)
Return mCurrency
End Function
WHERE 'Currency' is CSLA.net object. WHILE running web service its giving subjected error.
PLEASE guide me as I am new to this.
This is a frequently asked question. Frequent enough that it is covered in the FAQ:
http://www.lhotka.net/cslanet/faq/XmlServicesFaq.ashx
It is also the subject of Chapter 21 in the Expert 2008 Business Objects book.
In short, you can't use the XmlSerializer, DataContractSerializer, JsonSerializer, or the other more limited serializers to directly convert a CSLA object into and out of a data format.
And you shouldn't want to do this anyway. It would be an architectural disaster to tightly couple your internal object design to an external interface. Especially a service interface, because they are really hard to version in any case.
Thanks.
Can you please explain how should I work arround in this situation.
As I said, Chapter 21 explains in detail. In summary:
There's also a lot of information (mostly architecture related) on my blog in the Service Oriented category:
http://www.lhotka.net/weblog/CategoryView,category,Service-Oriented.aspx
Copyright (c) Marimer LLC