<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fouad&#039;s Blog &#187; DotNET</title>
	<atom:link href="http://www.fouad-saidy.com/archives/category/dotnet/feed" rel="self" type="application/rss+xml" />
	<link>http://www.fouad-saidy.com</link>
	<description>Select * From World where type=&#34;computing&#34;;</description>
	<lastBuildDate>Thu, 17 Mar 2011 14:20:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to Use an Existing Web Service in VB.NET</title>
		<link>http://www.fouad-saidy.com/archives/205</link>
		<comments>http://www.fouad-saidy.com/archives/205#comments</comments>
		<pubDate>Fri, 12 Mar 2010 23:12:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[DotNET]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Web service]]></category>

		<guid isPermaLink="false">http://fouad-saidy.freehostia.com/?p=205</guid>
		<description><![CDATA[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  <a href="http://www.fouad-saidy.com/archives/205" class="more-link">More &#62;</a><p><a href="http://sharethis.com/item?&#038;wp=2.8.2&#38;publisher=c52c2557-5007-4da4-b176-d174646fb516&#38;title=How+to+Use+an+Existing+Web+Service+in+VB.NET&#38;url=http%3A%2F%2Fwww.fouad-saidy.com%2Farchives%2F205">ShareThis</a></p>]]></description>
			<content:encoded><![CDATA[<p>The aim of the following tutorial is to give you a basic information about Web Service<br />
 To execute the example in this tutorial you need visual studio 2005 or 2008 :<br />
This is an express edition of visual studio 2008 <a href="http://msdn.microsoft.com/en-us/vstudio/aa700831.aspx">VS2008</a><br />
In this tutorial we will create a form that gets information from a web service about the <a href="http://euro2008.dataaccess.eu/footballpoolwebservice.wso">euro2008</a> (Europe football cup) .<br />
Firstly select a vb.net project and design a form like this:</p>
<div id="attachment_208" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.fouad-saidy.com/wp-content/uploads/2010/03/webservice12.jpg" rel="lightbox-205"><img src="http://www.fouad-saidy.com/wp-content/uploads/2010/03/webservice12-300x222.jpg" alt="Application Interface" title="webservice1" width="300" height="222" class="size-medium wp-image-208" /></a><p class="wp-caption-text">Application Interface</p></div><br />
In this form we will show a list of all stadiums, teams of <a href="http://euro2008.dataaccess.eu/footballpoolwebservice.wso">euro2008</a> football cup.<br />
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.<br />
Now let’s select the reference to the web service, right click to the service references, add a service reference.</p>
<p><div id="attachment_209" class="wp-caption aligncenter" style="width: 237px"><a href="http://www.fouad-saidy.com/wp-content/uploads/2010/03/webservice2.jpg" rel="lightbox-205"><img src="http://www.fouad-saidy.com/wp-content/uploads/2010/03/webservice2-227x300.jpg" alt="Service References" title="webservice2" width="227" height="300" class="size-medium wp-image-209" /></a><p class="wp-caption-text">Service References</p></div>
<p>Secondly we will add the link of web service to our project: <strong>http://euro2008.dataaccess.eu/footballpoolwebservice.wso?WSDL</strong> , and click &#8220;go to&#8221; 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 :</p>
<div id="attachment_210" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.fouad-saidy.com/wp-content/uploads/2010/03/webservice3.jpg" rel="lightbox-205"><img src="http://www.fouad-saidy.com/wp-content/uploads/2010/03/webservice3-300x244.jpg" alt="Add Service References" title="webservice3" width="300" height="244" class="size-medium wp-image-210" /></a><p class="wp-caption-text">Add Service References</p></div>
<p>Now let’s write some code in the form to make the web service works correctly:</p>
<p><em>Public Class Form1<br />
‘ ServiceReference1 is the name space that you chose<br />
    Public ws As New ServiceReference2.FootballPoolWebServiceSoapTypeClient</p>
<p>    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load</p>
<p>        ‘ define the staduim_lenght and the numbers of teams<br />
        Dim stadium_lenght, Team_count As Integer</p>
<p>        stadium_lenght = ws.StadiumNames.Count<br />
        stadium_lenght -= 1</p>
<p>	‘ add names of staduims from the web service to the combobox1<br />
        For i = 0 To stadium_lenght</p>
<p>            ComboBox1.Items.Add(ws.StadiumNames.Item(i).Trim())<br />
        Next i</p>
<p>        Team_count = ws.Teams.Count<br />
        Team_count -= 1</p>
<p>        ‘add names of teams from the web service to the combobox2 </p>
<p>        For j = 0 To Team_count</p>
<p>            ComboBox2.Items.Add(ws.Teams.ElementAt(j).sName)<br />
        Next j<br />
        ComboBox1.SelectedIndex = 0<br />
        ComboBox2.SelectedIndex = 0<br />
    End Sub</p>
<p>    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click</p>
<p>‘ Select then city name, staduim name, and the capacity of the stadium ‘chosen in combobox1</p>
<p>        TextBox1.Text = ws.StadiumInfo(ComboBox1.SelectedItem.ToString()).sCityName<br />
        TextBox2.Text = ws.StadiumInfo(ComboBox1.SelectedItem.ToString()).sStadiumName<br />
        TextBox3.Text = ws.StadiumInfo(ComboBox1.SelectedItem.ToString()).iSeatsCapacity</p>
<p>    End Sub<br />
End Class</em></p>
<p>This is how the  interface application looks at executing the program:<br />
<div id="attachment_214" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.fouad-saidy.com/wp-content/uploads/2010/03/webservice4.jpg" rel="lightbox-205"><img src="http://www.fouad-saidy.com/wp-content/uploads/2010/03/webservice4-300x218.jpg" alt="Executing Application" title="webservice4" width="300" height="218" class="size-medium wp-image-214" /></a><p class="wp-caption-text">Executing Application</p></div></p>
<p>You created your first interaction with an existing web service  (<a href="http://euro2008.dataaccess.eu/footballpoolwebservice.wso">euro2008</a>), if you have any comments or remarks post it in my blog or alert me by email.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fouad-saidy.com/archives/205/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

