This is my solution
I added a Service Reference, instead of Web Reference
by Right-clicking on References in the 'Solution Explorer' -> select 'Add Service Reference' -> Paste the address (http://www.ibanbic.be/IBANBIC.asmx) -> Click on 'Go' Button - Then 'OK'
I added the following References in code
using MYSCRIPTCOMPONENT.ServiceReference1;
using System.ServiceModel;
using System.Net.Http;
UPDATED
This is how my code looks like:
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
using (var client = ScriptMain.CreateWebServiceInstance())
{
Row.BankIBAN = client.BBANtoIBANandBIC(Row.AccountNum_IsNull ? "" : Row.AccountNum).ToString();
}
}
internal static SC_MYSCRIPTCOMPONENT.ServiceReference1.BANBICSoapClient CreateWebServiceInstance()
{
BasicHttpBinding binding = new BasicHttpBinding();
// I think most (or all) of these are defaults--I just copied them from app.config:
binding.Security.Mode = BasicHttpSecurityMode.None;
binding.SendTimeout = TimeSpan.FromMinutes(1);
binding.OpenTimeout = TimeSpan.FromMinutes(1);
binding.CloseTimeout = TimeSpan.FromMinutes(1);
binding.ReceiveTimeout = TimeSpan.FromMinutes(10);
binding.AllowCookies = false;
binding.BypassProxyOnLocal = true;
binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
binding.MessageEncoding = WSMessageEncoding.Text;
binding.TextEncoding = System.Text.Encoding.UTF8;
binding.TransferMode = TransferMode.Buffered;
System.Net.ServicePointManager.Expect100Continue = false;
binding.UseDefaultWebProxy = true;
return new SC_MYSCRIPTCOMPONENT.ServiceReference1.BANBICSoapClient(binding, new EndpointAddress("http://www.ibanbic.be/IBANBIC.asmx"));
}
EDIT
I was getting an error when running my Package, which said:
The underlying connection was closed: The connection was closed
unexpectedly.
I added this line of code (in my CreateWebServiceInstance-method):
System.Net.ServicePointManager.Expect100Continue = false;
SUMMARY
- I added a Service Reference - as mentioned here. [STACK OVERFLOW]
- I added code to set the binding - as mentioned here. [STACK OVERFLOW]
- I added one line to fix 'the connection was closed'-error - as provided on MSDN.