Official Content

When used with the XmlWriter extended data type, it writes an XML in the http response´s body. When used with the XmlReader extended data type, it is used in any object to have the information returned by a request read as XML.




     Is XmlReader or XmlWriter extended data type.


Extended Data Types: XmlWriter, XmlReader
Generators: .NET, .NET Framework, Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)


Client program:

// &Client is HttpClient type

// &Writer is XMLWriter type

// &Reader is XMLReader type

// Define the host and the the port where make the request

   & = "localhost"

   &client.port = 88


// Adding the XML to request



&Writer.WriteElement("a", &A)

&Writer.WriteElement("b", &B)



// Make POST to the WebProc

&Client.Execute("POST", "/servlet/awebproc")

// Read the XML than return and loaded in the internal variables




&a = Val(&Reader.Value)


&b = Val(&Reader.Value)


Program server (WebProc):

// &Request is HttpRequest type // &Response is HttpResponse type // &Writer is XMLWriter type // &Reader is XMLReader type

// Read the XML's parameters

&Reader.OpenRequest(&Request) &Reader.Read() &Reader.Read() &a = Val(&Reader.Value) &    &b = Val(&Reader.Value) &Reader.Close()

// Add 1 to each value

&a = &a + 1 &b = &b + 1

// Write parameters into response

&Writer.OpenResponse(&Response) &Writer.WriteStartElement("Parameters") &Writer.WriteElement("a", &A) &Writer.WriteElement("b", &B) &Writer.WriteEndElement() &Writer.Close()

See Also

ExcelDocument WordDocument XmlWriter XmlReader

Last update: November 2023 | © GeneXus. All rights reserved. GeneXus Powered by Globant