title: PHP SoapClient does not add namespace to all elements
body: <p>I'm using PHP Soap Client with WSDL to send soap requests.
  That's the way I initialize the SoapClient:</p>
  
  <pre><code>$options = [
        "trace" =&gt; 1,
        "login" =&gt; "Universal API/uAPI3170205802-sdv3r34",
        "password" =&gt; "U^#3@$dfw2",
        "classmap" =&gt; [ 
                "BookingDisplayRsp" =&gt; "BookingAirSegmentRsp"
        ],
  ];
  $this-&gt;soapClient = new \SoapClient("BookingAirPnrElement.wsdl",$options);
  $request = [
      "BookingAirPnrElementReq" =&gt; [
          "AuthorizedBy" =&gt; 'user',
          "SessionKey" =&gt; 'e6a30377-0956-4ac4-947d-b4ccb6641629',
          "BillingPointOfSaleInfo" =&gt; [
              "OriginApplication" =&gt; "uAPI"
          ],
          "AddAirPnrElement" =&gt; [
              "LoyaltyCard" =&gt; [
                  "SupplierCode" =&gt; "DL",
                  "CardNumber" =&gt; "23434523"
              ]
          ],
          "TargetBranch" =&gt; "P878183",
      ]
  ];
  </code></pre>
  
  <p>Doing Soap Request:</p>
  
  <pre><code> $response = $this-&gt;soapClient-&gt;__soapCall('service', $request);
  </code></pre>
  
  <p>I receive a Soap Fault:</p>
  
  <pre><code>&lt;SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"&gt;
    &lt;SOAP:Body&gt;
      &lt;SOAP:Fault&gt;
        &lt;faultcode&gt;Server.Data&lt;/faultcode&gt;
        &lt;faultstring&gt;Error unmarshalling message body: Expected " {http://www.travelport.com/schema/sharedBooking_v41_0}BookingAirPnrElementReq" end tag, found "AddAirPnrElement" start tag (line 21, col 25, in UTF-8)&lt;/faultstring&gt;
       &lt;detail&gt;
          &lt;common_v41_0:ErrorInfo xmlns:common_v41_0="http://www.travelport.com/schema/common_v41_0"&gt;
             &lt;common_v41_0:Code&gt;1005&lt;/common_v41_0:Code&gt;
             &lt;common_v41_0:Service&gt;WEBSVC&lt;/common_v41_0:Service&gt;
             &lt;common_v41_0:Type&gt;Data&lt;/common_v41_0:Type&gt;
             &lt;common_v41_0:Description&gt;Unable to parse XML stream&lt;/common_v41_0:Description&gt;
             &lt;common_v41_0:TransactionId&gt;C42964360A07425CB318E5F570EEE3DC&lt;/common_v41_0:TransactionId&gt;
          &lt;/common_v41_0:ErrorInfo&gt;
       &lt;/detail&gt;
     &lt;/SOAP:Fault&gt;
   &lt;/SOAP:Body&gt;
  </code></pre>
  
  <p></p>
  
  <p>The XML request generated by SoapClient:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
    &lt;SOAP-ENV:Envelope xmlns:SOAP ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.travelport.com/schema/common_v41_0" xmlns:ns2="http://www.travelport.com/schema/sharedBooking_v41_0"&gt;
      &lt;SOAP-ENV:Header&gt;
        &lt;h:SessionContext xmlns:h="http://www.travelport.com/soa/common/security/SessionContext_v1" xmlns="http://www.travelport.com/soa/common/security/SessionContext_v1"&gt;
          &lt;SessTok id="9444dc84-87c9-4563-80ab-a5f6475bfbe9"/&gt;
        &lt;/h:SessionContext&gt;
      &lt;/SOAP-ENV:Header&gt;
      &lt;SOAP-ENV:Body&gt;
        &lt;ns2:BookingAirPnrElementReq AuthorizedBy="user" TargetBranch="P878183" SessionKey="9444dc84-87c9-4563-80ab-a5f6475bfbe9"&gt;
          &lt;ns1:BillingPointOfSaleInfo OriginApplication="uAPI"/&gt;
          &lt;AddAirPnrElement&gt;
            &lt;ns1:LoyaltyCard CardNumber="23434523" SupplierCode="DL"/&gt;
          &lt;/AddAirPnrElement&gt;
          &lt;/ns2:BookingAirPnrElementReq&gt;
      &lt;/SOAP-ENV:Body&gt;
    &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>As you can see the <strong>AddAirPnrElement</strong> element does not have namespace <strong>ns2</strong> that corresponds to the <strong>xmlns:ns2="http://www.travelport.com/schema/sharedBooking_v41_0"</strong></p>
  
  <p>If I add manually <strong>ns2</strong> namespace to that element (<strong>AddAirPnrElement</strong>) and I send the same XML request in SoapUI, everything is ok.
  So the problem is that Soap Client does not set a namespace to that attribute.</p>
  
  <p>Here is the WSDL:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;definitions name="SharedBookingService"
           xmlns="http://schemas.xmlsoap.org/wsdl/"
           xmlns:xsd="http://www.w3.org/2001/XMLSchema"
           xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
           xmlns:tns="http://www.travelport.com/service/sharedBooking_v41_0"
           xmlns:ns1="http://www.travelport.com/schema/sharedBooking_v41_0"
     xmlns:sc="http://www.travelport.com/soa/common/security/SessionContext_v1"           targetNamespace="http://www.travelport.com/service/sharedBooking_v41_0"&gt;
  
     &lt;import namespace="http://www.travelport.com/service/sharedBooking_v41_0" location="SharedBookingAbstract.wsdl"/&gt;
  
     &lt;binding name="BookingAirPnrElementBinding" type="tns:BookingAirPnrElementPortType"&gt;
        &lt;soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/&gt;
        &lt;operation name="service"&gt;
          &lt;soap:operation soapAction="https://americas.universal-api.travelport.com/B2BGateway/connect/uAPI/SharedBookingService"/&gt;
          &lt;input&gt;
              &lt;soap:header use="literal" part="sessionContext" message="tns:SessionContext"/&gt;
              &lt;soap:body use="literal"/&gt;
          &lt;/input&gt;
          &lt;output&gt;
              &lt;soap:body use="literal"/&gt;
          &lt;/output&gt;
          &lt;fault name="ErrorInfoMsg"&gt;
              &lt;soap:fault name="ErrorInfoMsg" use="literal"/&gt;
          &lt;/fault&gt;
       &lt;/operation&gt;
    &lt;/binding&gt;
  
    &lt;service name="SharedBookingService"&gt;
      &lt;port name="BookingAirPnrElementPort" binding="tns:BookingAirPnrElementBinding"&gt;
          &lt;soap:address location="https://americas.universal-api.travelport.com/B2BGateway/connect/uAPI/SharedBookingService"/&gt;
      &lt;/port&gt;
    &lt;/service&gt;
  &lt;/definitions&gt;
  </code></pre>
  
  <p>Can anyone help me understand why Soap Client does not set the namespace?</p>
  
  <p>Thanks a lot.</p>