#FifthBlogDone
Explore tagged Tumblr posts
enigmaticlearner · 6 years ago
Text
SOAP is a revolutionary topic!But what is SOAP?
Tumblr media
Up-to my fourth blog article we have been discussing about frameworks and distributed systems.
And today lets take a view at server side development.As the first topic of server side development we'll be talking about SOAP,a famous web service technique used nowadays.
1)Web Services
So first of all what are web services and why do we need them?
Web services are a type of applications that is been developed in server side which provide a set of services.These services will be exposed via an API.(API-application programming interface-these include what to be used in a class)
Now that as we know what a web service is lets see how web services work.
Tumblr media
XML language is used to encode all communication to a web service. Ex:When a client invokes a web service by sending a XML message,then waits for a corresponding XML response.All the communication is in XML, therefore web services aren't tied to any operating system or programming language-Java can talk with Perl;windows applications can talk with Unix applications.
Web services are built on top of TCP/IP,HTTP,HTML,Java and XML. Multiple types of clients have the ability to communicate with web service via the API. EX:Browser based clients,non-browser clients like mobile apps, POS systems and etc.
Basically, web services have the platform of XML+HTTP.All standard web services work using following components. 1.SOAP - Simple Object Access Protocol 2.UDDI - Universal Description,Discovery and Integration 3.WSDL - Web Services Description Language
Of these we will be concentrating on SOAP and WSDL for now..
Web services have some differences when compared with web applications.
Tumblr media
2)WSDL - Web Services Description Language WSDL describes web services.It is also written in XML. It specifies the following 1.What a service does - methods 2.How a service is accessed - operations 3.Where a service is located - address(URL) is located
But why is WSDL important to us? A document written in WSDL is called a WSDL document.WSDL is simply a contract between SOAP and the client who wishes to use service. Therefore it acts as a middle user between SOAP and the client.
Mainly WSDL consists of two parts as, 1.Abstract interface section Defines signatures of procedures.
2.Deployment section Defines service location.
The most important points to be focused are on WSDL elements. So lets take a brief look at them.
This is a WSDL document,looking a bit complex but once you go through the terminologies it is not hard to understand the things.I will be adding links to refer on for more knowledge my friends.
Tumblr media
A WSDL document has elements like <type>,<message>,<portType>, <binding>,<service>
Tumblr media
1.<type> Declaration of data types is done here.
2.<message> The message content to be communicated is included in <message> element.
3.<portType> Includes a set of operations that has input,output and fault messages and parameter order.
In Java the equivalences for portType and operation are as follows, portType->Java interface operation->method name
4.<binding> Protocols and data format specialization is defined in this element. binding element has two main attributes, 1.name-defines the name of binding 2.attribute-points to the port for the binding
5.<service> Binds web service to a specific network-addressable location.
You can visit W3schools link to find more details.
https://www.w3schools.com/xml/xml_wsdl.asp
3)More about SOAP Back again to SOAP.We will thoroughly look at SOAP now.
As SOAP is platform independent and as it provides a way to communicate between applications running on different operating systems with different technologies and programming languages SOAP is very popular.
Tumblr media
It supports both message oriented and functional oriented communication.
SOAP has the elements as,
Tumblr media
1.Envelope This is the root element,it wraps all data in it. Indicates the start and end of the message to the receiver.
2.Header Contains meta-data.Optional to have but if it is existing it should be immediate after the envelope.
3.Body Has call and responsive information with message content
4.Fault Contains error and fault status. Can appear only once in the SOAP message.
5.attachmentPart SOAP messages may have one or more attachments. Each attachmentPart object has a MIME header to indicate the type of data it contains.
(MIME-Multipurpose Internet Mail Extensions is an Internet standard that extends the format of email to support Text in character sets other than ASCII)
4)Using web-services
Web services can be used through JAX-WS. JAX-WS stands for Java API for XML Web Services.This is a java library/package for developing web services.
JAX-WS uses web annotations in coding.
Java Annotation is a tag that represents the metadata i.e. attached with class, interface, methods or fields to indicate some additional information which can be used by java compiler and JVM.
These are usually written by the notation,
@webAnnotation.
Ex:
•@WebService •@WebMethod •@OneWay
Tumblr media
5)Creating a JAX-WS web service project by Eclipse
To test our knowledge and learn more about about web services we can run a web services project using the Eclipse IDE.
A normal Java project in Eclipse can later function as a web services project.
Two separate Java projects have to be created for the client and services. The relevant Java packages can be imported by using a command like, Ex: import javax.*; The * symbol represents for importing all into the project by the relevant libraries.
References
[1] Wikipedia.com. “SOAP”. [Accessed: March 12, 2019].
[2]W3Schools.com. “XML SOAP”. [Accessed: March 12, 2019].
[3]Tutorials Point.com. “Web Services”. [Accessed: March 12, 2019].
0 notes