Data Framework II.

Uploaded on:
Cleanser Simple Object Access Protocol. Depicts how information will be ... So when making a solicitation utilizing SOAP we have to change over articles to a legitimate SOAP sort. The ...
Slide 1

Data Infrastructure II I211 Week 14 Rajarshi Guha

Slide 2

Outline Web administrations WSDL SOAP SOAPpy

Slide 3

Distributed Computing CGI projects are an illustration Code is running on some machine We compose code that get to this code Based on building URL\'s Remote capacities are helpful Utilize better machines Access programming Doesn\'t require support

Slide 4

Distributed Computing CGI\'s are anything but difficult to utilize Limited in the sorts of things that can be returned Everything must be a string

Slide 5

What is a Web Service (WS) ? Code running on a discretionary machine that can be gotten to in a stage and dialect autonomous form More for the most part, a WS structure is a XML-based disseminated administrations framework. Appropriate for machine-to-machine connection Platform & dialect rationalist Follows benchmarks

Slide 6

Browser GUI or CLI Client Web Server HTTP GET/POST WSDL SOAP Web Server WSDL Web Server SOAP WSDL SOAP JDBC DB or application DB or application Basic Architectures: CGI and Web Services SOAP

Slide 7

Famous Web Services Google Access their web index Access Google Maps Amazon Access their internet searcher Access chronicled information

Slide 8

IU Web Services Variety of open cheminformatics administrations Molecular descriptors 2D structure outlines TPSA Fingerprints Similarity computations Toxicity class forecasts

Slide 9

Some Terminology SOAP – Simple Object Access Protocol. Portrays how information will be encoded when it\'s sent to an administration and decoded when gotten from an administration WSDL – Web Service Description Language Describes how a customer ought to interface with a web administration Application Container – programming that hosts administrations

Slide 10

Client side Some libraries Client code Client code may be Stand alone program Web program The Components of a WS Server side Web server Application compartment Service code Web server can be discretionary Container can be discretionary

Slide 11

Programming Languages Your most loved dialect! Bolster exists for C/C++ Java Perl Python PHP Ruby .Net (so you can get to WS\'s from Excel)

Slide 12

Web Service Description Language WSDL is a XML-based depiction of a web administration It portrays what sort of items it acknowledges and returns and what kind of exemptions can happen amongst different things This is the thing that makes a WS free of dialect What do we do with WSDL? Take a gander at it and compose a customer Generate an intermediary and utilize that in the customer

Slide 13

What Does WSDL Look Like? <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://office:8080/hub/administrations/CDKstruct3D" xmlns:apachesoap="" xmlns:impl="http://office:8080/hub/administrations/CDKstruct3D" xmlns:intf="http://office:8080/pivot/administrations/CDKstruct3D" xmlns:soapenc="" xmlns:tns1="" xmlns:wsdl="" xmlns:wsdlsoap="" xmlns:xsd=""> <!- - WSDL made by Apache Axis adaptation: 1.2RC2 Built on Nov 16, 2004 (12:19:44 EST)- - > <wsdl:types> <schema targetNamespace="" xmlns=""> <import namespace=""/> <complexType name="CDKException"> <sequence/> </complexType> </schema> </wsdl:types> <wsdl:message name="CDKException"> <wsdl:part name="fault" type="tns1:CDKException"/> </wsdl:message> <wsdl:message name="get3DCoordinatesResponse"> <wsdl:part name="get3DCoordinatesReturn" type="soapenc:string"/> </wsdl:message> <wsdl:message name="get3DCoordinatesRequest"> <wsdl:part name="in0" type="soapenc:string"/> <wsdl:part name="in1" type="soapenc:string"/> </wsdl:message> <wsdl:portType name="CDKstruct3D"> <wsdl:operation name="get3DCoordinates" parameterOrder="in0 in1"> <wsdl:input message="impl:get3DCoordinatesRequest" name="get3DCoordinatesRequest"/> <wsdl:output message="impl:get3DCoordinatesResponse" name="get3DCoordinatesResponse"/> <wsdl:fault message="impl:CDKException" name="CDKException"/> </wsdl:operation> </wsdl:portType> ....

Slide 14

What is the Result of This? Analyzing the WSDL gives us the accompanying data about the CDKstruct3D administration Location of the administration It takes 2 inputs, which will be SOAP encoded strings It gives back a SOAP encoded string It might give back a flaw of sort CDKException But we have to realize what the contentions mean Got to ask the creator!

Slide 15

Simple Object Access Protocol SOAP is a XML message position (encoding) Describes how an item is spoken to when sent to or got from an administration SOAP messages must be sent to the administration Usually over HTTP SOAP is normally connected to WSDL What does a SOAP message contain? Headers Payload – self-assertive XML

Slide 16

What Does SOAP Look Like? <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="" xmlns:SOAP-ENC="" xmlns:xsi="" xmlns:SOAP-ENV="" xmlns:xsd="" > <SOAP-ENV:Body> <ns1:getFingerprintString xmlns:ns1="http://localhost:8080/pivot/administrations/CDKws" SOAP-ENC:root="1"> <v1 xsi:type="xsd:string">CC=COC</v1> <v2 xsi:type="xsd:int">1024</v2> <v3 xsi:type="xsd:int">6</v3> </ns1:getFingerprintString> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Payload

Slide 17

What Types Does SOAP Allow? Cleanser indicates various primitive implicit sorts int, twofold, drift, boolean, String, Date, clusters and so forth. Some compound sorts likewise permitted clusters, hashes and so on So when making a solicitation utilizing SOAP we have to change over items to a legitimate SOAP sort The required sort is portrayed in the WSDL Luckily we don\'t have to manage crude SOAP messages The SOAP toolbox (AXIS for us) will handle it

Slide 18

Other Clients – The Web Page It\'s helpful to have a site page that gives a structure interface Depends on whether the WS is helpful as a site page Very simple with the PHP

Slide 19

Other Clients – The Web Page The PHP code called by the structure <?php require_once(\'SOAP/WSDL.php\'); require_once(\'SOAP/Client.php\'); capacity CallTPSAService($t) { $client = new SOAP_Client(\'http://localhost:8080/hub/administrations/CDKws\'); $params = array(\'smiles\'=>trim($t)); $soapoptions = array(\'timeout\' => 360); $tpsa = $client->call(\'getTPSA\',$params,$soapoptions); if (PEAR::isError($ret)) {/handle mistake } else {/make a decent page } $smiles = $_POST[\'smiles\'] CallTPSAService($smiles) ?> The HTML structure <form action="phptpsa.php" method="post" enctype= "multipart/structure data"> <table><tr> <td><b>SMILES</b></td> <td><input name="smiles" type="text"/></td> <td> <input type="submit" value="Get TPSA"/> </td> </tr></table> </form>

Slide 20

Python WS Clients Need to get the WSDL Ideally, we ought to have documentation We can decide accessible techniques and contentions automatically Still won\'t realize what they mean Calling a web administration is the same as calling a capacity

Slide 21

SOAPpy We\'ll utilize the SOAPpy module to cooperate with a web administration Handles the transformation to and from SOAP messages We send and get customary Python sorts Installed on Sulu

Slide 22

Connecting to a Web Service Create an intermediary object speaking to the web administration url = \'\' s = SOAPpy.WSDL.Proxy(url) print s <SOAPpy.WSDL.Proxy occurrence at 0x20000000042dd050>

Slide 23

The Proxy Object Behaves simply like a class or module The WS strategies are much the same as techniques for a class or module Just send the correct contentions like whatever other capacity sim = s.getSimilarity(\'CCC\', \'CCCO\') print sim 0.428571432829

Slide 24

Public Web Services X-techniques is a gathering of open web administrations Getting a formula of the day url = \'\' s = SOAPpy.WSDL.Proxy(url) print s.ForToday()

Slide 25

Interrogating a Web Service Sometimes it\'s helpful to discover what strategies are connected with an administration For every strategy we additionally need to know The contentions for the administration The arrival kind of the technique

Slide 26

Getting a List of Methods The intermediary object has a part called strategies A lexicon The keys are the technique names The qualities are SOAPCallInfo occasions url = \'\' s = SOAPpy.WSDL.Proxy(url) print s.methods print s.methods.keys()

Slide 27

Interrogating a Method We can get the article speaking to a WS technique from the meth

View more...