1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
|
<html dir="ltr"><head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="assetid" CONTENT="HV01082288"><META NAME="lcid" CONTENT="1033"><title>Google Sample</title><link rel="stylesheet" type="text/css" href="office10.css"><script type="text/javascript" language="Javascript" src="ExpCollapse.js"></script><script type="text/javascript" language="JavaScript" src="inline.js"></script></head><body><p id="ExpandAllLine" class="ExpFav"><a href="#" onclick="ExpandAll()" onkeypress="ExpandAll()" class="DropDown"><img id="picHeader" border="0" src="expandtri.gif" alt="Show All"><span id="ExpandAll">Show All</span></a></p><h1>Google Sample</h1><p>The Google research service provides Web research capability with
the Google.com search engine from within Microsoft® Office 2003 or Microsoft
Internet Explorer.</p><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Installing the research
service</a></p><div id="ExpCol" class="collapsed" border="0"><p>To install the Google research service, follow these
steps:</p><ol><li><div class="ind"><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Configure the
research service</a></p><div id="ExpCol" class="collapsed" border="0"><div class="ind"><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Requirements</a></p><div id="ExpCol" class="collapsed" border="0"><ul><li>Microsoft Office 2003</li><li>Microsoft .NET Framework
1.0 or later</li><li>Microsoft .NET Framework 1.0 Software Development Kit,
or a later release</li><li>Microsoft Visual Studio® .NET 2002 (to modify
and rebuild the Web service if necessary)</li><li>Microsoft Internet
Information Services (IIS) 5.0 or
later</li></ul><p><b>Note</b> IIS should be installed before you set up the Microsoft .NET Framework SDK and Microsoft Visual Studio .NET. If you have installed or re-installed IIS after setting up the Microsoft .NET Framework SDK, you will experience unexpected behavior when you try to view ASP.NET pages. To fix this, register ASP.NET with IIS again by running the aspnet_regiis.exe utility. For more information, see Knowledge Base article 306005 , "<a href="http://r.office.microsoft.com/r/rlidAWSContentRedir?AssetID=XT010971891033&CTT=11&Origin=HV010822881033" target="_new">HOWTO: Repair IIS Mapping After You Remove and Reinstall IIS</a>.”</p></div></div><div class="ind"><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Configuring the research
service</a></p><div id="ExpCol" class="collapsed" border="0"><p>The Google research service provides a
Microsoft Visual C#® and a Microsoft Visual Basic® .NET version. The instructions
below use the C# version for illustration. Make necessary adjustments to use
the Visual Basic .NET version.</p><ol><li>Do one of the following: <ul><li>If you have installed the
Research SDK on the computer that hosts the IIS server <i>ServerName</i>, go to
step 2.</li><li><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">If you have installed the Research SDK on
a computer different from <i>ServerName</i>: </a></p><div id="ExpCol" class="collapsed" border="0"><ol><li>Create a folder named GoogleResearchLibraryCSharp on
<i>ServerName</i>. This is the research service folder.<p><b>Note</b> To avoid access
problems when running running the Google Web service, do not place the
GoogleResearchLibraryCSharp folder in the My Documents
folder.</p></li><li>The source and run-time files are located in the
Google research service folder and its subfolders at <i>Drive</i>:\Program
Files\Microsoft Office 2003 Developer Resources\Microsoft Office 2003 Research
Service SDK\Samples\Google
Sample\GoogleResearchLibraryCSharp.<p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Folder
structure</a></p><div id="ExpCol" class="collapsed" border="0"><table> <tr> <th>Root Folder</th><th>Sub
Folder</th><th>Description</th></tr><tr>
<td>\GoogleResearchLibraryCSharp</td><td> </td><td>Root folder for the XML Web
service and source code.</td></tr><tr><td> </td><td>\bin</td><td>Assembly file
for the research service.</td></tr><tr> <td> </td><td>\Web
References</td><td>Web reference files for the C# Web service
project.</td></tr></table> </div><p>Copy the content of the
GoogleResearchLibraryCSharp folder from the computer that the SDK is installed
on to the GoogleResearchLibraryCSharp folder on
<i>ServerName</i>.</p></li></ol></div></li></ul></li><li><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Make
sure the default Web site in Internet Information Services (IIS) is running on
the server computer <i>ServerName</i>.</a></p><div id="ExpCol" class="collapsed" border="0"><ol><li>From the Microsoft Windows® <b class="ui">Start</b> menu, click <b class="ui">Control Panel</b>, click <b class="ui">Administrative Tools</b>, and
then click <b class="ui">Internet Information Services</b>.</li><li>In the left-hand
pane, expand the node containing the name of your Web server,
<i>ServerName</i>.</li><li>Expand <b class="ui">Web Sites</b>.</li><li>Right-click
the <b class="ui">Default Web Site</b> node, and click <b class="ui">Start</b>. If <b class="ui">Start</b>
is inactive, IIS is already running.</li></ol></div>
</li><li><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Map the research service folder to a virtual
directory.</a></p><div id="ExpCol" class="collapsed" border="0"><p>To map the research service folder to a
virtual directory named GoogleCSharpService on <i>ServerName</i>:</p><ol><li>From the Microsoft Windows® <b class="ui">Start</b> menu, click
<b class="bterm">Control Panel</b>, and then double-click <b class="ui">Administrative
Tools</b>.</li><li>Double-click <b class="ui">Internet Information
Services</b>.</li><li>In the Internet Information Services folder tree,
expand the folders for the local computer, the <b class="ui">Web Sites</b> directory,
and the <b class="ui">Default Web Site</b>.</li><li>Create a new virtual directory
named GoogleCSharpService by right-clicking <b class="ui">Default Web Site</b> and
selecting <b class="ui">New</b> and <b class="ui">Virtual Directory</b>. Follow the instructions
in the Virtual Directory Creation
Wizard.</li></ol></div></li><li>By default, the
Google research service assumes the client computer and <i>ServerName</i> are the
same computer, and it is configured to use http://localhost/ as its server. To
change the server name so that the service can be accessed from a different
computer, edit the Web.config file found in the research service folder. Edit
the <b class="bterm">value</b> attribute of the following <b class="bterm">add</b> XML element<pre><code><add key="ServerPath"
value="http://localhost"/></code></pre>by changing it to the name of your
server. For example:<pre><code><add key="ServerPath"
value="http://www.MyServerName.com"/></code></pre></li><li>If you use a
firewall to gain access to the Internet, check with your organization's network
administrator to see if there is any special firewall client software that
needs to be installed, or any special connectivity settings that need to be
set.</li></ol></div></div></div></div></li><li><div class="ind"><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Add the research service to the <b class="bterm">Research</b>
task pane</a></p><div id="ExpCol" class="collapsed" border="0"><p>Before you can search on the Google research
service for the first time, you must add the research service to the
<b class="bterm">Research</b> task pane by using the URL
http://<i>ServerName</i>/GoogleCSharpService/Registration.asmx. For more
information about adding a research service, see
<a href="rsAddingUI.htm" id="HV01082279" lcid=" ">Adding Services through the Office User
Interface</a>.</p></div></div></li></ol></div><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Google
Web APIs</a></p><div id="ExpCol" class="collapsed" border="0"><p>The Google research service uses the
Google Web APIs, as documented at http://www.google.com/apis/. To access the
Google Web APIs, you must create a Google account and obtain a license key from
http://www.google.com/apis/. Your Google Account and license key entitle you to
1,000 automated queries per day. There is no charge for this key.</p><ol><li>Go to http://www.google.com/apis/ to obtain a license
key.</li><li>Update web.config with the license key. There are C# and
Visual Basic .NET versions of the source for this research service, so update the
corresponding web.config for the language of your choice:<ul><li>For the C# version, the web.config file is located at
<i>Drive</i>:\Program Files\Microsoft Office 2003 Developer
Resources\Microsoft Office 2003 Research Service
SDK\Samples\GoogleResearchLibraryCSharp.</li><li>For the Visual Basic .NET version,
the web.config file is located at <i>Drive</i>:\Program Files\Microsoft Office
2003 Developer Resources\Microsoft Office 2003 Research Service
SDK\Samples\GoogleResearchLibraryVBNet.</li></ul><p>Put your license key
assigned to you by Google into the <b class="bterm">value</b> field:</p><pre><code><add
key="GoogleKey" value="[INSERT YOUR KEY HERE - SEE
README]"/></code></pre><p>For example, this will look
like:</p><pre><code><add key="GoogleKey"
value="abc123xyz/abc"/></code></pre></li></ol>
</div><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Searching the research
service</a></p><div id="ExpCol" class="collapsed" border="0"><p>Searching the Google research service is very similar
to searching Google.com. In the <b class="bterm">Research</b> task pane, under
<b class="ui">Search for</b>, type the text that you would like to look up. Select
Google Web Search (CSharp) as the research service if it has not yet been
selected. The <b class="bterm">Research</b> task pane will then display a list of
search results.</p></div><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show">Design of the research
service</a></p><div id="ExpCol" class="collapsed" border="0"><p>Under the <b class="bterm">Search</b> namespace, the Google
research service specifies the Web methods: <b class="bterm">Registration</b>,
<b class="bterm">Query</b>, and <b class="bterm">Status</b>. The pages
http://<i>ServerName</i>/GoogleCSharpService/Registration.asmx and
http://<i>ServerName</i>/GoogleCSharpService/Query.asmx provide brief descriptions
of each of the methods and hyperlinks to the formal definitons of these
methods.</p><div class="ind"><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show"><b class="bterm">Registration</b></a></p><div id="ExpCol" class="collapsed" border="0"><p>This
method is called when you first add the Google research service to the task
pane. At that point, it sends a registration request. This method always
returns a registration response, and Office then adds this research service to
its lists of services. The registration response supports the
<a href="rsxsdRegistrationResponse.htm" id="HV01084526" lcid=" ">Microsoft.Search.Registration.Response Schema</a>.</p>
<p>Note that the <b class="bterm">QueryPath</b> element refers to the
location of the <b class="bterm">Query</b> Web method for this research service at
http://<i>ServerName</i>/GoogleCSharpService/Query.asmx.</p></div></div><div class="ind"><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show"><b class="bterm">Query</b></a></p><div id="ExpCol" class="collapsed" border="0"><p>The bulk of the processing
by this solution is handled by the <b class="bterm">QueryProcessor</b> class. It has
the following class structure:</p><pre><code>public class QueryProcessor :
System.Web.Services.WebService [WebMethod()]
public string Query(string queryXml)
private string QueryGoogle(string queryString, int startAt)
[WebMethod()] public string Status() </code></pre><p>The public function
<b class="bterm">Query</b> that is marked with <b class="bterm">[WebMethod()]</b> is the
other key Web method for this research service. Each request from the client is
passed into this function and stored in the <b class="bterm">queryXml</b> parameter.
</p><p>The <b class="bterm">Query</b> function parses <b class="bterm">queryXml</b>
for search terms specified by the user. It then calls the internal method
<b class="bterm">QueryGoogle</b> to continue the search using the Google Web APIs.
</p><p>After <b class="bterm">QueryGoogle</b> obtains search results, it puts
together and includes the results in a query response that supports the
<a href="rsxsdResponse.htm" id="HV01084530" lcid=" ">Microsoft.Search.Response Schema</a>. It then passes the
query response back to <b class="bterm">Query</b>. </p><p>The
<b class="bterm">Query</b> function returns the query response to the
<b class="bterm">Research</b> task pane. The <b class="bterm">Research</b> task pane then
displays the list of search results.</p> </div></div><div class="ind"><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show"><b class="bterm">Status</b></a></p><div id="ExpCol" class="collapsed" border="0"><p>This
method returns the status of the server that hosts the research
service.</p></div></div><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show"><b class="bterm">urn:Microsoft.Search</b></a></p><div id="ExpCol" class="collapsed" border="0"><p>The
<b class="bterm">Registration</b> and <b class="bterm">Query</b> Web methods wrap a
Registration or Query response into the body of a SOAP message. These methods
are specified with the following directive that defines the namespace used for
the SOAP
message:</p><pre><code><WebService(Namespace:="urn:Microsoft.Search")></code></pre><p>The
<b class="bterm">Research</b> task pane responds only to SOAP messages with this
namespace.</p></div></div><center><a href="XMLSchemaCopyright_HV01147162.htm">©2003-2004 Microsoft Corporation. All rights reserved.</a>
Permission to copy, display and distribute this document is available at: <a
href="http://r.office.microsoft.com/r/rlidAWSContentRedir?AssetID=XT010988631033&CTT=11&Origin=HV011232471033"
target="_new">http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp</a></center></body></html>
|