You are on page 1of 4

CSC408H1F/CSC2105H1F Software Engineering 2004-2005 CSC408H1F/CSC2105H1F Software Engineering 2004-2005

What is Web Service


Historic perspectives
Tutorial
Centralized versus Distributed Programming Models:
Web Services Client/Server, Master/Slave, SPMD, etc
Middleware architecture
2-tier, 3-tier, n-tier
Technical evolution
1. What is a Web Service? IPC (inter process call):
2. An example Web Service RPC, Java RMI, CORBA, DCOM
Shared Memory, Distributed Shared Memory and Message
3. Wrapping a text editor into a WS Passing
Interoperability, interoperability, interoperability

University of Toronto University of Toronto

CSC408H1F/CSC2105H1F Software Engineering 2004-2005 CSC408H1F/CSC2105H1F Software Engineering 2004-2005

What is a Web Service? An example web service


Web Services Standards (XML-based)
xmethods provides a web services to get
SOAP (Simple Object Access Protocol) the stock price
WSDL (Web Service Description Language)
UDDI (Universal Description, Discovery, Integration)
Example SOAP messages
WS-I (integration), WS-Policy, WS-Security, etc. Structure of WSDL descriptions
Chances and Challenges
Application Wrappers to WS A program that invokes the web service
Web Services Compositions
Holy Grail: large reusable library of WS with interoperability:
1,000 public WS ~ 1 Million private WS
ROI (Return of Investments): > 10x ?
Issues: Privacy, Security, Performance

University of Toronto University of Toronto


CSC408H1F/CSC2105H1F Software Engineering 2004-2005 CSC408H1F/CSC2105H1F Software Engineering 2004-2005
Example
SOAP architecture SOAP message: request
<?xml version="1.0" encoding="UTF-8"?>
Service requestor Service provider <SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
application object application object xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
(editor) (OmniEditor) xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns="urn:xmethods-delayed-quotes">
response <SOAP-ENV:Body SOAP-
SOAP-based SOAP-based
middleware middleware ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
request <ns:getQuote>
<symbol>IBM</symbol>
</ns:getQuote>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

University of Toronto University of Toronto

CSC408H1F/CSC2105H1F Software Engineering 2004-2005 CSC408H1F/CSC2105H1F Software Engineering 2004-2005


Example

SOAP message: response WSDL architecture


WSDL (url)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope WSDL compiler WSDL compiler
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" (client) (server side)
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" Service requestor Service provider
xmlns:ns="urn:xmethods-delayed-quotes">
<SOAP-ENV:Body SOAP-
ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> stub stub
<ns:getQuoteResponse>
<Result>86.05</Result>
</ns:getQuoteResponse> response
SOAP-based SOAP-based
</SOAP-ENV:Body> middleware middleware
</SOAP-ENV:Envelope> request

University of Toronto University of Toronto


CSC408H1F/CSC2105H1F Software Engineering 2004-2005 CSC408H1F/CSC2105H1F Software Engineering 2004-2005
Example Example

WSDL structure: message WSDL structure: portType


<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<definitions name="quote <definitions name="quote"
xmlns:tns="urn:xmethods-delayed-quotes" name spaces >
name spaces > types, messages,
types <portType name="quotePortType">
<message name="getQuoteRequest">
<operation name="getQuote">
<part name="symbol" type="xsd:string"/>
<input message="tns:getQuoteRequest"/>
</message>
<message name="getQuoteResponse"> <output message="tns:getQuoteResponse"/>
<part name="Result" type="xsd:float"/> </operation>
</message> </portType>
portType, binding, service binding, service
</definitions> </definitions>

University of Toronto University of Toronto

CSC408H1F/CSC2105H1F Software Engineering 2004-2005 CSC408H1F/CSC2105H1F Software Engineering 2004-2005


Example Example

WSDL structure: binding WSDL structure: service


<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<definitions name="quote"
name spaces > <definitions name="quote"
types, messages, portType name spaces >
<binding name="quote" type="tns:quotePortType">
<SOAP:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> types, messages, portType, binding
<operation name="getQuote">
<SOAP:operation soapAction=""/>
<service name="quote">
<input> <port name="quote" binding="tns:quote">
<SOAP:body use="encoded" namespace="urn:xmethods-delayed-quotes" <SOAP:address location="http://services.xmethods.net/soap"/>
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input> </port>
<output> </service>
<SOAP:body use="encoded" namespace="urn:xmethods-delayed-quotes"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </definitions>
</output>
</operation>
</binding>
service
</definitions>

University of Toronto University of Toronto


CSC408H1F/CSC2105H1F Software Engineering 2004-2005 CSC408H1F/CSC2105H1F Software Engineering 2004-2005
Invoking the web service
Web Services Invocation gsoap/soapcpp2/samples/quote
int ns__getQuote(char *symbol, float *Result); /* quote.h */
<ns: /* quote.c */
ge int main(int argc, char **argv)
<sym tQuote> { struct soap soap;
</ns bol>IBM float q;
getQuote :getQ < char *sym;
uote /symbo if (argc > 1)
<n > l> sym = argv[1];
Xmethods s:g else
WSDL < R et Q
</n es uot { fprintf(stderr, "Usage: quote <ticker>\n");
s:g ult> eRe exit(1);
et Q 86 s Client }
uo .05< pons Program
soap_init(&soap);
teR /R e> if (soap_call_ns__getQuote(&soap, "http://services.xmethods.net/soap", "", sym, &q) == 0)
es esu printf("\nCompany - %s Quote - %f\n", sym, q);
po
ns lt> else
e> soap_print_fault(&soap, stderr);
soap_end(&soap);
soap_done(&soap);
return 0;
}

%> quote IBM


Company - IBM Quote - 86.269997
%>

University of Toronto University of Toronto

CSC408H1F/CSC2105H1F Software Engineering 2004-2005 CSC408H1F/CSC2105H1F Software Engineering 2004-2005

Reference Architecture 1 Reference Architecture 2


Web service
UPLOAD
VIM
Web service Emacs Web service
DOWNLOAD
UPLOAD UPLOAD
VIM
DOWNLOAD channel DOWNLOAD
channel
Eclipse
VIM channel
channel channel
channel Web service
UPLOAD
VIM Eclipse
Whenever upload is called, the state of the channel in the DOWNLOAD
server is updated or a new channel is created, and only when the Whenever upload is called, inform other editors
editors need to refresh the buffer, they pull the information (downloading). involved in the channel to refresh the changed
Make sure the difference between downloaded buffer and the current buffer can channel
channel state.
be displayed.

University of Toronto University of Toronto

You might also like