php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39357 absent fault detail node
Submitted: 2006-11-03 10:01 UTC Modified: 2006-11-08 13:09 UTC
From: yaksenov at iponweb dot net Assigned: dmitry (profile)
Status: Not a bug Package: SOAP related
PHP Version: 5.2.0 OS: gentoo-linux
Private report: No CVE-ID: None
 [2006-11-03 10:01 UTC] yaksenov at iponweb dot net
Description:
------------
SoapFault->__construct() with 'faultname' causes wrong 
fault response: the <detail> node is absent.

Reproduce code:
---------------
http://rapidshare.com/files/1788815/soap_fault_detail_post.tar.gz

Expected result:
----------------
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:ns1="http://api.mymanager.com/types" 
xmlns:ns2="urn:ContactService" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Body>
    <SOAP-ENV:Fault>
      <faultcode>SOAP-ENV:Server</faultcode>
      <faultstring>always throw exception</faultstring>
      
<faultactor>http://localhost/soap_fault_detail/contact.php</faultactor>
      <detail>
        <ns2:exception_detail 
xsi:type="ns1:exception_detail">
          <code xsi:type="xsd:string">access</code>
        </ns2:exception_detail>
      </detail>
    </SOAP-ENV:Fault>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Actual result:
--------------
 <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:ns1="http://api.mymanager.com/types">
  <SOAP-ENV:Body>
    <SOAP-ENV:Fault>
      <faultcode>SOAP-ENV:Server</faultcode>
      <faultstring>always throw exception</faultstring>
      
<faultactor>http://localhost/soap_fault_detail/contact.php</faultactor>
      <exception_detail xsi:type="ns1:exception_detail">
        <code>access</code>
      </exception_detail>
    </SOAP-ENV:Fault>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-03 11:18 UTC] yaksenov at iponweb dot net
updated code to reproduce the behavior - client.pl added
http://rapidshare.com/files/1796872/soap_fault_detail_post.tar.gz
MD5: fde0f911544e2096c4e992d23b1df0e8
 [2006-11-08 13:09 UTC] dmitry@php.net
Your test code has two mistakes.

In client.php you should use "loginFault" as fault name (not "exception_detail").

In wsdl file you refer to elemnt named "types:exception_detail", but you don't declare such element (only type). To declare it change gen.xsd

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:types="http://api.mymanager.com/types" targetNamespace="http://api.mymanager.com/types">
  <xsd:element name="exception_detail">
  <xsd:complexType>
    <xsd:all>
      <xsd:element name="code" type="xsd:string" minOccurs="0"/>
    </xsd:all>
  </xsd:complexType>
  </xsd:element>
</xsd:schema>

After fix this errors you can also remove SoapVar creation and pass exception_detail object directly to SoapFault constructor.

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon May 20 10:01:27 2019 UTC