Create an XML Request in “c” for server communication.

XML request in server communication

We use XML to carry data between server and client. XML simplifies the data transportation and carry data in plain text format which is readable by both human and machine. It is the biggest reason to provide a software and hardware independent way of transporting, storing, and sharing data. This feature of XML gives the reason to send the request in XML format in server communication.

In case of POS (point of sale), we generally send the Request in XML, JSON or ISO bitmap format to communicate with payment gateway or middle-ware server. A lot of API available in “C” to create XML or bitmap request for server communication.
In this article, I will describe a simple project to create a XML request for server communication.

Let’s talk an  example

Consider a scenario where we want to send some user credential and a message to the server in XML format. In this situation first, we need to create an XML tag and feel these tag with desired data.
Note:  XML language has no predefined tag. It provides flexibility to give any name to your XML tag.

 

If you want to learn more about the c language, here 10 Free days (up to 200 minutes) C video course for you.

Your free trial is waiting

 

Below API create an XML tag and set the desired data. If there is no source data then tag automatically fill by “0”.You can modify these API as per your requirements. When finally tag has created then simply copy these tag to the request buffer.

API To Create the XML Tag

Program to create an XML request for server communication

OutPut:

server communication



4 comments

Leave a Reply