Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SOAP - PHP is possible to change 'ns1' tag name?

Tags:

php

soap

xml

I need send a XML with this format:

<soapenv:Body>
<loc:amount>
  <loc:user>user_name</loc:user>
  <loc:charge>
    <description>description_text</description>
  </loc:charge>
</loc:amount>

I have generate the XML body with soapVar, but I cant change "ns1" tag. Source:

$var = '<loc:amount> <loc:user>user_name</loc:user> <loc:charge> <description>description_text</description> </loc:charge> </loc:amount>';    
$params[0] = new SoapVar($var,XSD_ANYXML,'amount','http://mydomain.cm');

And the header result is this:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://mydomain.cm" xmlns:ns2="http://header_domain.cm">

I need this result:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:loc="http://mydomain.cm" xmlns:ns2="http://header_domain.cm">

Is possible to change 'ns1' tag to 'loc'??

Thanks

like image 807
xandra Avatar asked Sep 13 '16 13:09

xandra


1 Answers

Namespace prefix names are insignificant; it is only through their binding to a namespace value that they derive meaning. No conformant XML processor will care about the specific namespace prefix names; you should not either.

like image 169
kjhughes Avatar answered Sep 19 '22 05:09

kjhughes