lvphuong - 2005-10-30

I try to write a XMLRPC Server, my code is following :

class search : public XmlRpcServerMethod
{
public:
  search(XmlRpcServer* s) : XmlRpcServerMethod("search", s) {}

  void execute(XmlRpcValue& params, XmlRpcValue& result)
  {

    // Get parameters

       std::string strTrans_Id = std::string(params[0]);
    std::cerr <<"strTrans_Id : " + strTrans_Id + "\n";
    XmlRpcValue aSearch_data = params[1];
   

    int nSearchType = m_nSearchType;
    int nTotalResult = m_nTotalResult;
    int  nFirstPassPercent = m_nFirstPassPercent;
    double  dThreshold = m_dThreshold;

    if (aSearch_data.hasMember("max_number_of_results"))
        nTotalResult = int(aSearch_data["max_number_of_results"]);

    if (aSearch_data.hasMember("search_pass_type"))
        nSearchType = int(aSearch_data["search_pass_type"]);
   
    if (aSearch_data.hasMember("second_pass_size"))
        nFirstPassPercent = int(aSearch_data["second_pass_size"]);

    if (aSearch_data.hasMember("search_result_threshold"))
        dThreshold = double(aSearch_data["search_result_threshold"]);

    if (!aSearch_data.hasMember("input_image"))
        throw XmlRpcException("INVALID_PARAMETER",2000);

    CResultListItem *pResults = new CResultListItem[m_lTotalTemplate];
    int iResultCount = i + 1;

    // ...
    // Process a business logic
    // ...
    // "*pResults"  is array of values needed return
    // "iResultCount" is count of elements of pResults

    // Return
    XmlRpcValue aResult;
    aResult.setSize(iResultCount);

    for(i=0;i<iResultCount;i++)
    {
       
        XmlRpcValue xElement;
       
        xElement["data_source"] = pResults[i].data_source;
        xElement["data_source_nbr"] = pResults[i].data_source_nbr;
        xElement["a_id"] = pResults[i].aID;
        xElement["i_id"] = pResults[i].iID;
        xElement["score"] = pResults[i].fScore;
       
        aResult[i] = xElement;
    }
   
    XmlRpcValue xReturn;
   
    xReturn["canonical_image"] = "Test";
    xReturn["results"] = aResult;
    result = xReturn;

   
  }
} search(&s);

...

When I use a .NET version of XMLRPC Client (Nwc), in return values (in Hashtable variables) contain two element : "canonical_image" (correct) and "score" (not "results" as I desired). I try to change "results" element in "search" class by std::string (value "test", for example), it return correct ("results" element).
I don't know What it happend.
Pls help me
Thank in advance
Phuong LV