Home >Backend Development >XML/RSS Tutorial >How does XML relate to Web services and SOA?

How does XML relate to Web services and SOA?

黄舟
黄舟Original
2017-02-25 14:17:381608browse

Although many technologies can be used to implement a service-oriented architecture (SOA), the most common is to use Web services.

This means to use XML. SOAP and REST are the two most popular methods of implementing web services, both of which are based on XML.

An example
For example, by converting this SOAP documents are sent as web requests to Google web services. (As shown in Listing 2) ▼

▼List 2. Make a request to Google Web Services by sending a SOAP document

<?xml version=&#39;1.0&#39; encoding=&#39;UTF-8&#39;?><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 SOAP envelope, which is a standard format understood by web service engines.

The content of this message (in this case doGoogleSearch element) is considered the payload, which consists of the information to be processed by the web service.

The above is how XML is related to Web services and SOA? Content, for more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn