EIE424 Distributed Systems and Networking Programming -PartIl 3.1 SOAP-Introduction 3.1 SOAP- Introduction
1 EIE424 Distributed Systems and Networking Programming –Part II 3.1 SOAP – Introduction 3.1 SOAP – Introduction
EIE424 Distributed Systems and Networking Programming -PartIl 3.1 SOAP-Introduction What is soAP? SOAP is an XML-based protocol for exchanging information between computers o Mainly use for performing remote procedure calls transported via Http e Different from corba. dcom or java rmi SOAP messages are entirely written in XML o Hence platform and language independent E.g. SOAP java client running on Linux can connect to a Microsoft SOAP server running on Windows XP At the same time a perl client running on Solaris can 2 also connect to the same soap server
2 What is SOAP? ⚫ SOAP is an XML-based protocol for exchanging information between computers ⚫ Mainly use for performing remote procedure calls transported via HTTP ⚫ Different from CORBA, DCOM or Java RMI, SOAP messages are entirely written in XML ⚫ Hence platform and language independent – E.g. SOAP java client running on Linux can connect to a Microsoft SOAP server running on Windows XP – At the same time, a Perl client running on Solaris can also connect to the same SOAP server EIE424 Distributed Systems and Networking Programming –Part II 3.1 SOAP – Introduction
EIE424 Distributed Systems and Networking Programming -PartIl 3.1 SOAP-Introduction What does soAP Define? o SOAP envelope specification Specify the rules for encapsulating data being transferred between computers In case of failure define how to encode error messages ● Data encoding rules Define how the data are encoded E.g. the rule to encode floating point numbers Most conventions are based on the w3c XMl schema RPC conventions Define how a rpc can be proceeded E.g. how to specify the procedure name, pass parameters 3 and receive response(returned results
3 EIE424 Distributed Systems and Networking Programming –Part II 3.1 SOAP – Introduction What does SOAP Define? ⚫ SOAP envelope specification – Specify the rules for encapsulating data being transferred between computers – In case of failure, define how to encode error messages ⚫ Data encoding rules – Define how the data are encoded – E.g. the rule to encode floating point numbers – Most conventions are based on the W3C XML Schema ⚫ RPC conventions – Define how a RPC can be proceeded – E.g. how to specify the procedure name, pass parameters and receive response (returned results)
EIE424 Distributed Systems and Networking Programming -PartIl 3.1 SOAP-Introduction SOAP VS XML-RPC Similarities Use XML for messaging Messages are usually embedded into Http header Use request/response mechanism Mainly use in remote procedure call Platform independent Language independent Differences SOAP messages are more complicated than XML-RPC Make use of XML namespaces and XML schemas Hence give a standard way for data encoding and RPC 4 Thus allow automatic method invocation on the Web
4 SOAP vs XML-RPC ⚫ Similarities – Use XML for messaging – Messages are usually embedded into HTTP header – Use request/response mechanism – Mainly use in remote procedure call – Platform independent – Language independent ⚫ Differences – SOAP messages are more complicated than XML-RPC – Make use of XML namespaces and XML Schemas – Hence give a standard way for data encoding and RPC – Thus allow automatic method invocation on the Web EIE424 Distributed Systems and Networking Programming –Part II 3.1 SOAP – Introduction
EIE424 Distributed Systems and Networking Programming -PartIl 3.1 SOAP-Introduction SOAP in Action Http --E XMI SOAP Request SOAP SOAP client server SOAP Response Http XML Hence soap messages can be delivered via the web 5
5 EIE424 Distributed Systems and Networking Programming –Part II 3.1 SOAP – Introduction SOAP in Action SOAP client SOAP server XML XML HTTP HTTP SOAP Response SOAP Request Hence SOAP messages can be delivered via the Web
EIE424 Distributed Systems and Networking Programming -PartIl 3.1 SOAP-Introduction SOAP Communication Styles SOAP supports two different communication styles RPC Style e Uses the soaP rPc conventions hence the communication method and procedure are governed by the conventions Conceptually similar to other RPCs The default of early SOAP implementations Document Style e Also known as message-oriented style ● Sending non-encodedⅩ ML content o Require more programming work on server and client sides to interpret the messages e More flexible communication and provides the best 6 interoperability
6 EIE424 Distributed Systems and Networking Programming –Part II 3.1 SOAP – Introduction SOAP Communication Styles ⚫ SOAP supports two different communication styles: – RPC Style ⚫ Uses the SOAP RPC conventions, hence the communication method and procedure are governed by the conventions ⚫ Conceptually similar to other RPCs ⚫ The default of early SOAP implementations – Document Style ⚫ Also known as message-oriented style ⚫ Sending non-encoded XML content ⚫ Require more programming work on server and client sides to interpret the messages ⚫ More flexible communication and provides the best interoperability
EIE424 Distributed Systems and Networking Programming -PartIl 3.1 SOAP-Introduction A Sample request in RPC Style 10016 Try to call the remote method getTemp with input parameter, a zipcode: 10016
7 EIE424 Distributed Systems and Networking Programming –Part II 3.1 SOAP – Introduction 10016 A Sample Request in RPC Style Try to call the remote method getTemp with input parameter, a zipcode: 10016
EIE424 Distributed Systems and Networking Programming -PartIl 3.1 SOAP-Introduction A Sample response in RPc Style 71.0 Return a double 71.0 which represents the temperature
8 EIE424 Distributed Systems and Networking Programming –Part II 3.1 SOAP – Introduction A Sample Response in RPC Style 71.0 Return a double 71.0 which represents the temperature
EIE424 Distributed Systems and Networking Programming -PartIl 3.1 SOAP-Introduction SOAP Messages o In most cases, we do not need to directly programming in SOAP o Dozens of SoAP implementations now freely exist on the Internet Apache SOAP(Axis) Microsoft soap toolkit o Allow generating SoAP messages automatically using High Level Language, e. g. Java, C++, Perl Understanding of SOAP message structure enables us to intercept a SoAP transaction and to debug a SOAP application
9 EIE424 Distributed Systems and Networking Programming –Part II 3.1 SOAP – Introduction SOAP Messages ⚫ In most cases, we do not need to directly programming in SOAP ⚫ Dozens of SOAP implementations now freely exist on the Internet – Apache SOAP (Axis) – Microsoft SOAP ToolKit ⚫ Allow generating SOAP messages automatically using High Level Language, e.g. Java, C++, Perl ⚫ Understanding of SOAP message structure enables us to intercept a SOAP transaction and to debug a SOAP application
EIE424 Distributed Systems and Networking Programming -PartIl 3.1 SOAP-Introduction Message SOAP Message Structure Envelope(mandatory) Header(optional) Body(mandatory) Fault(optional) 10
10 EIE424 Distributed Systems and Networking Programming –Part II 3.1 SOAP – Introduction Message Structure SOAP Message Envelope (mandatory) Header (optional) Body (mandatory) Fault (optional)