Xml and soap examples
Download
1 / 15

XML and SOAP Examples - PowerPoint PPT Presentation


  • 237 Views
  • Updated On :

CERN April 1 2003 Grid Tutorial. XML and SOAP Examples. PTLIU Laboratory for Community Grids Geoffrey Fox, Marlon Pierce Computer Science, Informatics, Physics Indiana University, Bloomington IN 47404. gcf@indiana.edu. A Sample of XML. <?xml version="1.0"?>

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'XML and SOAP Examples' - mike_john


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Xml and soap examples l.jpg

CERN April 1 2003 Grid Tutorial

XML and SOAP Examples

PTLIU Laboratory for Community Grids

Geoffrey Fox, Marlon Pierce

Computer Science, Informatics, Physics

Indiana University, Bloomington IN 47404

gcf@indiana.edu


A sample of xml l.jpg
A Sample of XML

  • <?xml version="1.0"?>

  • <okcversion="3"xmlns="http://grids.ucs.indiana.edu/okc/schema/admin/ver/3">

  • <event>

  • <comment> This is a Test </comment>

  • <senderemail="gcf@grids.ucs.indiana.edu">Geoffrey Fox</sender>

  • <distribution> Community Grids Project Reports </distribution>

  • <organization></organization>

  • <updatecreateuri="gxos://okc/newsgroups/cgreports/$next“ />

  • <keywords></keywords>

  • <subject></subject>

  • <message/>

  • <filingdate> 2/6/2002 </filingdate>

  • <cg:messageTypexmlns:cg=“http://grids.ucs.indiana.edu/okc/schema/cg/ver/1”>

  • Test </cg:messageType>

  • </event>

  • </okc>

Schema are here

http://grids.ucs.indiana.edu/schemas/commgrids-v1.xsdhttp://grids.ucs.indiana.edu/schemas/okc-v3.xsd


Soap over http structure l.jpg

HTTP Delivery with address

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://xml.apache.org/soap/faq/faq_chawke_smtp.html

http://www.w3c.org/2000/xp/Group/1/11/16/soap12-primer.html#SMTP


Soap example from w3c i l.jpg
SOAP Example from W3C I

  • We take November 16 tutorial:http://www.w3c.org/2000/xp/Group/1/11/16/soap12-primer.html

  • 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 HeaderStart Body


Soap example concluded l.jpg
SOAP Example (Concluded)

Start Body

  • This has the SOAP Body with actual request

End BodyEnd Envelope


Soap binding to smtp from w3c l.jpg
SOAP Binding to SMTPfrom W3C

  • Same example as before

  • This is very straightforward!


Remarks on soap structure l.jpg
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 Dollsituation – each doll has a body (contained inside it) which is the full doll of higher level protocol

HTTP

SOAP

SOAP Body


Soap attachments l.jpg
SOAP Attachments

  • This uses same approach as email or HTTP and is a general way of including binary data in XML – but not understood by most parsers!

  • Very important?

XML links to MIMEAttachment using absolute or relative URI’s


Soap and gateway portal i l.jpg
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

Specify ls as

SOAP Envelope and body


Soap and gateway portal ii l.jpg
SOAP and Gateway Portal II

HTTP

Header

SOAPEnvelopeand body

  • And this is the result of ls sent back to client in SOAP over HTTP


Wsdl definitions and namespaces l.jpg

<?xml version="1.0" encoding="UTF-8" ?>

<definitionsname="BatchScriptService"

targetNamespace="http://yourserver/BatchScriptService"

xmlns="http://schemas.xmlsoap.org/wsdl/"

xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"

xmlns:tns="http://yourserver/BatchScriptService"

xmlns:xsd="http://www.w3.org/1999/XMLSchema“>

WSDL Definitions and Namespaces

Default Schema (null namespace) is WSDLsoap namespace is SOAP binding of WSDLtns namespace is this WSDL file

xsd namespace defines (ancient) XML Schema


Wsdl message example l.jpg
WSDL Message Example

<message name="submitRequest">

<part name="xmljob" type="xsd:string"/>

</message>

<messagename="submitResponse">

<part name="response" type="xsd:string"/>

</message>

  • 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.


Wsdl porttypes example l.jpg
WSDL portTypes Example

<portType name="BatchScriptServicePortType">

<operationname="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.


Wsdl soap binding example l.jpg
WSDL SOAP Binding Example

<binding name="BatchBinding" type="tns:BatchScriptServicePortType">

<soap:bindingstyle="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

<operation name="batchGen">

<soap:operation soapAction=""/>

<input>

<soap:body use="encoded“ namespace="urn:BatchScriptService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

</input>

<output>

<soap:body use="encoded" namespace="urn:BatchScriptService“

encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

</output>

</operation>

</binding>

note binding’s “type” attribute points back to the portType tag by name


Wsdl ports and services l.jpg
WSDL Ports and Services

<service name="BatchScriptService">

<documentation>BS stands for Batch Script

</documentation>

<port binding="BatchBinding”

name="BatchPort">

<soap:address location=

"http://yourserver/soap/servlet/rpcrouter/"/>

</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.


ad