Question

I have this class

public class Subject
{
    int ID;
    string Name;
    int Semester;
    int Grade;
}

I am using it in a .asmx and in .svc(wcf) web service. When invoking the service with the ?wsdl in browser i expect to see the complex type Subject with all its members but instead i see only a declaration for the complex type.

<xs:complexType name="Subject">
<xs:sequence/>
</xs:complexType> -> this is from the wcf service wsdl

<s:complexType name="Subject"/> -> this is from the asmx web service wsdl

In the wcf service the class has the [DataContract] attribute

how do i generate the wsdl to show me the complex type details with all members? what am i doing wrong? Im using .NET 4 and VS2010

Was it helpful?

Solution

The XML Serializer pretty much only works with public read/write properties. Try this:

public class Subject
{
    public int ID {get;set;}
    public string Name {get;set;}
    public int Semester {get;set;}
    public int Grade {get;set;}
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top