.NET 命名冲突问题中的 SAP Web 服务引用

发布于 2024-12-12 18:33:58 字数 761 浏览 3 评论 0原文

当我尝试使用 SAP ws 时,我遇到了 .net 问题, 元素系统使用此错误

  error CS0120: An object reference is required for the nonstatic field, method, or property 'Bapiret2.System'

,它们是此处描述的解决方案,但我想找到一个不需要更改 WSDL 的解决方案

http://www.drowningintechnicaldebt.com/ShawnWeisfeld/archive/2009/04/17/system-namespace-conflict-in-sap-web-services.aspx

或这个, http://ddkonline.blogspot.com/2009 /09/sap-to-microsoft-net-integration-fixes.html

您有这方面的经验以及如何解决它吗?

谢谢 三木

i have a .net issue when im trying to consume SAP ws ,
the element system cusing this error

  error CS0120: An object reference is required for the nonstatic field, method, or property 'Bapiret2.System'

their is a solution as described here BUT im want to find a solution that doesn't required to change the WSDL

http://www.drowningintechnicaldebt.com/ShawnWeisfeld/archive/2009/04/17/system-namespace-conflict-in-sap-web-services.aspx

or this one ,
http://ddkonline.blogspot.com/2009/09/sap-to-microsoft-net-integration-fixes.html

do you have any experience with that and how you solve it?

thanks
miki

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

孤蝉 2024-12-19 18:33:58

由于此问题是由 .NET 和 SAP 中的命名冲突引起的,因此在不更改 SAP 配置的情况下解决此问题的另一种方法:

在 Reference.cs 中为 System.XML 添加一个别名,如下所示

using SysXml = System.Xml;

然后,将所有报告错误的 System.Xml 替换为“SysXml”如下(请注意,“SysXml”一词在添加服务后原来是“System.Xml”,从而导致了此问题)

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=SysXml.Schema.XmlSchemaForm.Unqualified)]
public string Type {
    get {
        return this.typeField;

    set {
        this.typeField = value;
    }
}

Since this issue is caused by naming conflict in .NET and SAP, another workaround for this issue without changing SAP configuration:

Add an alias for System.XML as below in Reference.cs

using SysXml = System.Xml;

Then, replace all the System.Xml where report the error with "SysXml" as below (please note that the word "SysXml" is originally "System.Xml" after adding the service, which caused this issue)

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=SysXml.Schema.XmlSchemaForm.Unqualified)]
public string Type {
    get {
        return this.typeField;

    set {
        this.typeField = value;
    }
}
初与友歌 2024-12-19 18:33:58

问题是因为 Windows 和 BAPI 中的系统命名空间。这可以通过在所有给出上述错误的调用之前添加 global:: 来解决。这不涉及编辑 WSDL。

参考文献:对 该评论引用的链接

The problem is because System namespace in both Windows and BAPI. This can be dealt with by adding global:: before all calls giving the above errors. This does not involve editing WSDL.

References: Comment on one of the page you mentioned above and link that comment referred to.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文