Solved

c# google search

Posted on 2011-02-15
3
753 Views
Last Modified: 2012-06-21
I get this code in internet and it show
I have this file wsdl.exe on C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin



Error      1      The type or namespace name 'GoogleSearchService' could not be found (are you missing a using directive or an assembly reference?)      C:\Users\¿¿¿7\AppData\Local\Temporary Projects\googlesearch\Program.cs      22      9      googlesearch



// googly.cs
// A Google Web API C# console application.
// Usage: googly.exe <query>
// Copyright (c) 2002, Chris Sells.
// No warranties extended. Use at your own risk.
using System;
class Googly
{
    static void Main(string[] args)
    {
        // Your Google API developer's key.
        string googleKey = "insert key here";
        // Take the query from the command line.
        if (args.Length != 1)
        {
            Console.WriteLine("Usage: google.exe <query>");
            return;
        }
        string query = args[0];
        // Create a Google SOAP client proxy, generated by:
        // c:\> wsdl.exe http://api.google.com/GoogleSearch.wsdl
        GoogleSearchService googleSearch = new GoogleSearchService();
        // Query Google.
        GoogleSearchResult results = googleSearch.doGoogleSearch(googleKey,
    query, 0, 10, false, "", false, "", "latin1", "latin1");
        // No results?
        if (results.resultElements == null) return;
        // Loop through results.
        foreach (ResultElement result in results.resultElements)
        {
            Console.WriteLine();
            Console.WriteLine(result.title);
            Console.WriteLine(result.URL);
            Console.WriteLine(result.snippet);
            Console.WriteLine();
        }
    }
}

Open in new window

0
Comment
Question by:teera
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 16

Accepted Solution

by:
Kalpesh Chhatrala earned 167 total points
ID: 34904387
0
 
LVL 8

Assisted Solution

by:guvera
guvera earned 166 total points
ID: 34904567
Hi,

There might be two possible causes for this error.

  1. May be you have not created your "net" folder" as web application.
  2. May be you have named the namespace wrong while creating the assembly.

Also please check the below links.

 http://www.sitepoint.com/forums/showthread.php?t=388702

Hope it may helpful to you.

Regards
Guvera
0
 
LVL 15

Assisted Solution

by:Russell_Venable
Russell_Venable earned 167 total points
ID: 34913043
knowing that Googles WSDL interface code is obsolete and how Google has switched to using JSON and AJAX requests as they allow your searches to be quicker. Checking the SOAP proxy address to see if google is still implementing it, you would notice that manually browsing to the address show's.
 Google 404So in otherwords you need to use the current API given by Google to access there functionality.
You will need to sign-up for a API key if you dont already have one:Google API Key Registration

After gaining the key you can download the Current API for clients from here:
Google Data Protocol  - Client Libraries

Just add the required userspace:
using Google.GData.Client;

Open in new window

and then then convert your code from there or
 Best solution I can give you is using Gapi.NET - .NET (C#) wrapper for Google AJAX API as this is the method currently implemented to use googles search results and this wrapper is the solution for using those JSON/AJAX posts.


Reference:
Google SOAP Search API (No Longer Available)
This is another example but using googles query and regex to filter content.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
parse string in c# 5 41
c#, datatable, aspx 4 50
VS C# how to design libary of functions 7 33
How does this modal gets closed? 6 41
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question