SQLData Systems, Inc.
Home | Products | Services | Documents | Support
 

The sample demonstrates how to write a SOAP client using SQLData SoapActor library.
It access web services from http://www.soaptoolkit.com and calls GetStockQuote to get 
Microsoft stock price from the remote server.

main(int argc, char **argv)
{
	// initialize COM stuffs..
	CoInitialize(0);
	// initialize the parameter array for the method call. The array must end with NULL.
	wchar_t* pbstrParams[255]={L"MSFT", NULL};
	SoapClient soapClient;
	std::string * pOutput;
	unsigned int nSize=0;
	HRESULT hr;
	if(SUCCEEDED(hr=soapClient.ExecuteMethod(L"http://www.soaptoolkit.com/soapdemo/services.xml", L"GetStockQuote", pbstrParams, &pOutput, &nSize)))
	{
		// print out results
		for(int i=0; i<nSize; i++)
			_tprintf("%s\n", pOutput[i].c_str());
	}
	else
	{
		// obtain error string when failed.
		wprintf(L"Error String %s\n", soapClient.GetErrorString());
	}
	CoUninitialize();
	return 0;
}

You can also access web services in Visual Basic or Active Server Pages using our SoapAgent object. The following is all you need to get a stock quote:

Dim MyAgent As SoapAgent
Set MyAgent = New SoapAgent

MyAgent.AddParameter "symbol", "msft", ""
MyAgent.ExecuteMethod "http://services.xmethods.net/soap/urn:xmethods-delayed-quotes.wsdl", "getQuote"
MsgBox MyAgent.GetResponse("Result")

Please visit http://www.SoapClient.com for more information and sample code. 

Download | Purchase | ContactFeedback

horizontal rule

Send mail to  info2-at-sqldata-dot-com with questions or comments about this web site.
Copyright 2008-2010 SQLData Systems, Inc.
Last modified: July 10, 2010