ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Web services game
Hypothetical scenario to understand
REST and SOAP Web Services
A biologist wants a software application to visualize chromosome sequences
A. The biologist ask a programmer
B. The programmer creates an application
C. The biologist uses the application
A. The programmer creates an application
1. The programmer finds a web service providing genome sequences
2. The programmer looks for documentation about how to request sequences in this service
3. Programmer encodes logic to retrieve and present information into an application
B. The biologist uses the application
1. The biologist queries the application
2. The application sends a request to the service
3. The service provides a response to the application
4. The application present the information to the biologist
Web Services
How should I invoke you?
Documentation
Make a request
Results
Web server
Application
describes the methods and variables to query the service
1
2
3
4
2
Developer
REST Web Services
How should I invoke you?
Documentation
Make a request ( GET or POST)
Results (data + status)
Web server
Sometimes a WADL file is available in the server to describe
the service
1
2
3
4
2
WADLor
Informal
Description
Formal
Description
Application
Developer
SOAP Web Services
How should I invoke you?
Documentation (WSDL)
Make a SOAP request
Web server1
2
3
WSDL
Method / Parameters Data
4
3 4SOAP request SOAP response
and
Informal
Description
Formal
Description
Results (SOAP response)
Application
Developer
Biologist
Application
Programmer
Application
Personal computer
Application
Application
REST
Application
Application
SOAP
Application
Server
Web service
REST
Web service
SOAP
Internet
Request: documentation
Please send me
documentation
about how to
query the service
using REST
Request: documentation
Please send me
documentation
about how to
query the service
using SOAP
Response: documentation
GET
http://{domain}/{service}?gene={geneID}&specie={specieID}
Domain
? www.abc.org
Services
? sequence
? annotations
Methods
? gene
? specie
REST
Informal description
WADL
www.abc.org/ws.wadl
Response: documentation
<application>
<resources base="http://www.abc.org">
<resource path="/sequence">
<method>
<request>
<param name="gene" type="xs:string"/>
<param name="specie" type="xs:string"/>
</request>
<response>
<representation mediaType="text/plain"/>
</response>
<method>
</resource>
<resource path="/annotation">
<method>
<request>
<param name="gene" type="xs:string"/>
<param name="specie" type="xs:string"/>
</request>
<response>
<representation mediaType="text/plain"/>
</response>
<method>
</resource>
</resources>
</application>
WADL
REST
Formal description
http://www.abc.org/ws.wadl
Response: documentation
SOAP
Informal description
WSDL
www.abc.org/ws.wsdl
Domain
? www.abc.org
Services
? sequence
? annotations
Methods
? gene
? specie
Response: documentation
<wsdl:definitions name="abcService">
<wsdl:types>
<xs:complexType name="getSequence">
<xs:sequence>
<xs:element name="sequence" type="xs:string"/>
<xs:element name="infoRequest" type="requestInfo"/>
</xs:sequence>
</xs:complexType>
</xs:complexType>
<xs:complexType name="getAnnotations">
<xs:sequence>
<xs:element name="annotations" type="xs:string"/>
<xs:element name="infoRequest" type="requestInfo"/>
</xs:sequence>
</xs:complexType>
</xs:complexType>
<xs:complexType name="resultInfo">
<xs:sequence>
<xs:element name="gene" type="xs:string"/>
<xs:element name="specie" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</wsdl:types>
<wsdl:message name="getSequence">
<wsdl:part element="getSequence" name="parameters" />
</wsdl:message>
<wsdl:message name="getAnnotations">
<wsdl:part element="getAnnotations" name="parameters" />
</wsdl:message>
<wsdl:portType name="abcService">
<wsdl:operation name="getSequence">
<wsdl:input message="getSequence" name="getSequence" />
<wsdl:output message="getSequenceResponse" name="getSequenceResponse" />
</wsdl:operation>
<wsdl:operation name="getAnnotations">
<wsdl:input message="getAnnotations" name="getAnnotations" />
<wsdl:output message="getAnnotationsResponse" name="getAnnotationsResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="abcServiceSoapBinding" type="abcService">
<wsdl:operation name="getSequence">
<soap:operation soapAction="getSequence" style="document"/>
<wsdl:input name="getSequence">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getSequenceResponse">
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="abcServiceException">
<soap:fault name="abcServiceException" use="literal"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="getAnnotations">
<soap:operation soapAction="getAnnotations" style="document"/>
<wsdl:input name="getAnnotations">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getAnnotationsResponse">
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="abcServiceException">
<soap:fault name="abcServiceException" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="abcService">
<wsdl:port binding="abcServiceSoapBinding" name="abcServicePort">
<soap:address location="http://abc.org"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
SOAP
WSDL
Formal description
http://www.abc.org/ws.wsdl
REST request
http://abc.org/sequence?gene=BRCA1&specie=human
URL
Application
SOAP request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<getSequence>
<infoRequest>
<gene>BRCA1</gene>
<specie>human</specie>
</infoRequest>
</getSequence>
</soapenv:Body>
</soapenv:Envelope>
SOAP envelope
Application
Status:
200
Response:
ATGCCTATTGGATCCAAAGAGAGGCCAACATTTTTTGAAATTTTTAAGACACGCTGCAACAAAGCAGATT
TAGGACCAATAAGTCTTAATTGGTTTGAAGAACTTTCTTCAGAAGCTCCACCCTATAATTCTGAACCTGC
AGAAGAATCTGAACATAAAAACAACAATTACGAACCAAACCTATTTAAAACTCCACAAAGGAAACCATCT
TATAATCAGCTGGCTTCAACTCCAATAATATTCAAAGAGCAAGGGCTGACTCTGCCGCTGTACCAATCTC
CTGTAAAAGAATTAGATAAATTCAAATTAGACTTAGGAAGGAATGTTCCCAATAGTAGACATAAAAG...
REST response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getSequenceResponse>
<sequenceResponse>
<resultSet/>
<resultInfo>
<gene>BRCA1</gene>
<specie>human</specie>
<seqeunceResults>
ATGCCTATTGGATCCAAAGAGAGGCCAACATTTTTTGAAATTTTTAAGACACGCTGCAACAAAGCAGATT
TAGGACCAATAAGTCTTAATTGGTTTGAAGAACTTTCTTCAGAAGCTCCACCCTATAATTCTGAACCTGC
AGAAGAATCTGAACATAAAAACAACAATTACGAACCAAACCTATTTAAAACTCCACAAAGGAAACCATCT
TATAATCAGCTGGCTTCAACTCCAATAATATTCAAAGAGCAAGGGCTGACTCTGCCGCTGTACCAATCTC
CTGTAAAAGAATTAGATAAATTCAAATTAGACTTAGGAAGGAATGTTCCCAATAGTAGACATAAAAG...
</sequenceResults>
</resultInfo>
</sequenceResponse>
</getSequenceResponse>
</soap:Body>
</soap:Envelope>
SOAP response
Application response
BRCA1 Human
ATGCCTATTGGATCCAAAGAGAGGCCAACATTTTTTGAAATTTTTAAGACACGCTGCAACAAAGCAGATT
TAGGACCAATAAGTCTTAATTGGTTTGAAGAACTTTCTTCAGAAGCTCCACCCTATAATTCTGAACCTGC
AGAAGAATCTGAACATAAAAACAACAATTACGAACCAAACCTATTTAAAACTCCACAAAGGAAACCATCT
TATAATCAGCTGGCTTCAACTCCAATAATATTCAAAGAGCAAGGGCTGACTCTGCCGCTGTACCAATCTC
CTGTAAAAGAATTAGATAAATTCAAATTAGACTTAGGAAGGAATGTTCCCAATAGTAGACATAAAAG...
Application
Thank you!
13/12/2018
26
ProteomicsServicesTeam

More Related Content

Web services game