Hey guys! First of all, I don’t think I’ve introduced myself to you yet.
For those who don’t know me, I’m Eládio Tchiinhemba, I live in Luanda (Angola) and I’m a programmer.
In previous articles, I talked about Web Services and SOAP, so I couldn’t leave out today’s topic (SOAP Message).
Talking about SOAP and also talking about the technologies involved, and the technology that deserves to be highlighted today in our article is Extensible Markup Language , also known as XML .
XML is a markup language created by theW3Cin the mid-1990s.
As we already saw in #1 | Dev Notes! | Web Services, Web Services were created so that different applications can communicate. However, the question is:
How can two different applications talk (exchange information)? Knowing that they are different in both platform and language!
The answer is they can’t. Such a thing only becomes possible if there is something in common between them.
For example: Your grandmother speaks Kimbundo and your son speaks Nihongo (Japanese), we know that both of you will not be able to talk if there is not something that you can both understand, this means of understanding could be a translator like Google Translate, a dictionary or even an interpreter.
It’s the same thing with Web Services, for them to talk, that is, to exchange information, they need something in common. The term Object in the SOAP acronym refers to the object that is exchanged by Web Services, and we call this object a SOAP Message, which is nothing more or less than a document written in XML language.
Web Services use an architecture called SOAP architecture (in addition to architecture, SOAP is also a protocol) to exchange messages written in XML language, that is, to exchange information between applications.
Because both applications have XML as a common language, this facilitates content separation.
Using XML has no limitations for creating tags.
Because both applications have a common language, this makes integration between applications much easier.
Attention: XML can be used inside or outside SOAP, with or without SOAP, but SOAP will always be used with XML.
SOAP Structure
SOAP Message has a unique structure that must be followed.
<soap:Envelope>
<soap:Header>
</soap:Header>
<soap:Body>
</soap:Body>
</soap:Envelop>
The SOAP Envelop is the first element of the document and is used to encapsulate the entire SOAP message .
The SOAP Header is the element that has all the attribute information and metadata of the request.
SOAP Body is the element that contains the message details.
Example of a SOAP Message
<soap:Envelop xmlns:soap="<http://www.w3.org/2003/5/soap-envelop>">
<soap:Header>
</soap:Header>
<soap:Body>
<m:MetodoEndereco xmlns:m="<http://www.exemplo.org/endereco>">
<m:Cidade>Luanda</m:Cidade>
<m:Rua>Comandante Kanhangulo</m:Rua>
<m:Distrito>Luanda</m:Distrito>
<m:Numero>+244937289044</m:Numero>
</m:MetodoEndereco>
</soap:Body>
</soap:Envelop>
Well, that’s all for today!
NOTE: Please make a point of leaving your point of view in the comments! This way we become more consistent. And if this content is somehow conveying the wrong idea, please feel free to correct it. It will be very useful for me and the community.
Glossary
- XML – Extensible Markup Language
- W3C – World Wide Web Consortium
- SOAP – Simple Object Access Protocol