Doc #51751 [NEW]: Adding header to SOAPFault

From: Date: Wed, 05 May 2010 19:45:54 +0000
Subject: Doc #51751 [NEW]: Adding header to SOAPFault
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-4318@lists.php.net to get a copy of this message
From: Operating system: CentOS PHP version: 5.2.13 Package: Documentation problem Bug Type: Documentation Problem Bug description:Adding header to SOAPFault Description: ------------ I'm developing a Web Service using the SOAP class with WSDL mode on. I'm having problems when I need to add Headers to the Soap Fault response, and looked examples everywhere, but I haven't found them. As documentation says, the sixth parameter of the SoapFault constructor is the one that should do this, but although I did so, no headers have been added to my SoapFault response. I add the code below, as well as an example of my Request/Response. <?php /** * class Transaction * * @param $TransactionId = string */ class Transaction { public $TransactionId; function __construct($Transaction){ $this->TransactionId = $Transaction; } } /** * class soapdetail * Class to create a Fault Detail * @param $ID = string. Error Number. * @param $Description = string. Short description about occurred error. */ class soapdetail { public $ID; public $Description; function __construct($codigo, $detalle){ $this->ID = $codigo; $this->Description = $detalle; } } class WSSuscripciones { /** * method consulta * * @param object $NumeroLinea * */ public function consulta($NumeroLinea) { if (!$this->authenticated) { $soap = new soapdetail("2","Las credenciales no estan autorizadas para realizar esta consulta."); $transaction = new Transaction($this->TransactionId); $authvalues = new SoapVar($transaction, SOAP_ENC_OBJECT); $header = new SoapHeader('My WSDL URL', 'Transaction', $authvalues); throw new SOAPFault("soap:Server", "Las credenciales no estan autorizadas para realizar esta consulta.", "My WSDL URL", $soap, "Transaction", $header); } else { //do something } } ?> Expected result: ---------------- Response: <?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"> <env:Header> <ns2:Transaction> <TransactionId>5553</TransactionId> </ns2:Transaction> </env:Header> <env:Body> <env:Fault> <env:Code> <env:Value>soap:Server</env:Value> </env:Code> <env:Reason> <env:Text>Las credenciales no estan autorizadas para realizar esta consulta.</env:Text> </env:Reason> <env:Detail> <ID>2</ID> <Description>Las credenciales no estan autorizadas para realizar esta consulta.</Description> </env:Detail> </env:Fault> </env:Body> </env:Envelope> Actual result: -------------- Request: <?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://tempuri.org/" xmlns:ns2="My WSDL URL"> <env:Header> <ns2:Transaction> <TransactionId>5553</TransactionId> </ns2:Transaction> <ns2:Authentication> <UserName>telecom</UserName> <Password>WSuscr1pc10n3sd</Password> </ns2:Authentication> </env:Header> <env:Body> <ns1:consulta> <ns1:NumeroLinea>1111111111</ns1:NumeroLinea> </ns1:consulta> </env:Body> </env:Envelope> Response: <?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body> <env:Fault> <env:Code> <env:Value>soap:Server</env:Value> </env:Code> <env:Reason> <env:Text>Las credenciales no estan autorizadas para realizar esta consulta.</env:Text> </env:Reason> <env:Detail> <ID>2</ID> <Description>Las credenciales no estan autorizadas para realizar esta consulta.</Description> </env:Detail> </env:Fault> </env:Body> </env:Envelope> -- Edit bug report at http://bugs.php.net/bug.php?id=51751&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51751&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51751&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51751&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=51751&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51751&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=51751&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=51751&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=51751&r=needscript Try newer version: http://bugs.php.net/fix.php?id=51751&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=51751&r=support Expected behavior: http://bugs.php.net/fix.php?id=51751&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=51751&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=51751&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=51751&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51751&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=51751&r=dst IIS Stability: http://bugs.php.net/fix.php?id=51751&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=51751&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=51751&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=51751&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=51751&r=mysqlcfg

« previous php.doc.bugs (#4318) next »