title: php soap server - what does ns mean and why it affects to server?
body: <p>I have implemented this php SOAP server using Laminas library, here is my wsdl.</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;definitions xmlns=&quot;http://schemas.xmlsoap.org/wsdl/&quot; xmlns:wsdl=&quot;http://schemas.xmlsoap.org/wsdl/&quot; xmlns:tns=&quot;http://localhost/test/api/user-notification&quot; xmlns:soap=&quot;http://schemas.xmlsoap.org/wsdl/soap/&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:soap-enc=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; xmlns:soap12=&quot;http://schemas.xmlsoap.org/wsdl/soap12/&quot; name=&quot;Demo&quot; targetNamespace=&quot;http://localhost/test/api/user-notification&quot;&gt;
  &lt;types&gt;
  &lt;xsd:schema targetNamespace=&quot;http://localhost/test/api/user-notification&quot;&gt;
  &lt;xsd:element name=&quot;notifySOAPHeader&quot;&gt;
  &lt;xsd:complexType&gt;
  &lt;xsd:sequence&gt;
  &lt;xsd:element name=&quot;name&quot; type=&quot;xsd:string&quot;/&gt;
  &lt;xsd:element name=&quot;email&quot; type=&quot;xsd:string&quot;/&gt;
  &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;
  &lt;xsd:element name=&quot;notifySOAPHeaderResponse&quot;&gt;
  &lt;xsd:complexType&gt;
  &lt;xsd:sequence&gt;
  &lt;xsd:element name=&quot;notifySOAPHeaderResult&quot; type=&quot;soap-enc:Array&quot;/&gt;
  &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;
  &lt;xsd:element name=&quot;notifyNewUser&quot;&gt;
  &lt;xsd:complexType&gt;
  &lt;xsd:sequence&gt;
  &lt;xsd:element name=&quot;correlator&quot; type=&quot;xsd:string&quot;/&gt;
  &lt;xsd:element name=&quot;message&quot; type=&quot;soap-enc:Array&quot;/&gt;
  &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;
  &lt;xsd:element name=&quot;notifyNewUserResponse&quot;&gt;
  &lt;xsd:complexType&gt;
  &lt;xsd:sequence&gt;
  &lt;xsd:element name=&quot;notifyNewUserResult&quot; type=&quot;soap-enc:Array&quot;/&gt;
  &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;
  &lt;/xsd:element&gt;
  &lt;/xsd:schema&gt;
  &lt;/types&gt;
  &lt;portType name=&quot;DemoPort&quot;&gt;
  &lt;operation name=&quot;notifySOAPHeader&quot;&gt;
  &lt;documentation&gt;notifySOAPHeader&lt;/documentation&gt;
  &lt;input message=&quot;tns:notifySOAPHeaderIn&quot;/&gt;
  &lt;output message=&quot;tns:notifySOAPHeaderOut&quot;/&gt;
  &lt;/operation&gt;
  &lt;operation name=&quot;notifyNewUser&quot;&gt;
  &lt;documentation&gt;notifyNewUser&lt;/documentation&gt;
  &lt;input message=&quot;tns:notifyNewUserIn&quot;/&gt;
  &lt;output message=&quot;tns:notifyNewUserOut&quot;/&gt;
  &lt;/operation&gt;
  &lt;/portType&gt;
  &lt;binding name=&quot;DemoBinding&quot; type=&quot;tns:DemoPort&quot;&gt;
  &lt;soap:binding style=&quot;document&quot; transport=&quot;http://schemas.xmlsoap.org/soap/http&quot;/&gt;
  &lt;operation name=&quot;notifySOAPHeader&quot;&gt;
  &lt;soap:operation soapAction=&quot;http://localhost/test/api/user-notification#notifySOAPHeader&quot;/&gt;
  &lt;input&gt;
  &lt;soap:body use=&quot;literal&quot;/&gt;
  &lt;/input&gt;
  &lt;output&gt;
  &lt;soap:body use=&quot;literal&quot;/&gt;
  &lt;/output&gt;
  &lt;/operation&gt;
  &lt;operation name=&quot;notifyNewUser&quot;&gt;
  &lt;soap:operation soapAction=&quot;http://localhost/test/api/user-notification#notifyNewUser&quot;/&gt;
  &lt;input&gt;
  &lt;soap:body use=&quot;literal&quot;/&gt;
  &lt;/input&gt;
  &lt;output&gt;
  &lt;soap:body use=&quot;literal&quot;/&gt;
  &lt;/output&gt;
  &lt;/operation&gt;
  &lt;/binding&gt;
  &lt;service name=&quot;DemoService&quot;&gt;
  &lt;port name=&quot;DemoPort&quot; binding=&quot;tns:DemoBinding&quot;&gt;
  &lt;soap:address location=&quot;http://localhost/test/api/user-notification&quot;/&gt;
  &lt;/port&gt;
  &lt;/service&gt;
  &lt;message name=&quot;notifySOAPHeaderIn&quot;&gt;
  &lt;part name=&quot;parameters&quot; element=&quot;tns:notifySOAPHeader&quot;/&gt;
  &lt;/message&gt;
  &lt;message name=&quot;notifySOAPHeaderOut&quot;&gt;
  &lt;part name=&quot;parameters&quot; element=&quot;tns:notifySOAPHeaderResponse&quot;/&gt;
  &lt;/message&gt;
  &lt;message name=&quot;notifyNewUserIn&quot;&gt;
  &lt;part name=&quot;parameters&quot; element=&quot;tns:notifyNewUser&quot;/&gt;
  &lt;/message&gt;
  &lt;message name=&quot;notifyNewUserOut&quot;&gt;
  &lt;part name=&quot;parameters&quot; element=&quot;tns:notifyNewUserResponse&quot;/&gt;
  &lt;/message&gt;
  &lt;/definitions&gt;
  </code></pre>
  <p>Then I use Postman to test with this body</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
  xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  &gt;
    &lt;soapenv:Header&gt;
      &lt;ns1:notifySOAPHeader xmlns:ns1='http://localhost/test/api/user-notification'&gt;
          &lt;ns1:name&gt;Shaq&lt;/ns1:name&gt;
          &lt;ns1:email&gt;hello@shaq.com&lt;/ns1:email&gt;
      &lt;/ns1:notifySOAPHeader&gt;
    &lt;/soapenv:Header&gt;
    &lt;soapenv:Body&gt;
      &lt;ns2:notifyNewUserReception xmlns:ns2='http://localhost/test/api/user-notification'&gt;
        &lt;ns2:correlator&gt;123456&lt;/ns2:correlator&gt;
              &lt;ns2:message&gt;
                  &lt;message&gt;123&lt;/message&gt;
                  &lt;time&gt;&gt;2022-05-07T08:03:28Z&lt;/time&gt;
              &lt;/ns2:message&gt;
      &lt;/ns2:notifyNewUserReception&gt;
    &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  <p>It works fine, however when I change xmlns:ns1=&quot;http://otherdomain.com/api&quot; or xmlns:ns2=&quot;http://otherdomain.com/api&quot; it shows error</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;
      &lt;SOAP-ENV:Body&gt;
          &lt;SOAP-ENV:Fault&gt;
              &lt;faultcode&gt;SOAP-ENV:Server&lt;/faultcode&gt;
              &lt;faultstring&gt;Procedure 'ns2:notifyNewUser' not present&lt;/faultstring&gt;
          &lt;/SOAP-ENV:Fault&gt;
      &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  <p>My question is: what does ns mean, and why I have to set ns1 and ns2 to my api url?
  Is there any way to fix my code to allow any ns value, my client connect to my soap server with different ns value :(</p>
  <p>Thanks for helping</p>