Child class does not show inherited properties in SOAP document (ASMX web service)
I am writing .NET webservice (VB.NET). One of the DisplayChild () methods returns an object of type Child. The child is determined:
<Serializable()> _
Public Class Child
Inherits BaseClass
Property NotInInheritedProperties() as Object
...
End Property
End Class
and BaseClass looks like this:
<Serializable()> _
Public MustInherit Class BaseClass
Property BaseProperty() as Object
...
End Property
End Class
However, in the SOAP definition that shows the return from DisplayChild (), the only property that is displayed in the output is the NotInInheritedProperties property. Then my question is, how can I get the properties in BaseClass to display in a SOAP document? Originally I didn't have the Serializable attribute in BaseClass thinking which was the problem. However, even after the change, it still didn't work.
a source to share
Even though the BaseProperty doesn't show up in the SOAP definition when you view the service through your web browser, it looks like it's still part of the WSDL. If you look at the WSDL (YourService.asmx? WSDL or that link that says "Service Description" on your server.), You should see inheritance between BaseClass and Child, something like:
<s:complexType name="Child">
<s:complexContent mixed="false">
<s:extension base="tns:BaseClass">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="NotInInheritedProperties" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
<s:complexType name="BaseClass" abstract="true">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="BaseProperty" />
</s:sequence>
</s:complexType>
If you have a consumer of your web service that cannot see this property, it might be a problem with their specific implementation (I've worked with some "enterprise web service applications" that are absolutely jammed with web services that return complex types)
a source to share