From: Edje on 30 Aug 2006 11:04 Tom Shelton schreef: > Edje wrote: > > Tom Shelton schreef: > > > > > Tom Shelton wrote: > > > > Edje.Rommel(a)gmail.com wrote: > > > > > Hello, > > > > > > > > > > I've have a problem with a webservice. I just want to validate a VAT > > > > > number by country code and VAT numer. The return value should be like > > > > > "it's valid" and/or the name where it's registered to. > > > > > > > > > > To do this i can access the webservice on the following location: > > > > > http://ec.europa.eu/taxation_customs/vies/api/checkVatPort > > > > > > > > > > A WSDL file is also available: > > > > > http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl. > > > > > > > > > > My question is how can i get the results i want. Can someone help me > > > > > with just the little module that does the request. > > > > > > > > > > I already right-click on Web reference and added > > > > > http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl, but > > > > > when i want to use checkvat(country,VAT), it exepect 3 other fields and > > > > > the return type seem to be date. > > > > > > > > > > My understanding is that i only have to use 2 parameters (via XML ?), > > > > > and retrieve a string value (XML ?) > > > > > > > > > > I just need something like > > > > > returnvalue = doRequest(country,VAT).valid > > > > > Name = returnvalue.Name > > > > > Valid = returnvalue.valid > > > > > etc..... > > > > > > > > > > > > > > > Thanks for all your help. > > > > > > > > > > Regards, > > > > > > > > > > Edje > > > > > > > > Option Strict On > > > > Option Explicit On > > > > > > > > Imports System > > > > Imports ConsoleApplication9.eu.europa.ec > > > > > > > > Module Module1 > > > > > > > > Sub Main() > > > > Dim check As New checkVatService() > > > > Dim countryCode As String = "CZ" > > > > Dim vatNumber As String = "991 2311 23" > > > > Dim valid As Boolean > > > > Dim currentDate As Date > > > > Dim name As String = String.Empty > > > > Dim address As String = String.Empty > > > > > > > > currentDate = check.checkVat(countryCode, vatNumber, valid, > > > > name, address) > > > > > > > > If valid Then > > > > Console.WriteLine(name) > > > > Console.WriteLine(address) > > > > Console.WriteLine(currentDate) > > > > Else > > > > Console.WriteLine("invalid vat") > > > > End If > > > > End Sub > > > > > > > > End Module > > > > > > > > What I don't now a valid VAT, so I can't really test it. I just get > > > > back valid = false. I imported this into C#, and it shows the > > > > arguments as: > > > > > > > > DateTime checkVat (ref string countryCode, ref string vatNumber, out > > > > bool valid, out string name, out string address) > > > > > > > > In C#, that means that the method will fill in the out parameters, and > > > > you must supply the ref parameters. In c# that means you must > > > > initailize first, and it must be saved as a variable. VB.NET will let > > > > you get away with it by creating a temp value for you. But, as you can > > > > see I declare all these values in the above code.... So, based on the > > > > C# code I'm assuming that the VB.NET code actually works? > > > > > > > > -- > > > > Tom Shelton > > > > > > Boy - I meant to point out that I'm using the vat numbers supplied adm. > > > Didn't mean to take credit for that :) I was just trying to take his > > > example a little farther. > > > > > > -- > > > Tom Shelton > > > > > > Tom, > > > > I tried this code (with proxy server), but i get the following error: > > "The request failed with HTTP status 417: Expectation Failed." > > The error is on the following row: > > currentDate = check.checkVat(countryCode, vatNumber, valid, > > name, address) > > > > Here is my code: > > > > Option Strict On > > Option Explicit On > > Imports BTWCheck.eu.europa.ec > > Imports System.Net > > Imports System > > > > > > Module Module1 > > > > Sub Main() > > Dim check As New checkVatService() > > Dim countryCode As String = "BE" > > Dim vatNumber As String = "4179951765" > > Dim valid As Boolean > > Dim currentDate As Date > > Dim datestring As String > > Dim name As String = String.Empty > > Dim address As String = String.Empty > > ' proxy settings > > Dim cr As New System.Net.NetworkCredential("user", "pass", > > "domain") > > Dim pr As New System.Net.WebProxy("10.0.0.9", 8080) > > pr.Credentials = cr > > check.Proxy = pr > > > > > > currentDate = check.checkVat(countryCode, vatNumber, valid, > > name, address) > > If valid Then > > Console.WriteLine(name) > > Console.WriteLine(address) > > Console.WriteLine(currentDate) > > Else > > Console.WriteLine("invalid vat") > > End If > > End Sub > > > > > > End Module > > > > Thanks for your help. > > > > > > Ed > > Sorry Ed, I'm hitting the limits of my knowledge of web services. I > haven't ever tried to use a web service through a proxy. I'm assuming > that there is something wrong with your proxy settings? I > unfortuantely don't have a proxy server to try your code against, so I > have no way of helping here. Hopefully, someone will be able to help > you further with this issue. > > -- > Tom Shelton Tom, I don't think the proxy server si the issue, because i've tried it also from home, with no proxy server and i receive the same error message. Did it work for you ? Thanks, Ed
From: Cor Ligthert [MVP] on 30 Aug 2006 11:26 Edje, Did you already tried all the generating stuff in Net to access a webservice everything as WSDL is done for you behind the scene. In fact you have only to click on the button "WebServices" in your Solution explorer and use than that reference that you have created yourself.. Than you can use code as \\\ Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim me2 As New localhost.Service2 Me.Label1.Text = me2.GiveMeWhatTheMethodWillGiveInTheFormatItUses() End Sub /// This webpage describes it very nice. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vbwlkCreatingDistributedWebApplicationWalkthrough.asp I hope this helps a little bit. Cor "Edje" <Edje.Rommel(a)gmail.com> schreef in bericht news:1156950260.217895.181330(a)m79g2000cwm.googlegroups.com... > > Tom Shelton schreef: > >> Edje wrote: >> > Tom Shelton schreef: >> > >> > > Tom Shelton wrote: >> > > > Edje.Rommel(a)gmail.com wrote: >> > > > > Hello, >> > > > > >> > > > > I've have a problem with a webservice. I just want to validate a >> > > > > VAT >> > > > > number by country code and VAT numer. The return value should be >> > > > > like >> > > > > "it's valid" and/or the name where it's registered to. >> > > > > >> > > > > To do this i can access the webservice on the following location: >> > > > > http://ec.europa.eu/taxation_customs/vies/api/checkVatPort >> > > > > >> > > > > A WSDL file is also available: >> > > > > http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl. >> > > > > >> > > > > My question is how can i get the results i want. Can someone help >> > > > > me >> > > > > with just the little module that does the request. >> > > > > >> > > > > I already right-click on Web reference and added >> > > > > http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl, >> > > > > but >> > > > > when i want to use checkvat(country,VAT), it exepect 3 other >> > > > > fields and >> > > > > the return type seem to be date. >> > > > > >> > > > > My understanding is that i only have to use 2 parameters (via XML >> > > > > ?), >> > > > > and retrieve a string value (XML ?) >> > > > > >> > > > > I just need something like >> > > > > returnvalue = doRequest(country,VAT).valid >> > > > > Name = returnvalue.Name >> > > > > Valid = returnvalue.valid >> > > > > etc..... >> > > > > >> > > > > >> > > > > Thanks for all your help. >> > > > > >> > > > > Regards, >> > > > > >> > > > > Edje >> > > > >> > > > Option Strict On >> > > > Option Explicit On >> > > > >> > > > Imports System >> > > > Imports ConsoleApplication9.eu.europa.ec >> > > > >> > > > Module Module1 >> > > > >> > > > Sub Main() >> > > > Dim check As New checkVatService() >> > > > Dim countryCode As String = "CZ" >> > > > Dim vatNumber As String = "991 2311 23" >> > > > Dim valid As Boolean >> > > > Dim currentDate As Date >> > > > Dim name As String = String.Empty >> > > > Dim address As String = String.Empty >> > > > >> > > > currentDate = check.checkVat(countryCode, vatNumber, valid, >> > > > name, address) >> > > > >> > > > If valid Then >> > > > Console.WriteLine(name) >> > > > Console.WriteLine(address) >> > > > Console.WriteLine(currentDate) >> > > > Else >> > > > Console.WriteLine("invalid vat") >> > > > End If >> > > > End Sub >> > > > >> > > > End Module >> > > > >> > > > What I don't now a valid VAT, so I can't really test it. I just >> > > > get >> > > > back valid = false. I imported this into C#, and it shows the >> > > > arguments as: >> > > > >> > > > DateTime checkVat (ref string countryCode, ref string vatNumber, >> > > > out >> > > > bool valid, out string name, out string address) >> > > > >> > > > In C#, that means that the method will fill in the out parameters, >> > > > and >> > > > you must supply the ref parameters. In c# that means you must >> > > > initailize first, and it must be saved as a variable. VB.NET will >> > > > let >> > > > you get away with it by creating a temp value for you. But, as you >> > > > can >> > > > see I declare all these values in the above code.... So, based on >> > > > the >> > > > C# code I'm assuming that the VB.NET code actually works? >> > > > >> > > > -- >> > > > Tom Shelton >> > > >> > > Boy - I meant to point out that I'm using the vat numbers supplied >> > > adm. >> > > Didn't mean to take credit for that :) I was just trying to take >> > > his >> > > example a little farther. >> > > >> > > -- >> > > Tom Shelton >> > >> > >> > Tom, >> > >> > I tried this code (with proxy server), but i get the following error: >> > "The request failed with HTTP status 417: Expectation Failed." >> > The error is on the following row: >> > currentDate = check.checkVat(countryCode, vatNumber, valid, >> > name, address) >> > >> > Here is my code: >> > >> > Option Strict On >> > Option Explicit On >> > Imports BTWCheck.eu.europa.ec >> > Imports System.Net >> > Imports System >> > >> > >> > Module Module1 >> > >> > Sub Main() >> > Dim check As New checkVatService() >> > Dim countryCode As String = "BE" >> > Dim vatNumber As String = "4179951765" >> > Dim valid As Boolean >> > Dim currentDate As Date >> > Dim datestring As String >> > Dim name As String = String.Empty >> > Dim address As String = String.Empty >> > ' proxy settings >> > Dim cr As New System.Net.NetworkCredential("user", "pass", >> > "domain") >> > Dim pr As New System.Net.WebProxy("10.0.0.9", 8080) >> > pr.Credentials = cr >> > check.Proxy = pr >> > >> > >> > currentDate = check.checkVat(countryCode, vatNumber, valid, >> > name, address) >> > If valid Then >> > Console.WriteLine(name) >> > Console.WriteLine(address) >> > Console.WriteLine(currentDate) >> > Else >> > Console.WriteLine("invalid vat") >> > End If >> > End Sub >> > >> > >> > End Module >> > >> > Thanks for your help. >> > >> > >> > Ed >> >> Sorry Ed, I'm hitting the limits of my knowledge of web services. I >> haven't ever tri
From: adm on 30 Aug 2006 11:43 Edje wrote: > > Did it work for you ? > Hi all, I can confirm that this works: Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim check As New eu.europa.ec.checkVatService Dim countryCode As String = "CZ" Dim vatNumber As String = "991231123" Dim valid As Boolean Dim currentDate As Date Dim name As String = String.Empty Dim address As String = String.Empty currentDate = check.checkVat(countryCode, vatNumber, valid, name, address) Me.TextBox1.Text = currentDate.ToString End Sub End Class It will put the date (as returned by the webservice) in the text box. Thanks to Tom for the code. adm
From: Tom Shelton on 30 Aug 2006 11:44 Edje wrote: > Tom Shelton schreef: > > > Edje wrote: > > > Tom Shelton schreef: > > > > > > > Tom Shelton wrote: > > > > > Edje.Rommel(a)gmail.com wrote: > > > > > > Hello, > > > > > > > > > > > > I've have a problem with a webservice. I just want to validate a VAT > > > > > > number by country code and VAT numer. The return value should be like > > > > > > "it's valid" and/or the name where it's registered to. > > > > > > > > > > > > To do this i can access the webservice on the following location: > > > > > > http://ec.europa.eu/taxation_customs/vies/api/checkVatPort > > > > > > > > > > > > A WSDL file is also available: > > > > > > http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl. > > > > > > > > > > > > My question is how can i get the results i want. Can someone help me > > > > > > with just the little module that does the request. > > > > > > > > > > > > I already right-click on Web reference and added > > > > > > http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl, but > > > > > > when i want to use checkvat(country,VAT), it exepect 3 other fields and > > > > > > the return type seem to be date. > > > > > > > > > > > > My understanding is that i only have to use 2 parameters (via XML ?), > > > > > > and retrieve a string value (XML ?) > > > > > > > > > > > > I just need something like > > > > > > returnvalue = doRequest(country,VAT).valid > > > > > > Name = returnvalue.Name > > > > > > Valid = returnvalue.valid > > > > > > etc..... > > > > > > > > > > > > > > > > > > Thanks for all your help. > > > > > > > > > > > > Regards, > > > > > > > > > > > > Edje > > > > > > > > > > Option Strict On > > > > > Option Explicit On > > > > > > > > > > Imports System > > > > > Imports ConsoleApplication9.eu.europa.ec > > > > > > > > > > Module Module1 > > > > > > > > > > Sub Main() > > > > > Dim check As New checkVatService() > > > > > Dim countryCode As String = "CZ" > > > > > Dim vatNumber As String = "991 2311 23" > > > > > Dim valid As Boolean > > > > > Dim currentDate As Date > > > > > Dim name As String = String.Empty > > > > > Dim address As String = String.Empty > > > > > > > > > > currentDate = check.checkVat(countryCode, vatNumber, valid, > > > > > name, address) > > > > > > > > > > If valid Then > > > > > Console.WriteLine(name) > > > > > Console.WriteLine(address) > > > > > Console.WriteLine(currentDate) > > > > > Else > > > > > Console.WriteLine("invalid vat") > > > > > End If > > > > > End Sub > > > > > > > > > > End Module > > > > > > > > > > What I don't now a valid VAT, so I can't really test it. I just get > > > > > back valid = false. I imported this into C#, and it shows the > > > > > arguments as: > > > > > > > > > > DateTime checkVat (ref string countryCode, ref string vatNumber, out > > > > > bool valid, out string name, out string address) > > > > > > > > > > In C#, that means that the method will fill in the out parameters, and > > > > > you must supply the ref parameters. In c# that means you must > > > > > initailize first, and it must be saved as a variable. VB.NET will let > > > > > you get away with it by creating a temp value for you. But, as you can > > > > > see I declare all these values in the above code.... So, based on the > > > > > C# code I'm assuming that the VB.NET code actually works? > > > > > > > > > > -- > > > > > Tom Shelton > > > > > > > > Boy - I meant to point out that I'm using the vat numbers supplied adm. > > > > Didn't mean to take credit for that :) I was just trying to take his > > > > example a little farther. > > > > > > > > -- > > > > Tom Shelton > > > > > > > > > Tom, > > > > > > I tried this code (with proxy server), but i get the following error: > > > "The request failed with HTTP status 417: Expectation Failed." > > > The error is on the following row: > > > currentDate = check.checkVat(countryCode, vatNumber, valid, > > > name, address) > > > > > > Here is my code: > > > > > > Option Strict On > > > Option Explicit On > > > Imports BTWCheck.eu.europa.ec > > > Imports System.Net > > > Imports System > > > > > > > > > Module Module1 > > > > > > Sub Main() > > > Dim check As New checkVatService() > > > Dim countryCode As String = "BE" > > > Dim vatNumber As String = "4179951765" > > > Dim valid As Boolean > > > Dim currentDate As Date > > > Dim datestring As String > > > Dim name As String = String.Empty > > > Dim address As String = String.Empty > > > ' proxy settings > > > Dim cr As New System.Net.NetworkCredential("user", "pass", > > > "domain") > > > Dim pr As New System.Net.WebProxy("10.0.0.9", 8080) > > > pr.Credentials = cr > > > check.Proxy = pr > > > > > > > > > currentDate = check.checkVat(countryCode, vatNumber, valid, > > > name, address) > > > If valid Then > > > Console.WriteLine(name) > > > Console.WriteLine(address) > > > Console.WriteLine(currentDate) > > > Else > > > Console.WriteLine("invalid vat") > > > End If > > > End Sub > > > > > > > > > End Module > > > > > > Thanks for your help. > > > > > > > > > Ed > > > > Sorry Ed, I'm hitting the limits of my knowledge of web services. I > > haven't ever tried to use a web service through a proxy. I'm assuming > > that there is something wrong with your proxy settings? I > > unfortuantely don't have a proxy server to try your code against, so I > > have no way of helping here. Hopefully, someone will be able to help > > you further with this issue. > > > > -- > > Tom Shelton > > Tom, > > I don't think the proxy server si the issue, because i've tried it also > from home, with no proxy server and i receive the same error message. > > Did it work for you ? > > Thanks, > > Ed Well - it worked in that I don't receive an error with the code I originally posted. All I get back is valid = false. I checked the VAT on the eropa site and it also says it is invalid. So, to be honest unless I have a known valid VAT, I have know way of really knowing if it worked or not... I was hoping you could take my code, an
From: Edje on 30 Aug 2006 15:51 Tom Shelton schreef: > Edje wrote: > > Tom Shelton schreef: > > > > > Edje wrote: > > > > Tom Shelton schreef: > > > > > > > > > Tom Shelton wrote: > > > > > > Edje.Rommel(a)gmail.com wrote: > > > > > > > Hello, > > > > > > > > > > > > > > I've have a problem with a webservice. I just want to validate a VAT > > > > > > > number by country code and VAT numer. The return value should be like > > > > > > > "it's valid" and/or the name where it's registered to. > > > > > > > > > > > > > > To do this i can access the webservice on the following location: > > > > > > > http://ec.europa.eu/taxation_customs/vies/api/checkVatPort > > > > > > > > > > > > > > A WSDL file is also available: > > > > > > > http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl. > > > > > > > > > > > > > > My question is how can i get the results i want. Can someone help me > > > > > > > with just the little module that does the request. > > > > > > > > > > > > > > I already right-click on Web reference and added > > > > > > > http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl, but > > > > > > > when i want to use checkvat(country,VAT), it exepect 3 other fields and > > > > > > > the return type seem to be date. > > > > > > > > > > > > > > My understanding is that i only have to use 2 parameters (via XML ?), > > > > > > > and retrieve a string value (XML ?) > > > > > > > > > > > > > > I just need something like > > > > > > > returnvalue = doRequest(country,VAT).valid > > > > > > > Name = returnvalue.Name > > > > > > > Valid = returnvalue.valid > > > > > > > etc..... > > > > > > > > > > > > > > > > > > > > > Thanks for all your help. > > > > > > > > > > > > > > Regards, > > > > > > > > > > > > > > Edje > > > > > > > > > > > > Option Strict On > > > > > > Option Explicit On > > > > > > > > > > > > Imports System > > > > > > Imports ConsoleApplication9.eu.europa.ec > > > > > > > > > > > > Module Module1 > > > > > > > > > > > > Sub Main() > > > > > > Dim check As New checkVatService() > > > > > > Dim countryCode As String = "CZ" > > > > > > Dim vatNumber As String = "991 2311 23" > > > > > > Dim valid As Boolean > > > > > > Dim currentDate As Date > > > > > > Dim name As String = String.Empty > > > > > > Dim address As String = String.Empty > > > > > > > > > > > > currentDate = check.checkVat(countryCode, vatNumber, valid, > > > > > > name, address) > > > > > > > > > > > > If valid Then > > > > > > Console.WriteLine(name) > > > > > > Console.WriteLine(address) > > > > > > Console.WriteLine(currentDate) > > > > > > Else > > > > > > Console.WriteLine("invalid vat") > > > > > > End If > > > > > > End Sub > > > > > > > > > > > > End Module > > > > > > > > > > > > What I don't now a valid VAT, so I can't really test it. I just get > > > > > > back valid = false. I imported this into C#, and it shows the > > > > > > arguments as: > > > > > > > > > > > > DateTime checkVat (ref string countryCode, ref string vatNumber, out > > > > > > bool valid, out string name, out string address) > > > > > > > > > > > > In C#, that means that the method will fill in the out parameters, and > > > > > > you must supply the ref parameters. In c# that means you must > > > > > > initailize first, and it must be saved as a variable. VB.NET will let > > > > > > you get away with it by creating a temp value for you. But, as you can > > > > > > see I declare all these values in the above code.... So, based on the > > > > > > C# code I'm assuming that the VB.NET code actually works? > > > > > > > > > > > > -- > > > > > > Tom Shelton > > > > > > > > > > Boy - I meant to point out that I'm using the vat numbers supplied adm. > > > > > Didn't mean to take credit for that :) I was just trying to take his > > > > > example a little farther. > > > > > > > > > > -- > > > > > Tom Shelton > > > > > > > > > > > > Tom, > > > > > > > > I tried this code (with proxy server), but i get the following error: > > > > "The request failed with HTTP status 417: Expectation Failed." > > > > The error is on the following row: > > > > currentDate = check.checkVat(countryCode, vatNumber, valid, > > > > name, address) > > > > > > > > Here is my code: > > > > > > > > Option Strict On > > > > Option Explicit On > > > > Imports BTWCheck.eu.europa.ec > > > > Imports System.Net > > > > Imports System > > > > > > > > > > > > Module Module1 > > > > > > > > Sub Main() > > > > Dim check As New checkVatService() > > > > Dim countryCode As String = "BE" > > > > Dim vatNumber As String = "4179951765" > > > > Dim valid As Boolean > > > > Dim currentDate As Date > > > > Dim datestring As String > > > > Dim name As String = String.Empty > > > > Dim address As String = String.Empty > > > > ' proxy settings > > > > Dim cr As New System.Net.NetworkCredential("user", "pass", > > > > "domain") > > > > Dim pr As New System.Net.WebProxy("10.0.0.9", 8080) > > > > pr.Credentials = cr > > > > check.Proxy = pr > > > > > > > > > > > > currentDate = check.checkVat(countryCode, vatNumber, valid, > > > > name, address) > > > > If valid Then > > > > Console.WriteLine(name) > > > > Console.WriteLine(address) > > > > Console.WriteLine(currentDate) > > > > Else > > > > Console.WriteLine("invalid vat") > > > > End If > > > > End Sub > > > > > > > > > > > > End Module > > > > > > > > Thanks for your help. > > > > > > > > > > > > Ed > > > > > > Sorry Ed, I'm hitting the limits of my knowledge of web services. I > > > haven't ever tried to use a web service through a proxy. I'm assuming > > > that there is something wrong with your proxy settings? I > > > unfortuantely don't have a proxy server to try your code against, so I > > > have no way of helping here. Hopefully, someone will be able to help > > > you further with this issue. > > > > > > -- > > > Tom Shelton > > > > Tom, > > > > I don't think the proxy server si the issue, because i've tried it also > > from home, with no proxy server and i receive the same error message. > > > > Did it work for you ?
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: SplitContainer Next: Retrieving COM class Factory failed: 8007007f |