Grinn Grinn - 3 months ago 25
ASP.NET (C#) Question

Inherited properties do not appear in soap sample on asmx file

I have two classes, WebServiceRequest and OrderRequest. Each class has properties. OrderRequest inherits from WebServiceRequest - like so:

public class WebServiceRequest
{
private string mAuthenticationToken;

public string AuthenticationToken
{
get { return mAuthenticationToken; }
set { mAuthenticationToken = value; }
}
...
}





public class OrderRequest : WebServiceRequest
{

private string mVendorId;
public string VendorId
{
get { return mVendorId; }
set { mVendorId = value; }
}
...
}


OrderRequest is exposed via a WebMethod. When viewing the WSDL of the ASMX file that exposes OrderRequest (i.e. MyWebService.asmx?WSDL), both properties are visible - as they should be. However, when you view the SOAP Sample for the Web Method that exposes OrderRequest, only the VendorId property is visible, and not the inherited AuthenticationToken property. What's the deal?

Note: I've posted this issue as a bug on MS Connect: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=520200

Answer

I managed to stumble back-asswords into the solution for my problem, even after Microsoft confirmed it as a bug (https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=520200) and I had given up and marked John's answer as accepted. Here's the solution:

http://code.msdn.microsoft.com/WsdlHelpGenerator/Release/ProjectReleases.aspx?ReleaseId=412

Go there, download the file, then add the following line under the system.web section of your Web.config file:

<webServices>
 <wsdlHelpGenerator href="CustomWsdlHelpGenerator.aspx"/>
</webServices>

The href property should point to the relative location of your file within your project. Thanks for your help John.