Вопрос

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

Это было полезно?

Решение

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.

Другие советы

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;
    }
}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top