How does XML relate to Web services and SOA?

Time:2019-5-24

Although many technologies can be used to implement Service Oriented Architecture (SOA), the most commonly used one is Web Services, which means using XML. SOAP and REST are the two most popular ways to implement Web services, both based on XML.
An example

For example, by sending this SOAP document as a Web request, a request can be made to a Google Web service. (As shown in Listing 2)
Listing 2. Make a request to the Google Web service by sending a SOAP document

<?xml version=’1.0′ encoding=’UTF-8′?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV=

“http://schemas.xmlsoap.org/soap/envelope/”

xmlns:xsi=”http://www.w3.org/1999/XMLSchema-instance”

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

<SOAP-ENV:Body>

<ns1:doGoogleSearch xmlns:ns1=”urn:GoogleSearch”

SOAP-ENV:encodingStyle=

“http://schemas.xmlsoap.org/soap/encoding/”>

<key xsi:type=”xsd:string”>00000000000000000000000000000000</key>

<q xsi:type=”xsd:string”>death star trash compactor</q>

<start xsi:type=”xsd:int”>0</start>

<maxResults xsi:type=”xsd:int”>10</maxResults>

<filter xsi:type=”xsd:boolean”>true</filter>

<restrict xsi:type=”xsd:string”></restrict>

<safeSearch xsi:type=”xsd:boolean”>false</safeSearch>

<lr xsi:type=”xsd:string”></lr>

<ie xsi:type=”xsd:string”>latin1</ie>

<oe xsi:type=”xsd:string”>latin1</oe>

</ns1:doGoogleSearch>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

Here we can see SOAPEnvelopeIt is a standard format that Web service engines can understand. The content of this message (in this case, the doGoogle Search element) is recognized asPayloadIt consists of information to be processed by Web services.