Vous êtes sur la page 1sur 26

CATEGORIA TEMATIC

PROGRAMARE WEB
Cuprins
1. Servicii web ASP .NET..............................................................................6
1.1. Introducere.................................................................................................6
1.. Servicii Web ASP .NET.............................................................................6
1.!. Servicii web ASP .NET "i Micro#o$t S%& Server ''(..........................1)
1.). &ucru* cu #ervicii web di#+onibi*e +e Internet.........................................
. Bib*io,r-$ie...............................................................................................
!
Lista figurilor
$i,ur- 1/1 Cre-re- unui #erviciu WEB 011..................................................................................6
$i,ur- 1/ 2ere-#tr- So*ution E3+*orer........................................................................................
$i,ur- 1/! Te#t-re- #erviciu*ui web 011.......................................................................................(
$i,ur- 1/) Te#t-re- #erviciu*ui web 01.......................................................................................(
$i,ur- 1/4 Te#t-re- #erviciu*ui web 0!1.......................................................................................(
$i,ur- 1/6 Te#t-re- #erviciu*ui web 0)1.......................................................................................5
$i,ur- 1/. Te#t-re- #erviciu*ui web 041.......................................................................................5
$i,ur- 1/( Te#t-re- #erviciu*ui web 061.....................................................................................1'
$i,ur- 1/5 Te#t-re- #erviciu*ui web 0.1.....................................................................................1'
$i,ur- 1/1' Te#t-re- #erviciu*ui web 0(1...................................................................................1'
$i,ur- 1/11 Ad6u,-re- unei re$erin7e c6tre un #erviciu web 011................................................11
$i,ur- 1/1 Ad6u,-re- unei re$erin7e c6tre un #erviciu web 01...............................................11
$i,ur- 1/1! Ad6u,-re- unei re$erin7e c6tre un #erviciu web 0!1...............................................1
$i,ur- 1/1) Ad6u,-re- unei re$erin7e c6tre un #erviciu web 011...............................................1!
$i,ur- 1/14 Ad6u,-re- unei re$erin7e c6tre un #erviciu web 01...............................................1!
$i,ur- 1/16 Te#t-re- #erviciu*ui web.........................................................................................1)
$i,ur- 1/1. Te#t-re- #erviciu*ui web 011...................................................................................1(
$i,ur- 1/1( Te#t-re- 8etodei adaugaNota 011..........................................................................1(
$i,ur- 1/15 Te#t-re- 8etodei adaugaNota 01..........................................................................15
$i,ur- 1/' Te#t-re- 8etodei getData_tblStudenti...................................................................15
$i,ur- 1/1 Te#t-re- 8etodei getSituatieStudent 011................................................................15
$i,ur- 1/ Te#t-re- 8etodei getSituatieStudent 01................................................................'
$i,ur- 1/! Ad6u,-re- unei re$erin7e c6tre un #erviciu web 011...............................................
$i,ur- 1/) Ad6u,-re- unei re$erin7e c6tre un #erviciu web 01...............................................!
$i,ur- 1/4 9e#criere- 8etode*or e3+u#e de #erviciu* web 0!1................................................!
$i,ur- 1/6 Ad6u,-re- unei re$erin7e c6tre un #erviciu web 0)1...............................................)
$i,ur- 1/. Ad6u,-re- unei re$erin7e c6tre un #erviciu web 011...............................................4
)
Lista tabelelor
No table of figures entries found.
4
1. Servicii web ASP .NET
1.1. Introducere
Serviciile Web 0web #ervice#1 / re+re:int6 o co8+onent6 c;eie - +*-t$or8ei ASP.NET
"i o$er6 +ro,r-8-toru*ui +o#ibi*it-te- de - cre- *ibr6rii de $unc7ii 0#ervicii1< -cce#ibi*e -*tor
uti*i:-tori=+ro,r-8-tori +rin inter8ediu* re7e*e*or 0*oc-* intr-net< internet1. Servicii*e web #e
b-:e-:6 +e un +rotoco* de co8unic-7ie< inde+endent de +*-t$or86< nu8it SAP 0Si8+*e
Ob>ect Acce## Protoco*1< c-re -#i,ur6 un nive* ridic-t de intero+er-bi*it-te cro##/+*-t$or8?@..
Servicii*e web #unt de#cri#e +rin inter8ediu* *i8b->u*ui WS!L. WS!L 0Web Services
Description Language1 #-u &i8b->u* de 9e#criere - Servicii*or Web e#te un *i8b-> b-:-t +e
AM& ce o$er6 un 8ode* de de#criere - #ervicii*or web. WS!L de$ine#te #ervicii*e c- o
co*ectie de +orturi< #-u +uncte ter8in-*e Bntr/o re7e-. WS!L e#te -de#e- uti*i:-t Bn co8bin-7ie
cu SAP "i "#L Sc$e%a +entru - o$eri #ervicii web +rin inter8ediu* Internetu*ui. Cn
+ro,r-8 c*ient #e +o-te conect- *- un #erviciu web "i -+oi +o-te citi WS!L/u* +entru -
deter8in- 8etode*e e3+u#e de c6tre #erviciu* web. 9e -#e8ene-< c*ientu* +o-te uti*i:- SAP
+entru -+e*-re- 8etode*or e3+u#e de c6tre #erviciu* web ?1@.. Cn e3e8+*u c*-#ic de #erviciu
web e#te #i#te8u* ce +er8ite ob7inere- cur#u*ui de #c;i8b v-*ut-r.
1.&. Servicii Web ASP .NET
Crearea unui serviciu web D #e -ctive-:6 8eniu* File, New "i -+oi #e #e*ecte-:6 o+7iune-
New Web Site. 9in $ere-#tr- +re:ent-t6 Bn $i,ur- 1 /1 #e #e*ecte-:6 ASP. NET Web Service i-r
-+oi #e #e*ecte-:6 *i8b->u* de +ro,r-8-re Bn c-re v- $i re-*i:-t #erviciu* web 0Ei#u-* CF<
Ei#u-*1. 9in *i#t- Web location #e #e*ecte-:6 de#tin-7i- #erviciu*ui web. 9e#tin-7i- +o-te $iG un
#erver HTTP< unu* 2TP #-u c;i-r #i#te8u* de $i"iere de +e c-*cu*-toru* *oc-*. O+7ion-*< #e
#c;i8b6 nu8e*e "i *oc-7i- #erviciu*ui web. In ,ener-*< +e +erio-d- de:vo*t6rii< un #erviciu web
ASP .NET v- $i ,6:duit *oc-* "i du+6 ce e#te $in-*i:-t v- $i tr-n#$er-t +e un #erver IIS.
$i,ur- 1/1 Cre-re- unui #erviciu WEB 011
6
$i,ur- 1/ 2ere-#tr- So*ution E3+*orer
Pri%ul serviciu web
Codu* #ur#6 core#+un:6tor $i"ieru*ui Service.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
[WebService(Namespace = "ttp!""tempuri.org""#$
[WebService%in&ing(Con'orms(o = Wsi)ro'iles.%asic)ro'ile*+*#$
"" (o allo, tis Web Service to be calle& 'rom script- using .S).N/(
.0.1- ""uncomment te 'ollo,ing line.
"" [System.Web.Script.Services.ScriptService$
public class Service ! System.Web.Services.WebService
2
public Service (# 2
""3ncomment te 'ollo,ing line i' using &esigne& components
""4nitiali5eComponent(#;
6
[Web7eto&$
public string 8elloWorl&(# 2
return "8ello Worl&";
6
6
S+-7iu* de nu8e core#+un:6tor nou*ui #erviciu web e#te #et-t i8+*icit +e v-*o-re-
"ttp!""tempuri.org"". Ace-#t6 v-*o-re +o-te $i uti*i:-t6 +e to-t6 dur-t- de:vo*t6rii
#erviciu*ui web< d-r trebuie #c;i8b-t6 Bn 8o8entu* +ub*ic6rii #erviciu*ui web. bs.'
S+-7iu* de nu8e nu trebuie #6 indice Bn 8od ob*i,-toriu c6tre o re#ur#6 web.
C*-#- core#+un:6to-re nou*ui #erviciu web e#te Service.
Metode*e -cce#ibi*e c*ien7i*or #erviciu*ui web #unt etic;et-te [Web7eto&$.
Codu* core#+un:6tor $i"ieru*ui Service.as%(
9:; WebService Language="C<" Co&e%ein&="=".pp+Co&e"Service.cs"
Class="Service" :>
P-,in- Service.as%( $urni:e-:6 o #erie de in$or8-7ii *e,-te de #erviciu* web "i o$er6
-cce# *- 8etode*e -ce#tui-.
.
Testarea serviciului web D co8+i*-7i "i *-n#-7i Bn e3ecu7ie -+*ic-7i- web ASP .NET
core#+un:6to-re #erviciu*ui web. Brow#er/u* de Internet v- -$i"- o +-,in6 cu to-te 8etode*e
e3+u#e de c6tre #erviciu* web 0$i,ur- 1 /!1. Pentru te#t-re- 8etodei HelloWorld e$ectu-7i
c*icJ de 8ou#e +e *inJ/u* -#oci-t "i -+oi +e butonu* InvoJe 0$i,ur- 1 /)1. $i,ur- 1 /4 +re:int6
re:u*t-tu* e3ecu7iei +e #erver - 8etodei HelloWorld.
$i,ur- 1/! Te#t-re- #erviciu*ui web 011
$i,ur- 1/) Te#t-re- #erviciu*ui web 01
$i,ur- 1/4 Te#t-re- #erviciu*ui web 0!1
(
Te%)* -d6u,-7i #erviciu*ui web o nou6 8etod6 c-re v- Bnto-rce d-t- "i or- curent6 de +e
#erver.
+e,olvare 0$i,ur- 1 /6< $i,ur- 1 /.1
[Web7eto&$
public string get?ate(ime(#
2
return ?ate(ime.No,.(oString(#;
6
$i,ur- 1/6 Te#t-re- #erviciu*ui web 0)1
$i,ur- 1/. Te#t-re- #erviciu*ui web 041
Te%)* -d6u,-7i #erviciu*ui web o nou6 8etod6 c-re v- Bnto-rce d-t- "i or- curent6 de +e
#erver< Bn $or8-tu* #+eci$ic-t de c6tre uti*i:-tor.
+e,olvare 0$i,ur- 1 /(< $i,ur- 1 /5< $i,ur- 1 /1'1
[Web7eto&$
public string get@ormatte&?ate(ime(string 'ormat#2
return ?ate(ime.No,.(oString('ormat#;
6
5
$i,ur- 1/( Te#t-re- #erviciu*ui web 061
$i,ur- 1/5 Te#t-re- #erviciu*ui web 0.1
bs.' Pentru $iec-re +-r-8etru #e v- ,ener- Bn 8od i8+*icit o c-#et6 te3t Bn c-re uti*i:-toru*
+o-te introduce v-*o-re- dorit6.
$i,ur- 1/1' Te#t-re- #erviciu*ui web 0(1
1'
Testarea serviciului web prin inter%ediul unui progra% client scris -n li%ba.ul /isual
C0
Co8+i*-7i "i *-n#-7i Bn e3ecu7ie -+*ic-7i- web ASP .NET core#+un:6to-re #erviciu*ui web.
Cre-7i o nou6 -+*ic-7ie Ei#u-* CF de ti+u* Console Application.
Ad6u,-7i o re$erin76 c6tre #erviciu* webG
o 9in $ere-#tr- Solution E(plorer e$ectu-7i c*icJ dre-+t- de 8ou#e +e #ec7iune-
+eferences i-r din 8eniu* deru*-nt -*e,e7i o+7iune- Add Service Reerence ...
0$i,ur- 1 /111.
$i,ur- 1/11 Ad6u,-re- unei re$erin7e c6tre un #erviciu web 011
o In #ec7iune- CR& 0$i,ur- 1 /11 introduce7i CR&/u* #erviciu*ui web. Pentru un
#erviciu web -$*-t Bn #t-diu* de de:vo*t-re 0ne+ub*ic-t1< CR&/u* coincide cu -dre#-
+-,inii web ce v- $i -$i"-t6 *- *-n#-re- Bn e3ecu7ie - -+*ic-7iei ASP .NET
core#+un:6to-re #erviciu*ui web.
o E$ectu-7i c*icJ de 8ou#e +e butonu* 1o 0$i,ur- 1 /11 "i -+oi +e butonu* 2.

$i,ur- 1/1 Ad6u,-re- unei re$erin7e c6tre un #erviciu web 01
11
$i,ur- 1/1! Ad6u,-re- unei re$erin7e c6tre un #erviciu web 0!1
Ad6u,-7i Bn 8etod- !ain"...# ur86to-re- #ecven76 de cod.
ServiceAe'erence*.ServiceSoapClient obBServWeb = ne,
ServiceAe'erence*.ServiceSoapClient(#;
Console.WriteLine(".pel meto&a 8elloWorl&(#! " C obBServWeb.8elloWorl&(##;
Console.WriteLine(".pel meto&a get?ate(ime(#! " C
obBServWeb.get?ate(ime(##;
Console.WriteLine(".pel meto&a get@ormatte&?ate(ime(#! " C
obBServWeb.get@ormatte&?ate(ime("yyyy!77!&& !mm!ss"##;
Testarea serviciului web prin inter%ediul unei aplica3ii web ASP .NET
Co8+i*-7i "i *-n#-7i Bn e3ecu7ie -+*ic-7i- web ASP .NET core#+un:6to-re #erviciu*ui web.
Cre-7i o nou6 -+*ic-7ie web ASP .NET.
Ad6u,-7i o re$erin76 c6tre #erviciu* webG
o 9in $ere-#tr- Solution E(plorer e$ectu-7i c*icJ dre-+t- de 8ou#e +e nu8e*e #ite/
u*ui web i-r din 8eniu* deru*-nt -*e,e7i o+7iune- Add Web Reerence ... 0$i,ur- 1
/1)1.
o In #ec7iune- CR& 0$i,ur- 1 /141 introduce7i CR&/u* #erviciu*ui web. Pentru un
#erviciu web -$*-t Bn #t-diu* de de:vo*t-re 0ne+ub*ic-t1< CR&/u* coincide cu -dre#-
+-,inii web ce v- $i -$i"-t6 *- *-n#-re- Bn e3ecu7ie - -+*ic-7iei ASP .NET
core#+un:6to-re #erviciu*ui web.
o E$ectu-7i c*icJ de 8ou#e +e iconi7- 1o 0$i,ur- 1 /141 "i -+oi +e butonu* Add
+eference 0$i,ur- 1 /141.
1
$i,ur- 1/1) Ad6u,-re- unei re$erin7e c6tre un #erviciu web 011
$i,ur- 1/14 Ad6u,-re- unei re$erin7e c6tre un #erviciu web 01
1!
Ad6u,-7i Bn 8etod- Page$Load ur86to-re- #ecven76 de cod.
localost.Service obBServWeb = ne, localost.Service(#;
Aesponse.Write(".pel meto&a 8elloWorl&(#! " C obBServWeb.8elloWorl&(##;
Aesponse.Write("9br>.pel meto&a get?ate(ime(#! " C
obBServWeb.get?ate(ime(##;
Aesponse.Write("9br>.pel meto&a get@ormatte&?ate(ime(#! " C
obBServWeb.get@ormatte&?ate(ime("yyyy!77!&& !mm!ss"##;
$i,ur- 1/16 Te#t-re- #erviciu*ui web
1.4. Servicii web ASP .NET 5i #icrosoft S6L Server &778
E(.*
1. Crea3i un nou serviciu web ASP .NET.
Codu* core#+un:6tor $i"ieru*ui Service.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.?ata.SqlClient;
using System.1ml;
[WebService(Namespace = "ttp!""tempuri.org""#$
[WebService%in&ing(Con'orms(o = Wsi)ro'iles.%asic)ro'ile*+*#$
public class Service ! System.Web.Services.WebService
2
SqlConnection conn;
public Service (# 2
6
public bool getConnecte&(#
2
try
2
""&e'inirea sirului &e coneDiune- utili5at
""pentru conectarea la ba5a &e &ate
""7icroso't SEL Server FGGH
string connString = "?ata Source =
1)
HG.IJ.*FF.FHKK7SSELS/AL/AFGGH; &atabase=situatiescolara;
34?=master;)W?=master(WFG**;";
""crearea obiectului MconeDiuneNN
conn = ne, SqlConnection(connString#;
""conectarea la ba5a &e &ate situatie+scolara
conn.Open(#;
return true;
6
catc (Sql/Dception#
2
return 'alse;
6
6
public voi& closeConnection(#
2
i' (conn.State == System.?ata.ConnectionState.Open#
conn.Close(#;
6
[Web7eto&$
public 1ml?ata?ocument get?ata+tblStu&enti(#
2
try
2
getConnecte&(#;
""NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
""crearea obiectului coman&a pentru eDecutia
""unei comen5i SEL
SqlComman& coman&a = ne, SqlComman&(#;
""stabilirea coneDiunii asociate
coman&a.Connection = conn;
""stabilirea tipului comen5ii SEL
coman&a.Comman&(ype = System.?ata.Comman&(ype.(eDt;
""stabilirea teDtului comen5ii SEL
coman&a.Comman&(eDt = "S/L/C( P @AO7 tblStu&enti @OA 17L
.3(O";
""eDecutia comen5ii SEL
1mlAea&er r& = coman&a./Decute1mlAea&er(#;
1ml?ata?ocument Dml = ne, 1ml?ata?ocument(#;
1ml/lement root = Dml.Create/lement("root"#;
Dml..ppen&Cil&(root#;
1mlNo&e n;
,ile ((n = Dml.Aea&No&e(r&## Q= null#
root..ppen&Cil&(n#;
r&.Close(#;
closeConnection(#;
return Dml;
14
6
catc (Sql/Dception#
2
return null;
6
6
[Web7eto&$
public 1ml?ata?ocument getSituatieStu&ent(string numeStu&ent#
2
try
2
getConnecte&(#;
""NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
""crearea obiectului coman&a pentru eDecutia
""unei comen5i SEL
SqlComman& coman&a = ne, SqlComman&(#;
""stabilirea coneDiunii asociate
coman&a.Connection = conn;
""stabilirea tipului comen5ii SEL
coman&a.Comman&(ype = System.?ata.Comman&(ype.(eDt;
""stabilirea teDtului comen5ii SEL
coman&a.Comman&(eDt = "select ?.&enumire- N.nota @AO7
tbl&iscipline ?- tblNote N- tblStu&enti S W8/A/ ?.i&?isciplina =
N.i&?isciplina .N? N.nrmat = S.nrmat .N? S.nume=R" C numeStu&ent C "R @OA
17L .3(O";
""eDecutia comen5ii SEL
1mlAea&er r& = coman&a./Decute1mlAea&er(#;
1ml?ata?ocument Dml = ne, 1ml?ata?ocument(#;
1ml/lement root = Dml.Create/lement("root"#;
Dml..ppen&Cil&(root#;
1mlNo&e n;
,ile ((n = Dml.Aea&No&e(r&## Q= null#
root..ppen&Cil&(n#;
r&.Close(#;
closeConnection(#;
return Dml;
6
catc (Sql/Dception#
2
return null;
6
6
[Web7eto&$
public bool a&augaNota(string numeStu&ent- string nume?isciplina- int
nota#
2
try
2
16
int nrmat = N*;
int i&?isciplina = N*;
getConnecte&(#;
""NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
""crearea obiectului coman&a pentru eDecutia
""unei comen5i SEL
SqlComman& coman&a = ne, SqlComman&(#;
""stabilirea coneDiunii asociate
coman&a.Connection = conn;
""stabilirea tipului comen5ii SEL
coman&a.Comman&(ype = System.?ata.Comman&(ype.(eDt;
""stabilirea teDtului comen5ii SEL
coman&a.Comman&(eDt = "S/L/C( nrmat @AO7 tblStu&enti
W8/A/ nume=R" C numeStu&ent C "R";
""eDecutia comen5ii SEL
Sql?ataAea&er &r = coman&a./DecuteAea&er(#;
i' (&r.Aea&(##
nrmat = &r.Get4ntSF(G#;
&r.Close(#;
""stabilirea teDtului comen5ii SEL
coman&a.Comman&(eDt = "S/L/C( i&?isciplina @AO7
tbl?iscipline W8/A/ &enumire=R" C nume?isciplina C "R";
""eDecutia interogarii SEL
&r = coman&a./DecuteAea&er(#;
i' (&r.Aea&(##
i&?isciplina = &r.Get4ntSF(G#;
&r.Close(#;
""stabilirea teDtului comen5ii SEL
coman&a.Comman&(eDt = "4NS/A( 4N(O tblNote L.L3/S (" C
nrmat C "-" C i&?isciplina C "-" C nota C "#";
""eDecutia comen5ii SEL
coman&a./DecuteNonEuery(#;
closeConnection(#;
return true;
6
catc (Sql/Dception#
2
return 'alse;
6
6
6
1.
Testarea serviciului web D co8+i*-7i "i *-n#-7i Bn e3ecu7ie -+*ic-7i- web ASP .NET
core#+un:6to-re #erviciu*ui web.
9u+6 cu8 #e +o-te ob#erv- 0$i,ur- 1 /1.1< #erviciu* web e3+une ! 8etodeG
/ adaugaNotaK
/ get!ata9tblStudentiK
/ getSituatieStudentK
$i,ur- 1/1. Te#t-re- #erviciu*ui web 011
$i,ur- 1/1( Te#t-re- 8etodei adaugaNota 011
1(
$i,ur- 1/15 Te#t-re- 8etodei adaugaNota 01
$i,ur- 1/' Te#t-re- 8etodei getData_tblStudenti
$i,ur- 1/1 Te#t-re- 8etodei getSituatieStudent 011
15
$i,ur- 1/ Te#t-re- 8etodei getSituatieStudent 01
Testarea serviciului web prin inter%ediul unei aplica3ii web ASP .NET
Cre-7i o nou6 -+*ic-7ie web ASP .NET.
Ad6u,-7i o re$erin76 c6tre #erviciu* web.
I8+ort-7i #+-7iu* de nu8e SL#te8.A8* 0using System.1ml;1
Ad6u,-7i Bn 8etod- Page$Load ur86to-re- #ecven76 de cod.
localost.Service obBServWeb = ne, localost.Service(#;
""a'isarea tabelei tblStu&enti
""NNNNNNNNNNNNNNNNNNNNNNNNNNNN
""apel meto&a N serviciu ,eb
1mlNo&e &ateStu& = obBServWeb.get?ata+tblStu&enti(#;
Aesponse.Write("9table>"#;
'or (int i = G; i 9 &ateStu&.Cil&No&es.Count; iCC#
2
1mlNo&e inreg = &ateStu&.Cil&No&es[i$;
string inreg+val = inreg.Outer1ml;
string[$ vals = inreg+val.Split(ne, car[$ 2 RK"R- R=R 6#;
Aesponse.Write("9tr>9t&>" C vals[F$ C "9"t&>9t&>" C vals[T$ C
"9"t&>9t&>" C vals[H$ C "9"t&>9t&>" C vals[**$ C "9"t&>9"tr>"#;
6
'
Aesponse.Write("9"table>"#;
""NNNNNNNNNNNNNNNNNNNNNNNNNNNN
""apel meto&a N serviciu ,eb
obBServWeb.a&augaNota("4onescu Lasile"- ")CL)F"- *G#;
""a'isarea situatiei scolare a
""stu&entului 4onescu Lasile
""NNNNNNNNNNNNNNNNNNNNNNNNNNNN
""apel meto&a serviciu ,eb
1mlNo&e sitStu& = obBServWeb.getSituatieStu&ent("4onescu Lasile"#;
Aesponse.Write("9br>9br>9table>"#;
'or (int i = G; i 9 sitStu&.Cil&No&es.Count; iCC#
2
1mlNo&e inreg = sitStu&.Cil&No&es[i$;
string inreg+val = inreg.Outer1ml;
string[$ vals = inreg+val.Split(ne, car[$ 2 RK"R- R=R 6#;
'or (int B = T; B 9 vals.Lengt; B C= S#
2
Aesponse.Write("9tr>9t&>" C vals[F$ C "9"t&>9t&>" C vals[B$ C
"9"t&>9"tr>"#;
6
6
Aesponse.Write("9"table>"#;
""NNNNNNNNNNNNNNNNNNNNNNNNNNNN
1
1.:. Lucrul cu servicii web disponibile pe Internet
E(.* Preluarea cursului de sc$i%b valutar cu a.utorul serviciului web disponibil la
adresa $ttp*;;infovalutar.ro;curs.as%(
Cre-7i o nou6 -+*ic-7ie web ASP .NET.
Ad6u,-7i o re$erin76 c6tre #erviciu* webG
o 9in $ere-#tr- Solution E(plorer e$ectu-7i c*icJ dre-+t- de 8ou#e +e nu8e*e #ite/
u*ui web i-r din 8eniu* deru*-nt -*e,e7i o+7iune- Add Web Reerence ... 0$i,ur- 1
/!1.
o In #ec7iune- CR& 0$i,ur- 1 /)1 introduce7i CR&/u* #erviciu*ui web
0$ttp*;;infovalutar.ro;curs.as%(<.
o E$ectu-7i c*icJ de 8ou#e +e iconit- Go 0$i,ur- 1 /)1K
o Sc;i8b-7i nu8e*e re$erin7ei 0din ro.infovalutar Bn infovalutar1.
o 9-c6 dori7i #6 ob7ine7i de#criere- 8etode*or e3+u#e de #erviciu* web< e$ectu-7i
c*icJ de 8ou#e +e *inJ/u* Service !escription 0$i,ur- 1 /)< $i,ur- 1 /41.
o E$ectu-7i c*icJ de 8ou#e +e butonu* Add Reference 0$i,ur- 1 /)1.
$i,ur- 1/! Ad6u,-re- unei re$erin7e c6tre un #erviciu web 011

$i,ur- 1/) Ad6u,-re- unei re$erin7e c6tre un #erviciu web 01


$i,ur- 1/4 9e#criere- 8etode*or e3+u#e de #erviciu* web 0!1
!
$i,ur- 1/6 Ad6u,-re- unei re$erin7e c6tre un #erviciu web 0)1
Ad6u,-7i Bn 8etod- Page$Load ur86to-re- #ecven76 de cod.
System.Net.Service)oint7anager./Dpect*GGContinue='alse;
in'ovalutar.Curs curs = ne, in'ovalutar.Curs(#;
Aesponse.Write("* /3A = " C curs.getvalue(?ate(ime.No,- "/3A"#C"9br>"#;
Aesponse.Write("* 3S? = " C curs.getvalue(?ate(ime.No,- "3S?"##;
Co8+i*-7i "i *-n#-7i Bn e3ecu7ie -+*ic-7i- web ASP .NET.

E(.* Preluarea infor%a3iilor referitoare la starea vre%ii cu a.utorul serviciului web
disponibil la adresa ;tt+G==www.dee+tr-inin,.co8=web#ervice#=we-t;er.-#83
Cre-7i o nou6 -+*ic-7ie web ASP .NET.
)
Ad6u,-7i o re$erin76 c6tre #erviciu* web. Sc;i8b-7i nu8e*e re$erin7ei 0din
co%.deeptraining.www Bn vre%ea D 1.
Ad6u,-7i Bn 8etod- Page$Load ur86to-re- #ecven76 de cod.
System.Net.Service)oint7anager./Dpect*GGContinue='alse;
string oras = "Suceava";
vremea.Weater v = ne, vremea.Weater(#;
Aesponse.Write("Lremea in " C oras C "! " C v.GetWeater(oras##;
Co8+i*-7i "i *-n#-7i Bn e3ecu7ie -+*ic-7i- web ASP .NET.
$i,ur- 1/. Ad6u,-re- unei re$erin7e c6tre un #erviciu web 011
4
TE#=
1. Scrie3i o aplica3ie web ASP .NET care va afi5a cursul de sc$i%b valutar E>+
pentru un interval de ti%p specificat de utili,ator.
&. #odifica3i aplica3ia astfel -nc?t utili,atorul s) poat) selecta 5i %oneda de sc$i%b.
4. Scrie3i aplica3ii de test pentru 4 servicii web disponibile pe Internet.
@$ttp*;;www.webservice(.net;ws;default.asp(<
:. Scrie3i un serviciu web ASP .NET care va oferi facilit)3i de traducere a te(telor.
6
&. Aibliografie
?1@. ;tt+G==ro.wiJi+edi-.or,=wiJi=WS9&
?@. ;tt+G==#t#t.e*i-.+ub.ro=new#=TEMEMSOIIIM'1'=SCRIPT=*i8b->eM#cri+t-re.+d$
?!@. ;tt+G==ro.wiJi+edi-.or,=wiJi=ASP.NET
?)@. ;tt+G==www.#cribd.co8=doc=41..56=M-nu-*/C
?4@. ;tt+G==ro.wiJi+edi-.or,=wiJi=CM#;-r+
?6@. Ste+;en W-*t;er< ASP.NET ) Cn*e-#;ed
?.@. M-tt;ew M-c9on-*d< M-tt;ew M-c9on-*d
?(@. I8-r S+--n>--r#< Be,innin, ASP.NET )G in CF -nd EB
.