Schema are here 9/17/2018">
Download presentation
Presentation is loading. Please wait.
Published byPiroska Dóra Bogdán Modified over 6 years ago
1
XML and SOAP Examples PTLIU Laboratory for Community Grids
CERN April Grid Tutorial PTLIU Laboratory for Community Grids Geoffrey Fox, Marlon Pierce Computer Science, Informatics, Physics Indiana University, Bloomington IN 47404 9/17/2018
2
A Sample of XML Schema are here
<?xml version="1.0"?> <okc version="3" xmlns=" <event> <comment> This is a Test </comment> <sender Fox</sender> <distribution> Community Grids Project Reports </distribution> <organization></organization> <update createuri="gxos://okc/newsgroups/cgreports/$next“ /> <keywords></keywords> <subject></subject> <message/> <filingdate> 2/6/2002 </filingdate> <cg:messageType xmlns:cg=“ > Test </cg:messageType> </event> </okc> Schema are here 9/17/2018
3
SOAP over HTTP Structure
SOAP defines a message with envelope, header and body The SOAP standard also defines a binding to HTTP which is equivalent to methodology for delivering message The SOAP body can specify data as well as fault processing information SOAP can be transported over standard mail by just putting XML in body of mail – see HTTP Delivery with address 9/17/2018
4
SOAP Example from W3C I We take November 16 tutorial: This is a SOAP Message – defining a reservation request Header has key meta-data of application (namelist m: and instructions to SOAP (intermediate actor) processors Start Envelope Start Header End Header Start Body 9/17/2018
5
SOAP Example (Concluded)
Start Body This has the SOAP Body with actual request End Body End Envelope 9/17/2018
6
SOAP Binding to SMTP from W3C
Same example as before This is very straightforward! 9/17/2018
7
Remarks on SOAP Structure
If you look at networking protocols, at each layer one specifies a header and a body HTTP has a header telling system where to send information and some high level specification of what to get In example, we see that body of HTTP message is full SOAP envelope and this envelope has SOAP Header and Body interpreted by “application” At a lower level in protocol stack, TCP/IP and ATM etc. have their own headers and bodies It is the standard Russian Doll situation – each doll has a body (contained inside it) which is the full doll of higher level protocol HTTP SOAP SOAP Body 9/17/2018
8
SOAP Attachments This uses same approach as or HTTP and is a general way of including binary data in XML – but not understood by most parsers! Very important? XML links to MIME Attachment using absolute or relative URI’s 9/17/2018
9
SOAP and Gateway Portal I
Having specified service in WSDL, the run-time is implemented in SOAP which is “just” an XML header (info needed by transport – empty here) and body Here is SOAP transported by HTTP message This is execLocalCommand WSDL operation to run one particular command (ls) on current WebFlow directory HTTP Header Argument of operation SOAP Envelope and body Specify ls as 9/17/2018
10
SOAP and Gateway Portal II
HTTP Header SOAP Envelope and body SOAP and Gateway Portal II And this is the result of ls sent back to client in SOAP over HTTP 9/17/2018
11
WSDL Definitions and Namespaces
<?xml version="1.0" encoding="UTF-8" ?> <definitions name="BatchScriptService" targetNamespace=" xmlns=" xmlns:soap=" xmlns:tns=" xmlns:xsd=" > Default Schema (null namespace) is WSDL soap namespace is SOAP binding of WSDL tns namespace is this WSDL file xsd namespace defines (ancient) XML Schema 9/17/2018
12
WSDL Message Example <message name="submitRequest">
<part name="xmljob" type="xsd:string"/> </message> <message name="submitResponse"> <part name="response" type="xsd:string"/> For the batch script service, we pass the XML description of the job as a string and get back the script as a string. In general, any XML primitive or complex types can be used in messages. We could improve our service by defining a BatchScript complex type. 9/17/2018
13
WSDL portTypes Example
<portType name="BatchScriptServicePortType"> <operation name="batchGen"> <output message="tns:submitResponse" name="submitResponse"/> <input message="tns:submitRequest" name="submitRequest"/> </operation> </portType> A portType corresponds to a Java class, so if we compile this WSDL to make client stubs, we will generate a BatchScriptServiceBinding.java class. 9/17/2018
14
WSDL SOAP Binding Example
<binding name="BatchBinding" type="tns:BatchScriptServicePortType"> <soap:binding style="rpc" transport=" <operation name="batchGen"> <soap:operation soapAction=""/> <input> <soap:body use="encoded“ namespace="urn:BatchScriptService" encodingStyle=" </input> <output> <soap:body use="encoded" namespace="urn:BatchScriptService“ encodingStyle=" </output> </operation> </binding> note binding’s “type” attribute points back to the portType tag by name 9/17/2018
15
WSDL Ports and Services
<service name="BatchScriptService"> <documentation>BS stands for Batch Script </documentation> <port binding="BatchBinding” name="BatchPort"> <soap:address location= " </port> </service> </definitions> ports are concrete implementations of portTypes and point back to a particular binding (by name). They also point to the specific location of a server that implements the service. A service is a collection of one or more ports. 9/17/2018
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.