asmx 文件的soap 示例中未出现继承的属性 [英] Inherited properties do not appear in soap sample on asmx file

查看:28
本文介绍了asmx 文件的soap 示例中未出现继承的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个类,WebServiceRequest 和 OrderRequest.每个类都有属性.OrderRequest 继承自 WebServiceRequest - 像这样:

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 通过 WebMethod 公开.查看公开 OrderRequest(即 MyWebService.asmx?WSDL)的 ASMX 文件的 WSDL 时,这两个属性都是可见的——它们应该是.但是,当您查看公开 OrderRequest 的 Web 方法的 SOAP 示例时,只有 VendorId 属性可见,而不是继承的 AuthenticationToken 属性.怎么回事?

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?

注意:我已将此问题作为错误发布到 MS Connect 上:https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=520200

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

推荐答案

即使在 Microsoft 确认它是一个错误之后,我还是设法找到了解决我的问题的方法(https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=520200)我已经放弃并将约翰的答案标记为已接受.解决方法如下:

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

去那里,下载文件,然后在您的 Web.config 文件的 system.web 部分下添加以下行:

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>

href 属性应指向您的文件在项目中的相对位置.感谢约翰的帮助.

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

这篇关于asmx 文件的soap 示例中未出现继承的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆