Slide Web Service
-
Upload
maytrangpro -
Category
Documents
-
view
217 -
download
0
Transcript of Slide Web Service
-
Chuyn Thng mi in t
Cng ngh Web services
Thng 11-2006Khoa Cng ngh thng tinB mn HTTT
-
Ni dung trnh by
-
Cc ng dng phn tnDistributed ApplicationD liung dngphn tnD liu
-
Kin trc hng dch vService-Oriented Architecture-SOAPublishFindBind
-
Web Service
-
Web service l g
-
c im
-
Kin trc ca Web ServicePublishFindBindInternet
-
Kin trc ca Web ServiceAny ClientSOAPSOAPSOAP
-
Web service providerIIS
-
Web service consumerS dng Web service do WS Provider cung cp xy dng ng dng
-
Web service broker
-
M hnh tng tc gia cc thnh phn4
-
Nn tng ca Web ServiceWeb ServiceXMLSOAPHTTP
-
HTTP Hyper text transfer protocol
-
XML Extend Markup Language
-
SOAP(1)An envelope for handling extensibility and modularity An encoding mechanism for representing types within an envelope
-
SOAP (2)POST /WebCalculator/Calculator.asmx HTTP/1.1Content-Type: text/xmlSOAPAction: http://tempuri.org/AddContent-Length: 386
...
-
SOAP(3) - Message StructureSOAP MessageSOAP EnvelopeSOAP HeaderSOAP BodyMessage Name & DataHeadersHeadersXML-encoded SOAP message name & data contains SOAP message nameIndividual headers encloses headers encloses payloadProtocol binding headersThe complete SOAP message
-
SOAP(4) - Example of a SOAP RequestPOST /StockQuote HTTP/1.1Host: www.stockquoteserver.comContent-Type: text/xml; charset="utf-8"Content-Length: nnnnSOAPAction: "Some-URI
DIS
-
SOAP(5) - Example of a SOAP ResponseHTTP/1.1 200 OKContent-Type: text/xml; charset="utf-8"Content-Length: nnnn
34.5
-
Lp trnh Web service bng VS.NET 2003
-
Lp trnh Web service (1) SystemSystem.DataSystem.WebSystem.Web.WebservicesSystem.XmlFile *.asmxFile global.asaxFile web.configTh mc Bin
-
Lp trnh Web service (2)Thm ch th [Web Method]
-
Lp trnh Web service (3)
-
Lp trnh Web service (3)[WebMethod(BufferResponse=false)]public Transactions GetTransactionHistory(){//implementation code}[WebMethod (Description=This method using for converting .. )]public double ConvertTemperature(double dFahrenheit){return ((dFahrenheit - 32) * 5) / 9;}V d
-
Lp trnh Web service (4)Dng xc nh cu trc ti liu XML mong mun biu din i tng ca mt lpNamespace : System.Xml.Serialization
-
Lp trnh Web service (5)[XmlRoot("account")]public class Acct{[XmlElement("description")] public string Description;[XmlElement("number")] public string Number;[XmlElement("type")] public string Type;[XmlElement("balance")] public decimal Balance;[XmlAttribute("status")] public string Status;}
V d 1
Hello 10 C
-
Lp trnh Web service (6)[return:XmlArray("AccountList")][return:XmlArrayItem("Account")]public Acct[] GetAllAccounts()
.
V d 2
-
Lp trnh Web service (7)[return:XmlArrayItem(ElementName="savingsAcct", Type=typeof(SavingsAcct))][return:XmlArrayItem(ElementName="creditCardAcct", Type=typeof(CreditCardAcct))][WebMethod]public Acct[] GetAllAccounts(){...
V d 3
-
Lp trnh Web service (8)
-
Lp trnh Web service provider side(9) Phi khai bo tng minh tt c cc kiu d liu c th c trong mngS dng :XmlInclude Name space System.Xml.Serialization
-
Lp trnh Web service provider side(10)V dpublic class Acct{ public string Description; public string Number; public string Type; public decimal Balance; public string Status;}public class SavingsAcct : Acct{ public decimal MinimumBalance;}public class CreditCardAcct : Acct{ public int PayPeriod;}[WebMethod][XmlInclude(typeof(CreditCardAcct))][XmlInclude(typeof(SavingsAcct))][return:XmlArray("AccountList")][return:XmlArrayItem("Account")]public Acct[] GetAllAccounts(){SavingsAcct a = new SavingsAcct();CreditCardAcct cc = new CreditCardAcct();// populate the accountsAcct [] sa = new Acct[2];sa[0] = a;sa[1] = cc;return sa;}
-
Trin khai Web service
-
Web Service Consumer
-
WSDL Documents
-
Proxy class
-
S dng Web service trong .NETS dng wsdl.exeS dng VS.NetGi bnh thng nh cc phng thc khcAdd Web References wsdl [options] {URL | Path}wsdl http://www.woodgrovebank.com/services/bank.asmx?wsdl
-
WSDL Document
-
Proxy Class
-
SOAP Request and Response
-
HTTP Request and Response
-
Web service and State ManagementS dng i tng Application v Session qun l trng thi ca web service
-
ng dng ca Web Services
-
Demo
-
Hi v p