I not very familiar with soap. I was wondering how I would go about converting this MS Soap code, so I can use it in BCB6. Which components should I be looking at? Any help would be appreciated.
This sample code requires Microsoft SOAP Toolkit and its pre-requisites.
_bstr_t bsStoreID, bsStoreKey, bsApplicationID
_bstr_t bsResultCode, bsResultMessage;
long nResponseCode = -1;
// create and initialize soapclient
ISOAPClientPtr iSoapClient;
HRESULT hr = iSoapClient.CreateInstance(__uuidof(MSSOAPLib::SoapClient));
if (FAILED(hr))
return hr;
VARIANT vtTrue;
vtTrue.vt = VT_BOOL;
vtTrue.boolVal = VARIANT_TRUE;
hr = iSoapClient->put_ClientProperty(L"ServerHTTPRequest", vtTrue);
if (FAILED(hr))
return hr;
const _bstr_t bsNull = (BSTR) NULL;
hr = iSoapClient->mssoapinit(
L"L"EFSnet2", bsNull, bsNull);
if (FAILED(hr))
return hr;
DISPID dispid;
DISPPARAMS dispparams;
VARIANT params[5];
VARIANT vtResult;
EXCEPINFO ExceptInfo;
// get dispatch id for method
OLECHAR *pMethodName = L"SystemCheck";
hr = iSoapClient->GetIDsOfNames(IID_NULL, &pMethodName, 1,
LOCALE_SYSTEM_DEFAULT, &dispid);
if (FAILED(hr))
return hr;
// setup input parameters (these are passed in REVERSE order)
ZeroMemory(params, sizeof(params));
params[4].vt = VT_BSTR;
params[4].bstrVal = bsStoreID;
params[3].vt = VT_BSTR;
params[3].bstrVal = bsStoreKey;
params[2].vt = VT_BSTR;
params[2].bstrVal = bsApplicationID;
// initialize DISPPARAMS structure and return param
dispparams.cArgs = 5;
dispparams.cNamedArgs = 0;
dispparams.rgdispidNamedArgs = NULL;
dispparams.rgvarg = params;
VariantInit(&vtResult);
// invoke method and retrieve return params
hr = iSoapClient->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,
DISPATCH_METHOD, &dispparams, &vtResult, &ExceptInfo, NULL);
bsResultCode = params[1];
bsResultMessage = params[0];
if (vtResult.vt == VT_I4)
nResponseCode = vtResult.lVal;
// cleanup memory
for (int i = 0; i < 5; i++)
VariantClear(¶ms);
VariantClear(&vtResult);
This sample code requires Microsoft SOAP Toolkit and its pre-requisites.
_bstr_t bsStoreID, bsStoreKey, bsApplicationID
_bstr_t bsResultCode, bsResultMessage;
long nResponseCode = -1;
// create and initialize soapclient
ISOAPClientPtr iSoapClient;
HRESULT hr = iSoapClient.CreateInstance(__uuidof(MSSOAPLib::SoapClient));
if (FAILED(hr))
return hr;
VARIANT vtTrue;
vtTrue.vt = VT_BOOL;
vtTrue.boolVal = VARIANT_TRUE;
hr = iSoapClient->put_ClientProperty(L"ServerHTTPRequest", vtTrue);
if (FAILED(hr))
return hr;
const _bstr_t bsNull = (BSTR) NULL;
hr = iSoapClient->mssoapinit(
L"L"EFSnet2", bsNull, bsNull);
if (FAILED(hr))
return hr;
DISPID dispid;
DISPPARAMS dispparams;
VARIANT params[5];
VARIANT vtResult;
EXCEPINFO ExceptInfo;
// get dispatch id for method
OLECHAR *pMethodName = L"SystemCheck";
hr = iSoapClient->GetIDsOfNames(IID_NULL, &pMethodName, 1,
LOCALE_SYSTEM_DEFAULT, &dispid);
if (FAILED(hr))
return hr;
// setup input parameters (these are passed in REVERSE order)
ZeroMemory(params, sizeof(params));
params[4].vt = VT_BSTR;
params[4].bstrVal = bsStoreID;
params[3].vt = VT_BSTR;
params[3].bstrVal = bsStoreKey;
params[2].vt = VT_BSTR;
params[2].bstrVal = bsApplicationID;
// initialize DISPPARAMS structure and return param
dispparams.cArgs = 5;
dispparams.cNamedArgs = 0;
dispparams.rgdispidNamedArgs = NULL;
dispparams.rgvarg = params;
VariantInit(&vtResult);
// invoke method and retrieve return params
hr = iSoapClient->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,
DISPATCH_METHOD, &dispparams, &vtResult, &ExceptInfo, NULL);
bsResultCode = params[1];
bsResultMessage = params[0];
if (vtResult.vt == VT_I4)
nResponseCode = vtResult.lVal;
// cleanup memory
for (int i = 0; i < 5; i++)
VariantClear(¶ms);
VariantClear(&vtResult);