Select * From World where type="computing";
How to Use an Existing Web Service in VB.NET
The aim of the following tutorial is to give you a basic information about Web Service
To execute the example in this tutorial you need visual studio 2005 or 2008 :
This is an express edition of visual studio 2008 VS2008
In this tutorial we will create a form that gets information from a web service about the euro2008 (Europe football cup) .
Firstly select a vb.net project and design a form like this:
In this form we will show a list of all stadiums, teams of euro2008 football cup.
Select a stadium and click the button Click, the application gets the city and capacity of the stadium selected in the stadium combobox from the webservice.
Now let’s select the reference to the web service, right click to the service references, add a service reference.
Secondly we will add the link of web service to our project: http://euro2008.dataaccess.eu/footballpoolwebservice.wso?WSDL , and click “go to” then wait until VB find to webservice, now specifiy a name for the space name of the web service then click ok, the Visual Basic generates different configuration files :
Now let’s write some code in the form to make the web service works correctly:
Public Class Form1
‘ ServiceReference1 is the name space that you chose
Public ws As New ServiceReference2.FootballPoolWebServiceSoapTypeClient
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
‘ define the staduim_lenght and the numbers of teams
Dim stadium_lenght, Team_count As Integer
stadium_lenght = ws.StadiumNames.Count
stadium_lenght -= 1
‘ add names of staduims from the web service to the combobox1
For i = 0 To stadium_lenght
ComboBox1.Items.Add(ws.StadiumNames.Item(i).Trim())
Next i
Team_count = ws.Teams.Count
Team_count -= 1
‘add names of teams from the web service to the combobox2
For j = 0 To Team_count
ComboBox2.Items.Add(ws.Teams.ElementAt(j).sName)
Next j
ComboBox1.SelectedIndex = 0
ComboBox2.SelectedIndex = 0
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
‘ Select then city name, staduim name, and the capacity of the stadium ‘chosen in combobox1
TextBox1.Text = ws.StadiumInfo(ComboBox1.SelectedItem.ToString()).sCityName
TextBox2.Text = ws.StadiumInfo(ComboBox1.SelectedItem.ToString()).sStadiumName
TextBox3.Text = ws.StadiumInfo(ComboBox1.SelectedItem.ToString()).iSeatsCapacity
End Sub
End Class
This is how the interface application looks at executing the program:
You created your first interaction with an existing web service (euro2008), if you have any comments or remarks post it in my blog or alert me by email.





about 1 year ago
Most of the times i visit a blog I notice that most blogs are amateurish.On the other hand,I could honestly say that you writting is decent and your website solid.
about 1 year ago
Aw, this was a really nice post. In concept I wish to put in writing like this moreover – taking time and actual effort to make a very good article… however what can I say… I procrastinate alot and by no means appear to get one thing done.
about 1 year ago
You made certain fine points there. I did a search on the subject matter and found the majority of persons will consent with your blog.
about 11 months ago
very good put up, i certainly love this website, keep on it
about 11 months ago
Nice post! This really helps me to find the answers to my question. Hoping that you will continue posting an article having a useful information. Thanks a lot!
about 11 months ago
Hi! Nice site ….)
about 11 months ago
Excellent post. I was checking constantly this blog and I’m impressed! Very helpful information particularly the last part
I care for such info a lot. I was looking for this certain info for a long time. Thank you and good luck.
about 11 months ago
Excellent post indeed. My father has been waiting for this content
about 11 months ago
I enjoy the functionality of your blog. Could you let me know what plugins are you currently using?
about 11 months ago
Good stuff, I anticipate reading even more.
about 11 months ago
Very Interesting Blog! Thank You For Thi Post!
about 1 month ago
Nice post, thanks for shareing the info, keep posting like this