Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
current (nightly)
-
None
-
None
Description
I catch all exceptions in my wrapper code and convert them to SOAP faults, using pIWSSZ->createSoapFault(). This was working fine and the client could see the error messages that were in my exceptions. Recently that has broken. I traced the problem down to the fact that SOAP faults are blindly being overwritten in SoapSerializer::setSoapFault() :
if( m_pSoapEnvelope && (m_pSoapEnvelope->m_pSoapBody))
{
m_pSoapEnvelope->m_pSoapBody->m_pSoapFault = pSoapFault;
When I run this in the debugger, I can see my SOAP fault in m_pSoapEnvelope->m_pSoapBody->m_pSoapFault but as you can see, it is being over written here.
I am not sure what changed that broke this, but I see two possible solutions:
1. Simply change
if( m_pSoapEnvelope && (m_pSoapEnvelope->m_pSoapBody))
to
if( m_pSoapEnvelope && (m_pSoapEnvelope->m_pSoapBody) && !m_pSoapEnvelope->m_pSoapBody->m_pSoapFault)
or
2. Append the fault string and detail nodes from one of the faults to the detail nodes of the other.
Also, m_pSoapEnvelope->m_pSoapBody->m_pSoapFault = pSoapFault; is a bit dangerous in the sense that it easily leads to memory leaks (as it did here). It would be better to use accessor methods that check if there already is a value that needs to be freed before a new one is assigned.
PS. While you are editing that files, it would be a good idea to change "occured" to "occurred".