Thanks DRichards, I guess I didn't realise I had missed that part out. The code now compiles ok, cheers.
Main Topics
Browse All TopicsI need to call an existing COM+ component into an ATL Web Service. The Generated .IDL file by the OLE/COM Object Viewer of the com+ component is as below.The component was developed in Visual C++ 6
--------------------------
// Generated .IDL file (by the OLE/COM Object Viewer)
//
// typelib filename: tmc.dll
[
uuid(57CA9202-5167-402F-B3
version(1.0),
helpstring("tmc 1.0 Type Library")
]
library TMCLib
{
// TLib : // TLib : OLE Automation : {00020430-0000-0000-C000-0
importlib("stdole2.tlb");
// Forward declare all types defined in this typelib
interface ITMC_Message;
[
uuid(3EF4595C-C6C0-4CD1-86
helpstring("TMC_Message Class")
]
coclass TMC_Message {
[default] interface ITMC_Message;
};
[
odl,
uuid(9D911DE1-0993-4B5E-B2
helpstring("ITMC_Message Interface"),
dual,
oleautomation
]
interface ITMC_Message : IDispatch {
[id(0x00000001), helpstring("method m_TMCMsgReceive")]
HRESULT m_TMCMsgReceive(
[in, out] BSTR* pbstrTerminalSerialNumberP
[in, out] long* plEnterpriseIDParam,
[in, out] long* plOperatorIDParam,
[in, out] long* plStoreIDParam,
[in, out] long* plStoreTerminalIDParam,
[in, out] long* plTMCMsgSequenceNumberPara
[in, out] long* plTMCOperatorSessionIDPara
[in, out] long* plTMCMsgTypeParam,
[in, out] VARIANT_BOOL* pfMsgCompressionFlagParam,
[in, out] BSTR* pbstrTerminalVersion,
[in, out] BSTR* pbstrMsgDataBufferParam,
[in, out] BSTR* pbstrMsgReturnBufferParam,
[in, out] long* plErrorReturnCodeParam);
};
};
--------------------------
In Visual C++ .Net I have created my ATL Web Service added a reference to COM object and wrote the code below to import the COM+ component into the web service.
--------------------------
// TMCSOAWebService.h : Defines the ATL Server request handler class
//
#pragma once
#include <iostream>
#import "C:\Program Files\TMC\tmc.dll" no_namespace
namespace TMCSOAWebServiceService
{
// all struct, enum, and typedefs for your webservice should go inside the namespace
// ITMCSOAWebServiceService - web service interface declaration
//
[
uuid("61768E03-B414-4372-A
object
]
__interface ITMCSOAWebServiceService
{
// HelloWorld is a sample ATL Server web service method. It shows how to
// declare a web service method and its in-parameters and out-parameters
//[id(1)] HRESULT HelloWorld([in] BSTR bstrInput, [out, retval] BSTR *bstrOutput);
[id(1)] HRESULT TMCMsgReceive(
[in, out] BSTR* pbstrTerminalSerialNumberP
[in, out] long* plEnterpriseIDParam,
[in, out] long* plOperatorIDParam,
[in, out] long* plStoreIDParam,
[in, out] long* plStoreTerminalIDParam,
[in, out] long* plTMCMsgSequenceNumberPara
[in, out] long* plTMCOperatorSessionIDPara
[in, out] long* plTMCMsgTypeParam,
[in, out] VARIANT_BOOL* pfMsgCompressionFlagParam,
[in, out] BSTR* pbstrTerminalVersion,
[in, out] BSTR* pbstrMsgDataBufferParam,
[in, out] BSTR* pbstrMsgReturnBufferParam,
[in, out] long* plErrorReturnCodeParam);
// TODO: Add additional web service methods here
};
// TMCSOAWebServiceService - web service implementation
//
[
request_handler(name="Defa
soap_handler(
name="TMCSOAWebServiceServ
namespace="urn:TMCSOAWebSe
protocol="soap"
)
]
class CTMCSOAWebServiceService :
public ITMCSOAWebServiceService
{
public:
// uncomment the service declaration(s) if you want to use
// a service that was generated with your ISAPI extension
// CComPtr<IFileCache> m_spFileCache;
// CComPtr<IMemoryCache> m_spBlobCache;
// CComPtr<IBrowserCapsSvc> m_spBrowserCaps;
HTTP_CODE InitializeHandler(AtlServe
{
if (HTTP_SUCCESS != CSoapHandler<CTMCSOAWebSer
return HTTP_FAIL;
// Get the IFileCache service from the ISAPI extension
// if (FAILED(pProvider->QuerySe
// &m_spFileCache)))
// return HTTP_FAIL;
// Get the IMemoryCache service from the ISAPI extension
// if (FAILED(pProvider->QuerySe
// &m_spBlobCache)))
// return HTTP_FAIL;
// Uncomment the following code to retrieve a data source
// connection from the data source cache. Replace connection_name
// with a string used to identify the connection and
// connection_string with an OLEDB connection string
// which is valid for your data source. This code assumes that
// the service provider pointed to by m_spServiceProvider
// can provide an IDataSourceCache pointer to a data source
// cache service (usually implemented in the ISAPI extension).
// CDataConnection dc;
// if (S_OK != GetDataSource( pProvider,
// _T("connection_name"),
// L"connection_string",
// &dc ))
// return HTTP_FAIL;
// Get the IBrowserCapsSvc service from the ISAPI extension
// if (FAILED(pProvider->QuerySe
// &m_spBrowserCaps)))
// return HTTP_FAIL;
return HTTP_SUCCESS;
}
// This is a sample web service method that shows how to use the
// soap_method attribute to expose a method as a web method
[ soap_method ]
HRESULT TMCMsgReceive( BSTR* pbstrTerminalSerialNumberP
long* plEnterpriseIDParam,
long* plOperatorIDParam,
long* plStoreIDParam,
long* plStoreTerminalIDParam,
long* plTMCMsgSequenceNumberPara
long* plTMCOperatorSessionIDPara
long* plTMCMsgTypeParam,
VARIANT_BOOL* pfMsgCompressionFlagParam,
BSTR* pbstrTerminalVersion,
BSTR* pbstrMsgDataBufferParam,
BSTR* pbstrMsgReturnBufferParam,
long* plErrorReturnCodeParam)
{
::CoInitialize(NULL);
{
ITMC_Message::m_TMCMsgRece
plEnterpriseIDParam,
plOperatorIDParam,
plStoreIDParam,
plStoreTerminalIDParam,
plTMCMsgSequenceNumberPara
plTMCOperatorSessionIDPara
plTMCMsgTypeParam,
pfMsgCompressionFlagParam,
pbstrTerminalVersion,
pbstrMsgDataBufferParam,
pbstrMsgReturnBufferParam,
plErrorReturnCodeParam);
}
::CoUninitialize();
return S_OK;
}
// TODO: Add additional web service methods here
}; // class CTMCSOAWebServiceService
} // namespace TMCSOAWebServiceService
--------------------------
I am getting the following " error C2352: 'ITMC_Message::m_TMCMsgRec
I thought possibly the error could be fixed by the hotfix on http://support.microsoft.c
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: drichardsPosted on 2005-01-10 at 08:28:05ID: 13004321
You ARE trying to call a non-static member function: 'ITMC_Message::m_TMCMsgRec eive(pbstr TerminalSe rialNumber Param, ...' is trying to use 'm_TMCMsgReceive' as a static method. I'm not sure what the TMC_Message object is, but somehow you need to get an instance. You could try simply creating one using CoCreateInstance and then calling the method through the instance.