How to use C# Web Service Client with BasicAuth (for SAP)

SAP Webservice with .NET Webservice Client and BasicAuthNo matter how frumpy SAP may look most of the time, nevertheless you can build such modern things like web services inside the SAP system. Even the WSDL (Web Service Description File) file can be generated in SAP. I read about this feature (WSDL generation) just at the right time, because recent days I should write a web service in SAP which should be triggered by a C# application.
In .NET web services can easily integrated via their WSDL file by using the WebReference feature of Visual Studio. Therefore Visual Studio generates a so-called proxy class from the given WSDL file which can be used to call all functions of the webservice without thinking too much.
As far as in theory. In practice I had to choose the security mode for the web service in SAP. […]