DopeAt
DopeAt

Reputation: 451

XML Nodes differ from Php Soap

Hi guys I am new to xml and I am curious if there is any difference between the 2 codes above:

<soapenv:Envelope xmlns......>
  <gro:GetGeography>
    <gro:request>
      <gro:ClientIPAddress>?</gro:ClientIPAddress>
    </gro:request>
  </gro:GetGeography>
</soapenv:Envelope>

<SOAP-ENV:Envelope xmlns......> 
 <ns1:GetGeography>
    <ns1:request>
      <ns1:ClientIPAddress>?</ns1:ClientIPAddress>
    </ns1:request>
  </ns1:GetGeography>
</SOAP-ENV:Envelope>

So I have to make a request like the first one but SoapClient on Php is creating the code like the bottom one.

Is there any difference? e.g First one has gro: and the second ns1:.

Also I can see that <soapenv> is different to second <SOAP_ENV> is it Case Sensitive?

I am not getting any response but I am not sure if the problem is here or on the rest of the code. But I am curious is there any difference on these I mentioned before? If yes what the way to change them in Php?

Thanks in advance.

Upvotes: 1

Views: 52

Answers (1)

ThW
ThW

Reputation: 19482

The meaning is the same.

soapenv and SOAP-ENV are aliases for the actual namespace http://www.w3.org/2003/05/soap-envelope/. The XML parser will read the namespace definitions and match the namespace values. In PHP DOM you will find the namespace in the $namespaceURI property.

The following 4 examples can all be read as {http://www.w3.org/2003/05/soap-envelope/}Envelope:

  • <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"/>
  • <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope/"/>
  • <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope/"/>
  • <Envelope xmlns="http://www.w3.org/2003/05/soap-envelope/"/>

The namespace prefixes can be redefined on any element node. Namespaces need to be unique, so they tend to be long and complex. To make the XML easier to read (and smaller) aliases are used as tag prefixes.

Upvotes: 2

Related Questions