r/DatabaseHelp • u/L_darkly • Jul 19 '17
Connect to Database using XML sockets
So I don't know if this qualifies for this site, but I am trying to figure out how to use sockets and XML to send information to a ClearQuest database. I have never dealt with sockets before, and although I'm reading up on this, I'm still not quite getting it. How exactly is my program utilizing sockets going to communicate with the database's sockets? Thanks in advance. I have never done anything like this before.
1
Upvotes
View all comments
Show parent comment
2
u/xiongchiamiov Jul 22 '17
Because those are common languages that people write scripts like this in.
It appears that ClearQuest only understands XML as an input to its API, yes.
Ah, let me see if I can explain this better.
To talk to CQ/XML, you need to send it XML, and it will respond (presumably also with XML), and then you send more XML, and so on. You could open up a connection with
telnetand type it all out if you really wanted to, but that a) would suck and b) isn't going to be very useful because it means anything you want to do requires you being at the computer to type it up. So instead you're going to use Python (or whatever) to create the XML you send and parse the XML you receive.There are several layers of technology in play here, as is usually the case:
If you choose to do this in Python, you'll need to get comfortable with how to establish, write to, and read from a socket connection. And then next you'll need to know how to convert your request into xml and convert the response into xml using the xml library.
To be honest, this is a bit of an advanced API (a more common example would use JSON over HTTP, which makes a number of things easier, and probably has a wrapper library already written, which makes it even more so). This is not a task I'd give to someone as new to network programming as you are. I do a lot of this sort of thing, and have for the past ten years, and it sounds like a pain in the ass that I'd run into a number of roadblocks and headaches while trying to figure out. I would explain to your manager that this is something that you have no experience with and it will probably take you quite some time. If they move it off onto someone else, cool, but if they still want you to do it, then buckle up, don't get discouraged, and you'll have a really valuable learning experience.