Skip to main content
gamedev.net
🔒 Locked

Google API C++

Started by 1kevgriff May 9, 2004 at 2:10 AM 9 replies 1.9k views
Original Post
1kevgriff
1kevgriff
I was wondering if anyone here has experimented with Google API. I'm writing a feature into a game, and it involves interacting with Google. I found a article about using WASP to convert a WSDL file into CPP/H files. I keep running into problems when running the code for doing a search:
{
WASP_Runtime::clientInitialize();
	WASP_Runtime::clientStart("d:/WASP/conf/client.xml", EXCENV);


	GoogleSearchPort	gsp;
	GoogleSearchResult *ret = gsp.doGoogleSearch("(GoogleKey)", "Cybro", 0, 1000, false, "", true, "", "", "");

	ResultElementArray *results = ret->resultElements;
	ResultElement **i_results = results->array;
	int num_results	= results->length;


	WASP_DeleteContext dc;
	ret->remove(dc);


	return num_results;
}
I don't see any problems with that code, and it's almost identical to the FEW examples I've seen. I get an exception call on the call to doGoogleSearch. Anyone have any clue? Thanks. edit: formatting code ======================================== Cybro :: The Ultimate Online Game Show. Ever. [edited by - Coaster Kev on May 9, 2004 3:11:38 AM]
Miserable
Miserable
quote:
Original post by Anonymous Poster
I''ve got no idea what a "Google API" is but you need to call the constructor to GoogleSearchPort, possibly as

GoogleSearchPort gsp();

or make gsp a pointer and use -> instead of .

GoogleSearchPort gsp = new GoogleSearchPort;


Why on Earth would he need to do that?
BitMaster
BitMaster
Anon: The constructor is *always* called. Also, in this case your code is broken, because
GoogleSearchPort gsp();
is interpreted as the declaration of a local function gsp which returns a GoogleSearchPort instance. The default constructor doesn''t need brackets to be called.
BitMaster
BitMaster
My experience with some compilers shows differently.
1kevgriff
1kevgriff
Google API

Just to clarify, I''m using VC++.NET but the WASP server I''m using to convert the WSDL file to C++ is compliant with VC++.NET.

I''m just wondering if I''m not calling some function that I should be. I''m hoping someone here has had experience with Google API before.

========================================
Cybro :: The Ultimate Online Game Show. Ever.
Etnu
Etnu
I genuinely have no clue how to do what you''re asking, but posting about the Google API (which I had all but forgotten) just gave me an awesome idea for gameplay.
---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.
1kevgriff
1kevgriff
The Google API is really powerful, and really cool IMHO. If i remember right, you can search queries, get spelling suggestions, and something else that I just can't remember at the moment. It's free too. It comes with JAVA, VB, and C# examples... but sadly no c++. It's ok though, I'll figure it out sooner or later.

EDIT: BTW, if you wanna learn how to do this in C++, here is a link: Web Services In C++. Have fun.

[edited by - Coaster Kev on May 9, 2004 9:28:46 PM]
1kevgriff
1kevgriff
I got it working. This is so cool, everyone should try it. I was making it harder than it should''ve been. Since VC++.NET has built in support for web services, I figured out how to let VC do all the work.

========================================
Cybro :: The Ultimate Online Game Show. Ever.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.