• We had to restore from a backup today after a failed software update. Backup was from 0000 EDT and restored it at 0800 EDT so we lost about 8hrs. Today is 07/20/2024. More info here.

Communicate and transfer with XML & HTTPS

Sessa

New Member
Joined
Dec 12, 2018
Messages
4
Reaction score
0
Credits
17
Hi guys,

Currently i search for a solution to establish a connection between my server and an inventory.
I need to establish the connection via https and need to use XML for the transfer from the data itself.

Example:
I need to retrieve some data / information from a database, e.g. B. a version number.

So I call a specific URL.

The XML structure includes the authentication. So the database asked "who are you?" And with the data in the XML, the request can be authenticated. Thus the connection stands (over https) and the transfer / exchange of the data can take place.
So I use https as a way of transferring and using XML to legitimize and share data.

The communication need to be with https so the data can not intercepts.
Im absolutly new in this topic so i dont know how to do this. Is curl here an way of solution?

Is that possible, as I imagine?
 


With curl you can easily send an https POST request and it gets automatic encrypted when using "https" in the targeted URL. Simply enter "curl -X POST [-f <xmlfile>] <URL>" to send a file or string. For the authentication you may be have to write a little shell / awk script to extract them from the xml file and add as parameter to curl.

If you work with other languages like python, javascript ... there are usually built-in options and no need to invoke a shell but if you just have a shell script than curl is the way to go.
 
Many Thanks!
What does the XML file look like?

Is there a standard body that I can easily adapt?
For example, at the moment I just want to build a simple connection and get a certain attribute.
How it works is as follows:
I send an XML request to the server via https. In this XML is my login in it (in plain text for testing purposes). Then I get back a session ID from the server and then I want to access a particular attribute and get that value. I would like to write this eg on the client in a file). Let's be as simple as possible. First of all, I want to make sure that the connection is established ... :)
 
Without some basic knowledge you will get a hard time with your project.

There are plenty of resources which explain the structure of XML. E.g.
https://en.wikipedia.org/wiki/XML
https://www.w3schools.com/xml/default.asp
https://www.tutorialspoint.com/xml/

And here's even a complete toolkit for the bash with documentation:
http://www.xmlsoft.org/

They are much more detailed than one could explain it on a web forum. Also it depends on the API (the commands which are available at the server to interact with) how to exactly implement your request. May be a little background with REST-APIs will give you a better overview:
https://restapitutorial.com/

Also it's recommendable to read man pages about the programs you want to use (e.g. enter in a shell "man curl" for the curl manual).

If you carefully read those sources, I'm pretty sure you will be able to establish a connection and forge an request.
 

Members online


Top