Empty TAG in response.

2004-08-26
2013-04-25
  • Cleverton Hentz

    Cleverton Hentz - 2004-08-26

    Hi,
    I'm using Dxmlrpc in a new project.
    When I receive response for XML-RPC call some params be empty. When this occur the struct in IRpcResult It do not contain a null parameter.

    I'm show a exemple of this:
    ...
    <member>
      <name>CONTA_AGENTE</name>
      <value><string/></value>
    </member>
    ...

    if i try access like this exemple, "Obj.KeyExists('CONTA_AGENTE')", return false.

    Any help will be welcome.
    Cleverton Hentz

     
    • Marand

      Marand - 2004-09-03

      Similar problem here. Having a struct member in a result can cause its name to be mistakenly returned as the name of one of its items. Actual example:
      <?xml version="1.0" encoding="iso-8859-1"?>
        <methodResponse>
          <params>
            <param>
              <value>
                <struct>
                  <member><name>feedid</name><value><string>34092</string></value></member>
                  <member><name>sitename</name><value><string>Riff news</string></value></member>
                  <member><name>PollStatus</name>
                    <value>
                      <array>
                        <data>
                          <value>
                            <struct>
                              <member><name>date_polled</name><value><string>2004-09-03 11:07:35</string></value></member>
                              <member><name>status</name><value><string>Ok</string></value></member>
                              <member><name>parse_error</name><value><string></string></value></member>
                              <member><name>parse_line</name><value><string></string></value></member>
                              <member><name>fetch_error</name><value><string></string></value></member>
                              <member><name>response_time</name><value><string>0.918263</string></value></member>
                              <member><name>redirection</name><value><string></string></value></member>
                              <member><name>http_response</name><value><string>200</string></value></member>
                              <member><name>encoding</name><value><string>iso-8859-1</string></value></member>
                              </struct>
                            </value>
                          <value>
      [...]
      res.KeyList [0] = 'feedid
      res.KeyList [1] = 'sitename'
      ... this is correct, but:
      res.KeyList [2] = 'redirection'
      ... this is NOT correct, AIUI XML-RPC.

       
    • Marand

      Marand - 2004-09-03

      In version 2.0, a fix exists, but is not activated by default. Just use:

      var cal    : TRpcCaller ;

      cal := TRpcCaller.Create ;
      cal.FixEmptyStrings := True ;

      FixEmptyStrings defaults to False:
      XmlRpcClient / TRpcCaller.Create:
      inherited Create ; --> TRpcClientParser.Create
      additional code doesn't change this field

      TRpcClientParser.Create:
        inherited Create; --> TObject.Create
      and strictly nothing more

      So the property defaults to the TObject default: 0 value, meaning False by default.

       
    • Cleverton Hentz

      Cleverton Hentz - 2004-09-06

      For your case yes, but for my no.
      In my case tag is empty, i.e. <String/> .I'm implemente one new case in function FixEmptyString() for situation with emtpy tags. This code was add to end of function.

      //By Hentz- 26/08/2004 - Exclude TAG from struct when XML TAG "<string/>" appears.
        Result := StringReplace(Result,'<string/>',
            '<string>[NULL]</string>', [rfReplaceAll, rfIgnoreCase]);

       
    • mahadewi

      mahadewi - 2006-09-19

      how i can send many parameters as record data type ?

       

Log in to post a comment.