Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: VB6
Expertise: beginner
Jun 27, 2002



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Make read-only properties visible to Web Services clients

Read-only and write-only properties in a Web Service class aren't visible to the Web Service client. The reason is that XML serialization doesn't support these sort of properties, and read-only and write-only properties aren't included in the Web Services Description Language (WSDL) documentation.

To make these properties visible to clients, create a Function that returns the value of a read-only property, or a Sub that assigns a write-only property, and decorate them with the WebMethod attribute. For example:

Dim m_Count As Integer 

ReadOnly Property Count() As Integer
      Return m_Count 
   End Get
End Property 

' This is the method visible to the Web Service's clients
<WebMethod()> Function GetCount() As Integer
    Return Count
End Function
Francesco Balena
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date