473,511 Members | 16,068 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use this service ??? WSDL available

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...i/checkVatPort

A WSDL file is also available:
http://ec.europa.eu/taxation_customs...ckVatPort?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...ckVatPort?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

Aug 29 '06 #1
13 8441
adm
Ed*********@gmail.com wrote:
My question is how can i get the results i want. Can someone help me
with just the little module that does the request.
Once you've added the web reference, you can do this sort of thing in a
method or sub:

Dim ws As New WindowsApplication1.eu.europa.ec.checkVatService
Dim result As Date

result = ws.checkVat("US", "20", True, "sample", "address")

The web service you mentioned has at least two methods: checkVatService
and checkVatServiceAsync. The latter is only looking for two input
parameters, but it doesn't return a value. The former returns a value
(a date), but expects five input parameters (which will show up in
Intellisense).

I don't know enough about this webservice to say what values in those
parameters are valid, but I can tell you that the values in my example
above are the right data type but cause an error, so obviously
something is wrong with them.

But if you know the right range of values to pass in, you should be
able to get a valid response (a date) back.

hth a little bit.

adm

Aug 29 '06 #2
adm
adm wrote:
I don't know enough about this webservice to say what values in those
parameters are valid, but I can tell you that the values in my example
above are the right data type but cause an error, so obviously
something is wrong with them.
Ok, I looked into VAT numbers a little bit so I could better understand
what kinds of values the web service is expecting. The values I passed
in above are not right: the web method is expecting (at least) two
strings, not a string and a number.

I changed my code to:

ws.checkVat("CZ", "991231123")

But I am getting an {INVALID_INPUT} error back.

When I run equivalent code in PHP, it seems to work fine, that is,
there is no error thrown, and I get an array back with the values I
passed to the service.

This leads me to believe that the SOAP service is not accepting
parameters from the .NET client in the way that we are used to seeing
with .NET-based web services. So maybe these parameters need to be
presented to the service differently. If someone has some expertise in
passing "complex" parameters to non-.NET web services, maybe they can
chime in with the (simple?) solution.

Aug 29 '06 #3

Ed*********@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...i/checkVatPort

A WSDL file is also available:
http://ec.europa.eu/taxation_customs...ckVatPort?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...ckVatPort?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

Aug 30 '06 #4

Tom Shelton wrote:
Ed*********@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...i/checkVatPort

A WSDL file is also available:
http://ec.europa.eu/taxation_customs...ckVatPort?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...ckVatPort?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

Aug 30 '06 #5
adm

Tom Shelton wrote:
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.
your example is great, tom. i am going to try this on wednesday...my
full code was very similar to this, but only gave me input errors. i
wonder what the problem is. that insight into "in" and "out" is
helpful. PHP worked by passing two parameters in and getting 5 back,
but VB didn't want to do me that kindness.

also, it seems like a misspoke on that checkVatAsync above. Is it just
an artifact of the proxy class? I thought that might be the case after
I actually looked at the WSDL.

adm

Aug 30 '06 #6

Tom Shelton schreef:
Tom Shelton wrote:
Ed*********@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...i/checkVatPort
>
A WSDL file is also available:
http://ec.europa.eu/taxation_customs...ckVatPort?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...ckVatPort?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

Aug 30 '06 #7

Edje wrote:
Tom Shelton schreef:
Tom Shelton wrote:
Ed*********@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...i/checkVatPort

A WSDL file is also available:
http://ec.europa.eu/taxation_customs...ckVatPort?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...ckVatPort?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

Aug 30 '06 #8

Tom Shelton schreef:
Edje wrote:
Tom Shelton schreef:
Tom Shelton wrote:
Ed*********@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...i/checkVatPort
>
A WSDL file is also available:
http://ec.europa.eu/taxation_customs...ckVatPort?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...ckVatPort?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

Aug 30 '06 #9
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/de...alkthrough.asp

I hope this helps a little bit.

Cor

"Edje" <Ed*********@gmail.comschreef in bericht
news:11**********************@m79g2000cwm.googlegr oups.com...
>
Tom Shelton schreef:
>Edje wrote:
Tom Shelton schreef:

Tom Shelton wrote:
Ed*********@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...i/checkVatPort
>
A WSDL file is also available:
http://ec.europa.eu/taxation_customs...ckVatPort?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...ckVatPort?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

Aug 30 '06 #10
adm

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

Aug 30 '06 #11

Edje wrote:
Tom Shelton schreef:
Edje wrote:
Tom Shelton schreef:
>
Tom Shelton wrote:
Ed*********@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...i/checkVatPort

A WSDL file is also available:
http://ec.europa.eu/taxation_customs...ckVatPort?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...ckVatPort?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, and insert a
known good VAT (one that validates on the website) and see what you get
back.

--
Tom Shelton

Aug 30 '06 #12

Tom Shelton schreef:
Edje wrote:
Tom Shelton schreef:
Edje wrote:
Tom Shelton schreef:

Tom Shelton wrote:
Ed*********@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...i/checkVatPort
>
A WSDL file is also available:
http://ec.europa.eu/taxation_customs...ckVatPort?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...ckVatPort?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, and insert a
known good VAT (one that validates on the website) and see what you get
back.

--
Tom Shelton

Tom,

Excuse me a lot, you were right. I made a mistake in my code. It works
perfectly, exactly what i needed !!!!!!!!

Thanks for your great help !!!!
Thanks,

Ed

Aug 30 '06 #13

Edje wrote:
Tom Shelton schreef:
Edje wrote:
Tom Shelton schreef:
>
Edje wrote:
Tom Shelton schreef:
>
Tom Shelton wrote:
Ed*********@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...i/checkVatPort

A WSDL file is also available:
http://ec.europa.eu/taxation_customs...ckVatPort?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...ckVatPort?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, and insert a
known good VAT (one that validates on the website) and see what you get
back.

--
Tom Shelton


Tom,

Excuse me a lot, you were right. I made a mistake in my code. It works
perfectly, exactly what i needed !!!!!!!!

Thanks for your great help !!!!
Thanks,

Ed
Great! I am happy to be of service.

--
Tom Shelton

Aug 30 '06 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
528
by: PatrickSA | last post by:
Hi, Am new to web services, so apologies for the basic nature of the question - and apologies in advance if this is the wrong newsgroup. We're building a new web service and I'm looking around...
0
1761
by: David | last post by:
My "question" is on WebServices. How can i know that a sevice is available ?. I know there is the onserviceavailable property that enable a function when the WebService behavior got WSDL. But...
4
2917
by: Joe | last post by:
I'm hosting my web service on a Windows 2003 box which is remotely located. When trying to add a web reference to a C# project I get an error message 'There was an error downloading...
8
7171
by: Marc | last post by:
Hi! I'm calling a web service using C# and a wrapper class generated by wsdl tool. The web service specification contains some nillable parameters which types are Value Types in .NET (long, int,...
3
5046
by: Jerome Cohen | last post by:
AI am trying to call a third-party web service. this service expects an XML fragment that contains the request plus other parameter. adding the web reference created the syntax below(reference.vb)....
1
4259
by: sun_hcl | last post by:
I am using windows RMS software which is based on .NET Web Service. Well it provides lot of functionality exposed in form of Web SERVICES. I want to know whether i can override the web service....
3
3120
by: GT | last post by:
I have a .NET client that consumes an Axis web service. A change was made recently to the AXIS web service, and ever since then my .NET proxy class has been throwing an InvalidCastException. The...
1
1981
by: Nestor | last post by:
Hello all, I'm begining in the web services world and I've reading about how to invoke them using javascript from Mozilla browser (version 2.0 in my case). I found a very interesting example...
5
2549
by: cj | last post by:
Back some time ago I was playing with a little app in VB 2005 that used a google web service to get search results. I was rebuilding this app in 2008 today. I added the web service...
0
2819
by: =?ISO-8859-1?Q?Jan_Thom=E4?= | last post by:
Hi, I've been trying like a madman to make my WSDL work with .net, but it seems I am out of luck. Whenever I add a service reference to Visual C#, the code gets generated fine, however all...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7418
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7075
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7508
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
446
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.