The MBE web service should be added to the project as a Web Reference, not a Service Reference; https://api.mbeonline.XX/ws/e-link.wsdl is the url of the WSDL (see here for the list of countries)
Once the web service is added to the .NET project there are a few changes to be made:
in the App.config you have to modify the service url with this https://api.mbeonline.XX/ws
in the automatically generated Reference.cs file you must:
modify all the "public SystemType System" properties renaming System for example with WSSystem and adding the ElementName property for the xml
Example:
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public SystemType System {
becomes
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, ElementName = "System")]
public SystemType WSSystem {
You need to add a class that inherits SoapHttpClientProtocol to handle basic authentication:
public class MyHttpProtocol : SoapHttpClientProtocol
{
protected override WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest request;
request = (HttpWebRequest)base.GetWebRequest(uri);
if (PreAuthenticate)
{
NetworkCredential networkCredentials =
Credentials.GetCredential(uri, "Basic");
if (networkCredentials != null)
{
byte[] credentialBuffer = new UTF8Encoding().GetBytes(
networkCredentials.UserName + ":" +
networkCredentials.Password);
request.Headers["Authorization"] =
"Basic " + Convert.ToBase64String(credentialBuffer);
}
else
{
throw new ApplicationException("No network credentials");
}
}
return request;
}
}
at this point the automatically generated class must inherit the created class:
public partial class ElinkMbeSOAPService : MyHttpProtocol
If needed, a Reference.cs file can be provided
Below is an example of how to perform authentication:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
using (ElinkMbeSOAPService client = new ElinkMbeSOAPService())
{
client.PreAuthenticate = true;
client.Credentials = new NetworkCredential({USER}, {API KEY});