Anyone familiar with SOAP

fallenangel99

Golden Member
Aug 8, 2001
1,721
1
81

Why does the example below use <m:...> but not the other? What is the m mean? The 2nd example uses <ns1:...>

the difference between (http://www.w3schools.com/soap/soap_body.asp)

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

<soap:Body>
<m:GetPrice xmlns:m="http://www.w3schools.com/prices">
<m:Item>Apples</m:Item>
</m:GetPrice>
</soap:Body>

</soap:Envelope>

and

(http://www.soapuser.com/basics3.html)

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:doubleAnInteger
xmlns:ns1="urn:MySoapServices">
<param1 xsi:type="xsd:int">123</param1>
</ns1:doubleAnInteger>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
The prefix is a namespace qualifier. It's like m.Getprice in C#, or m::Getprice in C++. The xmlns: tag introduces the definition of the namespace into the markup for the document. The first example works a little differently in terms of scoping than I thought it should work, but I was probably wrong. I would have thought that xmlns: in that example defined m only in the context of the declaration of the GetPrice element.

In any case, the sole point of it all is to make names unique, so that I can define an entity called GetPrice, and you can also defined one called GetPrice, and they can both be used in a doc if needed because we defined different unique namespaces.