Menu

Base64 parameters...

Help
2003-04-22
2003-04-23
  • Erik Salter

    Erik Salter - 2003-04-22

    Chris,

    After looking at your Base64 client/server, I'm trying to write something similar, and I'm running into problems. Basically, what's happening is that my client will create the XmlRpcValue correctly (as type Base64), but the Server won't receive it correctly. When it arrives, the param value is of type Array, so the indicated line throws an exception. I'm fairly new to XML-RPC, so any ideas? Thanks!

    Client:

    //Copying a structure into a buffer
    XmlRpcValue params( (void *)&someStruct, sizeof( SomeStruct ) );

    c.execute("Test64", params, result );

    Server

    -->XmlRpcValue::BinaryData& data = params

    for ( int i = 0; i < sizeof( SomeStruct ); i++ )
    {
    szInputBuffer[ i ] = data[ i ];
    }

     
    • Chris Morley

      Chris Morley - 2003-04-23

      The 2nd argument to XmlRpcClient::execute is supposed to be an array of parameters to the remote method.

      Try this instead:
      XmlRpcValue data((void*)&someStruct, sizeof(someStruct));

      XmlRpcValue params;   // Array of parameters
      params[0] = data;         // First parameter

      c.execute("Test64", params, result );

      The XmlRpcClient::execute method should be failing since you are not passing an array - I'll have to look at that.

       
      • Erik Salter

        Erik Salter - 2003-04-23

        Thanks, Chris!  I'd be interested to see why XmlRpcClient::execute didn't fail...

         
    • Chris Morley

      Chris Morley - 2003-04-23

      Sorry, I was a bit off ...

      In the client code, if you don't pass in an array,
      the code tries to be smart and wraps it in an array for you.

      Of course that means that the server side code should expect an array even though the client is apparently passing something else.

      Maybe it would be better to just have the client fail in this situation, but in this case your original client code should work OK, as long as you modify your server code to expect an array:

      XmlRpcValue::BinaryData& data = params[0];

      Chris

       

Log in to post a comment.