Article ID: 313584 - Last Review: February 23, 2007 - Revision: 6.2 PRB: Read-Only Properties Cannot Be Exposed by XML Web ServicesThis article was previously published under Q313584 On This PageSYMPTOMSNote The following .NET Framework Class Library namespaces are
referenced in this article: System.Web.Services If a Web service contains a Web method that either accepts a parameter or returns a value that is an object reference, and the class definition of the object contains a read-only property, the read-only property is not available when you build a proxy assembly for the Web service. Note The following .NET Framework Class Library namespace is referenced in this article: System CAUSE When an object is passed (that is, marshalled) to or from a
Web service, it must be serialized into an XML stream and then deserialized
back into an object. The XML Serializer cannot deserialize the XML back into an
object because it cannot load the read-only properties. Consequently, the
read-only properties are not exposed through the Web Services Description
Language (WSDL). Because the Web service proxy is generated from the WSDL, the
proxy also excludes any read-only properties. RESOLUTION To work around this problem, add a SET procedure for the
property. You can either leave the procedure empty, so that that the procedure
has no effect, or raise a custom exception to inform clients that the property
is read-only, as follows: STATUSThis
behavior is by design. MORE INFORMATIONSteps to Reproduce Behavior
REFERENCES301273
(http://support.microsoft.com/kb/301273/EN-US/
)
HOW TO: Write a Simple Web Service by Using Visual Basic .NET
APPLIES TO
| Article Translations
|


Back to the top
