在PHP中将名称空间属性添加到SOAP头

在PHP中将名称空间属性添加到SOAP头,php,soap,soap-client,Php,Soap,Soap Client,我的目标SOAP请求如下所示 <S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope"> <S:Header> <a:Action xmlns:a="http://www.w3.org/2005/08/addressing" S:mustUnderstand="1">http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Iss

我的目标SOAP请求如下所示

<S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope">
   <S:Header>
      <a:Action xmlns:a="http://www.w3.org/2005/08/addressing" S:mustUnderstand="1">http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue</a:Action>
      <a:MessageID xmlns:a="http://www.w3.org/2005/08/addressing">uuid-696c51d8-4866-4ff4-9f8b-24f1ad8ca438</a:MessageID>
      <a:ReplyTo xmlns:a="http://www.w3.org/2005/08/addressing">
         <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
      </a:ReplyTo>
      <a:To xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="_1" S:mustUnderstand="1">https://thirdparty.authentication.business.gov.au/R3.0/vanguard/S007v1.2/service.svc</a:To>
  </S:Header>
  <S:Body>
  ....
  </S:Body>
</S:Envelope>
但问题是,我根本不知道如何将名称空间属性注入到SOAP头中

const ACTION_ISSUE = 'http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue';
const NS_ADDR = 'http://www.w3.org/2005/08/addressing';

$message_id = uniqid('uuid-');

$action = new SoapHeader(NS_ADDR, 'Action', ACTION_ISSUE, true);
$message_id = new SoapHeader(NS_ADDR, 'MessageID', $message_id);

$reply_to_addr = array(
    'Address' => new SoapVar('http://www.w3.org/2005/08/addressing/anonymous', XSD_STRING, null, null, null, NS_ADDR),
);
$address_val = new SoapVar($reply_to_addr, SOAP_ENC_OBJECT, null, null, null, NS_ADDR);
$reply_to = new SoapHeader(NS_ADDR, 'ReplyTo', $address_val);

$to = new SoapHeader(NS_ADDR, 'To', 'https://thirdparty.authentication.business.gov.au/R3.0/vanguard/S007v1.2/service.svc', true);