Search code examples
c#web-serviceswcfcomhta

Consuming WCF service from HTA via COM Wrapper


looking for assistance as to how to consume a WCF service library from an HTA file.

Basic summary - there are a whole suite of process enhancement tools that integrate with a booking system in the form of HTA files.

We needed to have the system communicate with a web service using X509 certificates as the security signature.

Therefore we have built a WCF class library that uses a service reference to the web services. After some tweaking and fine tuning of the app.config - we have got this communicating with the web service perfectly (using a windows form test app)

So to enable communications through to the HTA files we've written a COM wrapper, that exposes the WCF library functions.

So far so good - however when we try and run the HTA we get the infamous

'Could not find endpoint element with name ........'

I have tried all sorts of things to try and resolve this: Making sure all dll files and hta files are in the same directory. I have copied the app.config from the WCF dll and added it's contents to an app.config file on COM wrapper. I've even tried adding an config file to the MSHTA.exe file in the System32 directory!!

So far nothing has helped and allowed the HTA file to get the WCF service call to work.

Any advice much appreciated. Cheers Darren


Solution

  • Finally I have got it working!

    Thanks to @Noseratio who's suggestions forced me to go over everything again!

    It was the mshta.exe file that needed it's own app.config file. I had already tried copying the app.config file from the WCF DLL, but made a schoolboy error when naming it as mshta.config rather than mshta.exe.config.

    Once named correctly the HTA file was able to communicated with the web service through the com wrapper and WCF DLL.

    Cheers Darren