Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Singleton instance of web service DLL object (VB6)

Status
Not open for further replies.

rowanb

Programmer
Jun 27, 2005
6
AU
I have a web service (written in VB6 compiled to a DLL) , and I need to use a single instance of a third party DLL in the code - ie create the object and all 'hits' on the web service use the same instance of the object rather than creating new instances.
Do you have any ideas of what architecture I could use to achieve this, ie where do I need to create and destroy the object? (in our DLL? somewhere else?). I set up the web service using the SOAP Toolkit v3. The web service is running on NT Server 4.0 SP6 and IIS 4.0.


 
The only way to absolutely ensure that all clients are using the same server object is to make it an activex exe, with its instancing property set to multiuse.

This property works as follows:

DLL Can't be singleuse. One instance per process; references to the instance reference the one in their own process.

EXE SingleUse Each reference to the class has its own instance, regardless of whether the references are in the same process or not.

EXE MultiUse All references to the class share the same instance.

It looks like you want the last one. That said, you're working with a third party dll. So, create an ActiveX Exe class that instantiates the dll class and returns the resulting object via a method. As part of your service, start this exe. This should wrap the dll functionality in code that delivers the usage functionality that you require.

HTH

Bob
 
Thanks Bob.

SOAP Toolkit requires a DLL, so we've created a DLL that wraps the functionality of the ActiveX EXE (which uses the third party DLL).

Our wrapper DLL instantiates the EXE object in the Class_initialise and destroys it in the Class_terminate method, and has wrapper methods for the three public methods that our web service DLL has.

In turn, our DLL instantiates the third party DLL in the Class_Initialise and destroys it in the class_Terminate method.

The wrapper DLL doesn't seem to be working. We get an 'unspecified client error' when trying to connect to it (via SOAP).

Is this completely the wrong way of going about it?? (all seems a bit convoluted!)

Thanks
Rowan
 
> In turn, our DLL instantiates the third party DLL in the Class_Initialise and destroys it in the class_Terminate method.

i meant 'our EXE' not our dll
 
My thinking is rather to create a dll that wraps the functionality of soap and the third party dll. Then, wrap the lot in the exe.

So, here are the characters in the play:

1. An activex multiuse exe.
2. Your web service dll.
3. The soap toolkit.
4. The other thirdparty dll.

Now. 2 uses 3 and 4 as appropriate to implement your business rules. Wrap 2 in 1. Have 1 create an instance of 2, and expose its functionality to the outside world by exposing methods that call methods on 2.

So, 1 wraps 2 which wraps 3 and 4.

That seems like the way to do it, not the other way around. This should restrict your dll, and consequently the others, to a single instance. Although I'm not quite sure what you mean when you say soap "requires" a dll.

HTH

Bob
 
I dont think we can wrap the SOAP functionality up like that - the SOAP toolkit is an app that takes a DLL (must be DLL and not EXE) and generates the ASP handler and WSDL/WSML files to make it a web service. Its SOAP (the Soap server?) that handles instantiating the web service DLL (i think).

So the trick is , being able to use the EXE as the object in the web service.. not sure how to do that?

 
Ok. I don't know anything about the SOAP toolkit. First, is it a DLL itself? I was assuming that it was. If it is, how does it allow clients of itself to access the web service? Does it return a reference to the service to the client app?

Bob
 
It's just a tool that allows you to select a DLL you want to run as a web service, which creates an ASP handler page and the appropriate WSDL and WSML files. I think it is this handler page that handles instantiation of the Web service DLL - it uses a SoapServer object (to handle soap connections from the client) which is given a WSDL file which contains details of the classes of the web service DLL and parameters etc.
 
And, this tool that allows you to select a dll, is it itself a dll?

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top