#218 XMLRPC fault response is wrong

open
None
5
2007-01-24
2006-02-20
Anonymous
No

If I understand correctly, the code below should
produce a proper RPC method fault response, assuming
xml_response is of class XMLRPC:

xml_response.response(true);
long int fault_code = 4;
xml_response.addMember("faultCode", fault_code);
xml_response.addMember("faultString", "test 123");
xml_response.send("http://rpcserver/rpc);

However, it fails to produce the expected result,
apparently because there is a bug in begStruct, which
reverses the struct and value, and because there is a
bug in send, which fails to terminate the fault tag.

Below is some annotated code, which does produce the
expected result:

void XMLRPC::begStruct(void)
{
if(structFlag)
return;

structFlag = true;

if(!fault && !array)
strBuf << "<param>";

strBuf << "<struct><value>" << endl;
# |---------------------^
# should read:
strBuf << "<value><struct>" << endl;
}

bool XMLRPC::send(const char *resource)
{
<---snip--->
if(!fault)
strBuf << "</params>" << endl;
# should read:
if(!fault)
strBuf << "</params>" << endl;
else
strBuf << "</fault>" << endl;

<---snip--->

Discussion

  • David Sugar

    David Sugar - 2007-01-24
    • assigned_to: nobody --> dyfet
    • status: open --> open-postponed
     
  • David Sugar

    David Sugar - 2007-01-24

    Logged In: YES
    user_id=217
    Originator: NO

    I am thinking of replacing some or all of the xmlrpc implimentation with the one we use in Bayonne....

     

Log in to post a comment.