src/Soap/Client.php
protected function buildHeaders($version)
    {
        $headers = $this->customHeaders;
        //add version specific headers
        switch ($version) {
            case SOAP_1_1:
                $headers['Content-Type'] = is_null($this->contentType) ? 'text/xml' : $this->contentType;
                if (!empty($action)) {
                    $headers['SOAPAction'] = '"'. str_replace('"', '\"', $action) . '"';
                }
                break;
            case SOAP_1_2:
                if ($this->contentType === null) {
                    $headers['Content-Type'] = 'application/soap+xml; charset=utf-8';
                    if (!empty($action)) {
                        $headers['Content-Type'] .= '; action="'.str_replace('"', '\"', $action).'"';
                    }
                } else {
                    if (empty($action)) {
                        $headers['Content-Type'] = $this->contentType;
                    } else {
                        //allows usage of SOAPACTION replacement token
                        $headers['Content-Type'] = str_replace("{SOAPACTION}", str_replace('"', '\"', $action), $this->contentType);
                    }
                }
                break;
            default:
                $headers['Content-Type'] = 'application/soap+xml';
        }
        $headersFormatted = [];
        foreach ($headers as $header => $value) {
            $headersFormatted[] = $header . ": " . $value;
        }
        return $headersFormatted;
    }
protected function buildHeaders($version)
    {
        $headers = $this->customHeaders;
        //add version specific headers
        switch ($version) {
            case SOAP_1_1:
                $headers['Content-Type'] = is_null($this->contentType) ? 'text/xml' : $this->contentType;
                if (!empty($action)) {
                    $headers['SOAPAction'] = '"'. str_replace('"', '\"', $action) . '"';
                }
                break;
            case SOAP_1_2:
                if ($this->contentType === null) {
                    $headers['Content-Type'] = 'application/soap+xml; charset=utf-8';
                    if (!empty($action)) {
                        $headers['Content-Type'] .= '; action="'.str_replace('"', '\"', $action).'"';
                    }
                } else {
                    if (empty($action)) {
                        $headers['Content-Type'] = $this->contentType;
                    } else {
                        //allows usage of SOAPACTION replacement token
                        $headers['Content-Type'] = str_replace("{SOAPACTION}", str_replace('"', '\"', $action), $this->contentType);
                    }
                }
                break;
            default:
                $headers['Content-Type'] = 'application/soap+xml';
        }
        $headersFormatted = [];
        foreach ($headers as $header => $value) {
            $headersFormatted[] = $header . ": " . $value;
        }
        return $headersFormatted;
    }
protected function buildHeaders ( $ version ) { $ headers = $ this -> customHeaders ; //add version specific headers switch ( $ version ) { case SOAP_1_1 : $ headers [ 'Content-Type' ] = is_null ( $ this -> contentType ) ? 'text/xml' : $ this -> contentType ; if ( ! empty ( $ action ) ) { $ headers [ 'SOAPAction' ] = '"' . str_replace ( '"' , '\"' , $ action ) . '"' ; } break ; case SOAP_1_2 : if ( $ this -> contentType === null ) { $ headers [ 'Content-Type' ] = 'application/soap+xml; charset=utf-8' ; if ( ! empty ( $ action ) ) { $ headers [ 'Content-Type' ] .= '; action="' . str_replace ( '"' , '\"' , $ action ) . '"' ; } } else { if ( empty ( $ action ) ) { $ headers [ 'Content-Type' ] = $ this -> contentType ; } else { //allows usage of SOAPACTION replacement token $ headers [ 'Content-Type' ] = str_replace ( "{SOAPACTION}" , str_replace ( '"' , '\"' , $ action ) , $ this -> contentType ) ; } } break ; default : $ headers [ 'Content-Type' ] = 'application/soap+xml' ; } $ headersFormatted = [ ] ; foreach ( $ headers as $ header => $ value ) { $ headersFormatted [ ] = $ header . ": " . $ value ; } return $ headersFormatted ; }
Builds and returns an array of headers, based on custom ones and required
by soap call protocol's version (like SOAPAction or specific content type).

@param int $version SOAP protocol version (SOAP_1_1, SOAP_1_2)
@return string[]
Builds and returns an array of headers based on custom ones and required by soap call protocol s version ( like SOAPAction or specific content type ) .