function __doRequest($request, $location, $action, $version) { $dom = new DomDocument('1.0', 'UTF-8'); $dom->preserveWhiteSpace = false; $dom->loadXML($request); $hdr = $dom->createElement('soapenv:Header'); $secNode = $dom->createElement("wsse:Security"); $secNode->setAttribute("soapenv:mustUnderstand", "1"); $secNode->setAttribute("xmlns:wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); $usernameTokenNode = $dom->createElement("wsse:UsernameToken"); $usernameTokenNode->setAttribute("wsu:Id", "UsernameToken-1"); $usernameTokenNode->setAttribute("xmlns:wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"); $usrNode = $dom->createElement("wsse:Username"); $usrNode->appendChild($dom->createTextNode(WS_USER)); $pwdNode = $dom->createElement("wsse:Password"); $pwdNode->setAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"); $pwdNode->appendchild($dom->createTextnode(WS_PWD)); $usernameTokenNode->appendChild($usrNode); $usernameTokenNode->appendChild($pwdNode); $secNode->appendChild($usernameTokenNode); $hdr->appendChild($secNode); $dom->documentElement->insertBefore($hdr, $dom->documentElement->firstChild); $request = $dom->saveXML(); $request = str_replace("SOAP-ENV", "soapenv", $request); $request = str_replace("ns1", "cgt", $request); $request = str_replace('<?xml version="1.0" encoding="UTF-8"?>', '', $request); // echo "Este es el nuevo XML: " . print_r($request, true); return parent::__doRequest($request, $location, $action, $version); }