Hi Jamie,
I changed the implementation of SoapDeSerializer::getFaultAsXmlString on
19/5/05 to use getAnyObject instead of constructing the XML itself. Please
check that you're using a later level. That method new's the detail as
char[], and the XML is correctly being passed back to your stub, so I'm
confused as to why the stub is failing as it deletes the detail. Try
running it with trace on.
Mark
Mark Whitlock
IBM

----- Forwarded by Mark Whitlock/UK/IBM on 24/05/2005 13:21 -----
                                                                           
             Jamie                                                         
             <[EMAIL PROTECTED]                                             
             a>                                                         To 
                                       axis-c-user@ws.apache.org           
             24/05/2005 12:52                                           cc 
                                                                           
                                                                   Subject 
             Please respond to         web service exception causes crash  
              "Apache AXIS C           - possible bug in WSDL2Ws?          
                User List"                                                 
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Hi everyone,

I am using the latest nightly build of Axis C++. My client application
crashes when an exception is thrown from the server via Axis web
services. The generated code (see below), attempts to delete memory
pointed to by detail (fault point is marked below). The contents of
detail at this point is"<hostname>jamie</hostname>". Any ideas on how to
fix this? From time to time, my server application throws exceptions..
in which case i'd like the client app to behave responsibly.

Thanks in advance for your help.

Jamie


Is this a bug in the code generated by WSDL2Ws?
/*
 * This method wrap the service methodstoreMessage
 */
xsd__boolean TestApp::storeMessage(xsd__base64Binary Value0)
{
    xsd__boolean Ret = false_;
    const char* pcCmplxFaultName;
    pcCmplxFaultName = NULL;
    try
    {    if (AXIS_SUCCESS != m_pCall->initialize(CPP_DOC_PROVIDER))
return Ret;
        if (NULL==m_pCall->getTransportProperty("SOAPAction",false))
    {
        m_pCall->setTransportProperty(SOAPACTION_HEADER , "");
    }
    m_pCall->setSOAPVersion(SOAP_VER_1_1);
    m_pCall->setOperation("storeMessage", "url:TestApp");
    includeSecure();
    applyUserPreferences();
    char cPrefixAndParamName0[13];
    sprintf( cPrefixAndParamName0, "%s:in0",
m_pCall->getNamespacePrefix("url:TestApp"));
    m_pCall->addParameter((void*)&Value0, cPrefixAndParamName0,
XSD_BASE64BINARY);
    if (AXIS_SUCCESS == m_pCall->invoke())
    {
        if(AXIS_SUCCESS == m_pCall->checkMessage("storeMessageResponse",
"url:TestApp"))
        {
            xsd__boolean * pReturn =
m_pCall->getElementAsBoolean("storeMessageReturn", 0);
            if(pReturn)
                Ret = *pReturn;
        }
    }
    m_pCall->unInitialize();
    return Ret;
    }
    catch(AxisException& e)
    {
        int iExceptionCode = e.getExceptionCode();

        if(AXISC_NODE_VALUE_MISMATCH_EXCEPTION != iExceptionCode)
        {
            m_pCall->unInitialize();
            throw;
        }

        ISoapFault* pSoapFault = (ISoapFault*)

m_pCall->checkFault("Fault","
http://127.0.0.1:8080/TestApp/services/TestAppService";
);

        if(pSoapFault)
        {
                const char *detail = pSoapFault->getSimpleFaultDetail();
                bool deleteDetail=false;

                if (NULL==detail || 0==strlen(detail))
                {
                    detail=m_pCall->getFaultAsXMLString();
                    if (NULL==detail)
                    {
                        detail="";
                    }
                    else
                    {
                        deleteDetail=true;
                    }
                }

                OtherFaultException ofe(pSoapFault->getFaultcode(),
                    pSoapFault->getFaultstring(),
pSoapFault->getFaultactor(),
                    detail, iExceptionCode);

                if (deleteDetail && NULL!=detail)
                {
                     delete [] const_cast<char*>(detail);  //
!!!!!!!!!!!!!! CRASHES HERE !!!!!!!!!!!!!!!!!!!!
                }

                m_pCall->unInitialize();
                delete pSoapFault;
                throw ofe;
        }
        else
        {
            m_pCall->unInitialize();
            delete pSoapFault;
            throw;
        }
    }
}

Reply via email to