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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert Microsoft SOAP code to BCB6?

Status
Not open for further replies.

cjtaylor

Programmer
Aug 12, 2001
69
US
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);
 
I haven't used SOAP but I do know that BCB6 can handle it. There was an article in Sep 2002 issue of C++ Builder Developer's Journal. It is not yet publically available and I don't have the issue in front of me. If you subscribe you can get to the private issues. A very good mag. See James P. Cottingham

When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity.
[tab][tab]Albert Einstein explaining his Theory of Relativity to a group of journalists.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top