Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Coaster Kev

Google API C++

This topic is 5127 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
Guest 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;

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
sorry,

GoogleSearchPort* gsp = new GoogleSearchPort;


Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!