Fog Creek Software
Discussion Board




DCOM and VB

We have an older app written in VB 6.0 (o.k. so not THAT old).  The presentation and business logic run on one server and the data on another.  I have a piece of code that needs to run on the data server (to fire off a DTS package), but needs to be called from the first server.

Let me preface this by saying I am sure there is a better way of doing this in .NET (web services?), but this has to talk to VB 6.0 code.  My first thought is DCOM.  However, dcomcnfg will only show .exe servers.  I'm not sure how to do that in VB.  (And yes, I have googled, but I'm asking you guys anyways!).

The other thought is that I am heading down the completely wrong path (as I have a tendancy to do) and need someone to set me straight.

Any help would be really appreciated.

shiggins
Tuesday, February 17, 2004

On the server side you could write a VB or VBScript page that listens for an XML document.

The XML document will either accomodate authentication/authorization through a http authentication+HTTPS encryption or through some implementation you are mroe familiar with.

The XML document will pass along any DTS invocation information.

On the server side the document is parsed, and the DTS is invoked.

You can also do DCOM, however, you'll have to configure DCOM on both client and server and ensure your firewall/tunnel (between your invocation client and your data server) is configured to handle such traffic.

Li-fan Chen
Tuesday, February 17, 2004

Assuming by DTS packages you mean they are hosted in COM+, you could create a proxy to the package (right click package, choose export, proxy) and install that on the other server.

Billy Boy
Tuesday, February 17, 2004

To send https requests to active web scripts manually, you'll need to reference the "MS WebBrowser Control" from within Visual Basic 6.0. The object model will accomodate the 2 steps:

1. answer http access challenge
2. post xml doc

Li-fan Chen
Tuesday, February 17, 2004

Li-fan,

Thanks so much for your help.  Are you recommending that I use SOAP for the listener part? 

This is something that other clients may/may not utilize so I'm thinking of making it a little more robust than I originally thought so we can use it for all types of DTS packages or similar types of communications between the two servers.

shiggins
Tuesday, February 17, 2004

SOAP maybe over kill, just construct a string consisting of a fairly proper xml template, and replace the key values as you go

str = ""
str = str & "<xml>"
str = str & "  <sendmail>"
str = str & "    <from>###FROM_ADDR###</from> "
str = str & "    <to>###TO_ADDR###</to> "
str = str & "    <body>###MSG_BODY###</body> "
str = str & "</sendmail>"
str = str & "</xml>"

and when you invoke it do

call rmail("billg@microsoft.com","bush@whitehouse.gov","hi",str)

' send remote email
sub rmail(strfrom,strto,strbody, strtemplate)

  strtemplate = replace(strtemplate,"###FROM_ADDR###",strfrom)
  strtemplate = replace(strtemplate,"###TO_ADDR###",strto)
  strtemplate = replace(strtemplate,"###MSG_BODY###",strbody)

  call https(cstrURL, cstrUSER, cstrPASS, strtemplate)
end sub

just encapsulate the component call into a function called https and set 3 constants (the url, the username, and the password).. and you should be ducky.

Li-fan Chen
Tuesday, February 17, 2004

so that's the invocation part, for the listener part just have an asp script listen to a url on the data server side.. have a tightened iis running. the asp script should just parse the request and make a dts call (using the proper permission)

Li-fan Chen
Tuesday, February 17, 2004

Ahhh...I think I've got it now.  Great solution by the way.  I actually thought to myself "Is there anyway I can use XML to solve this problem?".  The solution just didn't come to me.  I guess that doesn't make me "smart" OR "getting things done".  Damn! :)

shiggins
Tuesday, February 17, 2004

By the way the way I structure the post you can easily replace https function to use a different component.

There are nice shareware components, and there's Microsoft Web Browser Control, also most people prefer MSXML2.XMLHTTP (version 3 or greater, you may have to upgrade the component).

If you want to avoid the other components and stick with XMLHTTP, try this article for the triggering code example:

http://resellers.tucows.com/opensrs/documentation/XML_HTTPSPost.pdf

Li-fan Chen
Tuesday, February 17, 2004

I know lots about DCOM and VB, if you still want to pursue this. Billy Boy's post is quite correct, but I can help with all the how-to details if you need them (as, I'm sure, can Billy Boy).

Another alternative to the SOAP solution is to use sockets directly. This is quite straightforward and easy to achieve in VB. Tutorials and samples can be found on www.vbip.com

Justin
Wednesday, February 18, 2004

Thanks Justin and Billy Boy.  However, a DTS package stands for Data Transformation Services.  DTS provides the functionality to import, export, transform data etc. between MS SQL Server and any OLE DB, ODBC, or text file format.  It's internal to MS SQL Server.

So basically I have a COM object that exposes the DTS.Package library so that I can execute an pre-existing DTS package that resides in MS SQL Server.  So, no I don't believe it is a COM+ app.

shiggins
Wednesday, February 18, 2004

shiggins,

>> However, dcomcnfg will only show .exe servers.

So write an EXE server. ;-)

Seriously, writing an ActiveX EXE in VB 6 is trivial.

The members of http://peach.ease.lsoft.com/scripts/wa.exe?A0=visbas-l would be more than happy to help you out.

Seeya

 
Wednesday, February 18, 2004

Shiggins, I know what DTS is.

My response was about how to kickoff your COM object from a remote server, as per the request in your original post.

Justin
Thursday, February 19, 2004

Thanks for the links Justin.  My DTS explanation was actually directed toward BillyBoy.

>Assuming by DTS packages you mean they are hosted in COM+...

DTS packages (AFAIK) are not hosted in COM+.  Please correct me if I am wrong.

shiggins
Thursday, February 19, 2004

No DTS packages are not hosted in COM+.  However COM+ is also referred to as the DTC (distrib transaction coordinator) and also uses the packages terminology.  Since you had DCOM in the title, I jumped to the com object conclusion...

Billy Boy
Thursday, February 19, 2004

Gotcha.  Thanks. 

shiggins
Thursday, February 19, 2004

*  Recent Topics

*  Fog Creek Home