Home > Software engineering >  WCF Web Service / Visual Studio Community 2022 / Compiler Error CS0120
WCF Web Service / Visual Studio Community 2022 / Compiler Error CS0120

Time:08-05

I want to access a web page in a Windows Forms app via SOAP.

Unfortunately, the compiler spits out many errors after I added the WCF Web Service to the project. What am I doing wrong here? The possible options don't tell me anything. The examples I found on the Internet could not help me with the errors.

Visual Studio Community 2022

WCF Web Service URI: https://www.onlinembe.de/wsdl/OnlineMbeSOAP.wsdl

[ ] Always generate message contracts
[X] Reuse types in referece assemblies

  • [X] Reuse types in all referenced assemblies

Access level for generated classes:
[X] Public

Compiler Error CS0120
An object reference is required for the non-static field, method or property "ShipmentRequestType.System".

CodePudding user response:

In 'Reference.cs' add 'using System.Xml.Schema;' and replace 'Form=System.Xml.Schema.XmlSchemaForm.Unqualified' with Form='XmlSchemaForm.Unqualified'.

  • Related