In an VS2005 VB.Net application I am consuming a free webservice to transform old belgian account numbers to Iban:
http://www.ebcs.be/iban/IBANBIC.asmx
The strange thing is that this service sometimes returns empty strings and on other times the proper string is returned.
I’ve checked the traffic with fiddler.
The requests are send correctly. Only one time the response returns an empty string, another time with the same request it returns the string I need.
This is the code that calls the service
Public Function convertToIban(ByVal rekeningNummer As String) As String()
Dim IbanService As IbanConversie.IBANBIC = New IbanConversie.IBANBIC()
Dim rekeningZonder As String = rekeningNummer.Replace("-", "")
Dim IbanBic(1) As String
Try
Dim Iban As String = IbanService.calculateIBAN1("BE", rekeningZonder)
IbanBic(0) = Iban.Remove(0, 5)
Dim Bic As String = IbanService.BBANtoBIC(rekeningZonder)
IbanBic(1) = Bic
Catch ex As Exception
System.Windows.Forms.MessageBox.Show("Kan geen verbinding maken met de webservice. Controleer of uw internetverbinding werkt.")
End Try
Return IbanBic
End Function
Public Function convertFromIban(ByVal IBANNummer As String) As String()
Dim IbanService As IbanConversie.IBANBIC = New IbanConversie.IBANBIC()
Dim Rekening(1) As String
Try
Rekening(0) = IbanService.getBelgianBBAN(IBANNummer)
Rekening(1) = IbanService.BBANtoBIC(Rekening(0))
Catch ex As Exception
System.Windows.Forms.MessageBox.Show("Kan geen verbinding maken met de webservice. Controleer of uw internetverbinding werkt.")
End Try
Return Rekening
End Function
There are two scenarios:
If I run convertFromIban first the requested strings are returned. If I run convertToIban after that the requested string are returned as well.
If I run convertToIban first the Iban String is returned the Bic string returns an empty string. If I run convertFromIban next, only empty string are returned.
Is this common with free webservices, or is there some other explanation?
I don’t want to blame this on december 21 🙂
Any help is really appreciated.
One quick point.
You don’t appear to be cleaning up you service ‘IbanService ‘. If this code is called many times it might give you some issues.