[Gambas-user] Bug fixed XMLRPC server

Ron ron at ...1740...
Wed Nov 18 22:24:14 CET 2009


Benoit,

I have found a bug in the file 
gambas/2.0/gb.xml/src/rpc/gb.xml.rpc/RpcServer.class

I had to comment out one line to get more than one parameter to work.

This line '  IF Xml.Node.Type = XmlReaderNodeType.EndElement THEN BREAK 
in the code snippet below
is responsable for a premature break of parseing the xml data file.

With this line, after looping once it breaks out there always and the 
rest of the <param> fields (if any) are not processed.
---
PUBLIC SUB miniSrv_ProcessData(Data AS String)

  DIM Xml AS NEW XmlReader
  DIM Bucle AS Integer
  DIM hPar AS NEW Variant[]
  DIM hP AS RpcAtom
  DIM Counter AS Integer

  Xml = NEW XmlReader
  Xml.FromString(Data)

  tools.Find(Xml, "methodCall")
  TRY Xml.Read()
  IF NOT tools.Find(Xml, "params") THEN
    miniSrv.SetReply(tools.FaultReply(4, "params field not found"))
    CurrIndex = - 1
    RETURN
  END IF

  TRY Xml.Read()

  DO WHILE TRUE

'  IF Xml.Node.Type = XmlReaderNodeType.EndElement THEN BREAK 
<-----------------------
    IF NOT Tools.Find(Xml, "param") THEN BREAK
    hP = Tools.GetParam(Xml)
    IF hP = NULL THEN
      miniSrv.SetReply(tools.FaultReply(5, "malformed parameters"))
      CurrIndex = - 1
      RETURN
    END IF

    hPar.Add(hP.Data)
---

Have tested it without, with one and with more than one (3) parameters 
of type boolean, string and integer and it seems to works ok.

Using Gambas 2.17, but I think the Gambas 3 component code is the same.

Kind regards,
Ron_2nd.




More information about the User mailing list