Uploaded image for project: 'Axis-C++'
  1. Axis-C++
  2. AXISCPP-465

Bug in SoapSerializer::addOutputParam

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.5 Final
    • Serialization
    • None

    Description

      hi Adrian and All,

      (Adrian this is related to a change which you have done recently)

      There is a problem in SoapSerializer::addOutputParam method. But this is actualy not a bug in this method even though I say so, that is because the following scenario.

      This is the current method...
      int SoapSerializer::addOutputParam(const AxisChar* pchName, void* pValue,
      XSDTYPE type)
      {
      ...
      ....
      case XSD_INT:
      case XSD_BOOLEAN:
      pParam->m_Value.nValue = (int*)(pValue);
      break;

      Now the generated server side wrapper has the following code.

      int CalculatorWrapper::add(void* pMsg)
      {
      ...
      .....
      try
      {
      xsd__int ret = pWs->add(v0,v1);
      return pIWSSZ->addOutputParam("addReturn", (void*)&ret, XSD_INT); //This is wrong because ret is a
      //local variable and we pass the
      //address of this to the method
      }
      catch(...){
      }
      }

      My Suggestion:
      ==============

      There are two ways to tacke this problem.

      method 1)
      Change the SoapSerializer::addOutputParam() method as following.

      ...
      .....
      case XSD_INT:
      case XSD_BOOLEAN:
      //---added by roshan--

      { pParam->m_Value.nValue = new int(); *pParam->m_Value.nValue = *(int*)(pValue); //----end added by roshan--- }

      break;

      method 2)
      Change the wrapper generation to some thing like following:

      int CalculatorWrapper::add(void* pMsg)
      {
      ...
      .....
      try
      {
      xsd__int ret = pWs->add(v0,v1);
      xsd_int* ret2 = new xsd_int(sizeof(ret));
      *ret2 = ret;

      return pIWSSZ->addOutputParam("addReturn", (void*)ret2, XSD_INT);

      I prefer solution method2 because it doesn't look nice and doesn't look more readable to send a local variables address to a another method, any ideas please...

      Attachments

        Issue Links

          Activity

            People

              samisa Don Samisa Abeysinghe
              roshan W.M. Roshan Weerasuriya
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: