Sending XML data between two VB Applications
Posted on 2004-10-01
I have a problem, and there seem to be a large variety of solutions :) Better than having no solutions i guess, but what i am after is suggestions and reasons of the best method to perform what i need (and possibly some sort of link to a tutorial or key code example).
I have an applicaiton (lets call it APP1) that sits listening on a socket. It receives XML 'actions' via the web.
I have a second application (APP2) that knows how to perform XML actions and return an XML response.
APP1 gets the action from the web, gives it to APP2, APP2 does its thing and returns it back to APP1 which then sends the XML response back down the socket.
What I need is some way to send the XML from app1 to the app2 (and back again in reply) which will:
a) not require a socket to be opened (other than the one already open by APP1 of course)
b) allow APP1 to completly stop APP2 so that it is no longer in memory (this way the exe can be overwritten) - will this be a problem if APP2 is an activeX exe?
c) allow large XML docs to be sent from APP1 to APP2 (possibly up to 1MB - not sure if this will be a problem with DDE or COPY_DATA)
Just to clarify, I want APP2 to be seperate from APP1 because I want to be able to remotely upgrade the collective application. The idea is to have APP1 as thin in funcitonality as possible, reducing its need to be upgraded. APP2 (or any dlls/files/etc that it uses) can be upgraded and APP1 can still send a response regarding the success/failure of the upgrade. When APP1 is upgraded (it needs the exe to be replaced) the socket will be closed and a response will not be possible, so id like this to happen as little as is possible.
I have researched a bit on:
* APP2 as a ActiveX Exe - I am unsure if I will be able to kill the ActiveX exe, replace the actual exe file and then restart it again whilst APP1 is running
* DDE - My primary concern is that it seems a little outdated, also im unsure about send limits (maybe need to transfer a uuEncoded binary which could be pretty big) and do i need a text box or somehting? I would rather not rely on GUI controls as this app is intended to run in the background.
* Using COPY_DATA - unsure on limitations this may have.
I know that there are a variety of other methods, which im open to, but i prefer that the solution is primarily in VB and that it is not going to be a huge task to implement as the schedule is very tight :( .... i guess they always are.
Dont worry about going into too much detail with the example if you provide one - just enough to get me started, im more concerned about the apporach, i can always offer more points on another quesiton if I have any issues with the code itself.
Thanks soo much, sorry for the long post, it's in an effort to reduce questions and save time for everyone.