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
|
<html dir="ltr"><head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="assetid" CONTENT="HV01082287"><META NAME="lcid" CONTENT="1033"><title>IBuySpy 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>IBuySpy Sample</h1><p>IBuySpy.com is a fictitious retailer of spying supplies that operates an online store. The IBuySpy research service illustrates how a corporation's custom research service can enable employees and customers to access and interact with important corporate data from the familiar environment of Microsoft® Office 2003.</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 IBuySpy research service, follow the three primary steps:<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=HV010822871033" 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">Configure the research service</a></p><div id="ExpCol" class="collapsed" border="0"><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 other than <i>ServerName</i>, do the following: </a></p><div id="ExpCol" class="collapsed" border="0"><ol><li>Create a folder named IBuySpyResearchPane on <i>ServerName</i>. This is the research service folder.<p><b>Note</b> To avoid access problems when running running the IBuySpy Web service, do not place the IBuySpyResearchPane folder in the My Documents folder.</p></li><li>The source files, run-time files, and a sample document are located at <i>Drive</i>:\Program Files\Microsoft Office 2003 Developer Resources\Microsoft Office 2003 Research Service SDK\Samples\IBuySpy Sample, where <i>Drive</i> is the drive where you have installed the SDK.<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>\IBuySpyResearchPane</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>\data</td><td>Microsoft Jet database that stores the product catalog.</td></tr><tr>
<td> </td><td>\images</td><td>Product images and company logo.</td></tr><tr>
<td> </td><td>\xml</td><td>XML wrapper files used by the source code.</td></tr><tr>
<td>\SmartTag</td><td> </td><td>Root folder for the smart tag DLL and source code.</td></tr><tr><td>\Documents</td><td> </td><td>Sample document Customer letter.doc.</td></tr></table>
</div><p>On the computer that the SDK is installed on, copy the contents of the IBuySpyResearchPane folder to the IBuySpyResearchPane 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"><ul><li>In Microsoft Windows® <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, then click <b class="ui">Start</b>. If <b class="ui">Start</b> is inactive, that means IIS is already running.</li></ul></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 IBuySpyService on <i>ServerName</i>:</p><ol><li>From the Microsoft Windows® <b class="ui">Start</b> menu, click <b class="ui">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 IBuySpyService by right-clicking <b class="ui">Default Web Site,</b> and then 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 IBuySpy research service assumes that the client computer is the same computer as <i>ServerName</i> and is configured to use http://localhost/ as its server. To change the setup so that the service can be accessed from a different computer, edit the Web.config file that is located in the research service folder. Edit the <b class="bterm">value</b> attribute of the <b class="bterm">add</b> 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 made.</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">Configure the smart tag.</a></p><div id="ExpCol" class="collapsed" border="0"><p>The research service uses a client-side smart tag to provide a richer set of features for interactions with Office documents. If the smart tag is not installed, the research service will function normally, but the smart tag menu items will not be available.</p><p>To install the smart tag on the client computer:</p><ol><li>Do one of the following: <ul><li>If you have installed the Research Service SDK on this client computer, go to step 2 below.</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 Service SDK on a computer other than the client computer, do the following:</a></p><div id="ExpCol" class="collapsed" border="0"><ol><li>Create a folder named IBuySpy Sample on the client computer.</li><li>From the computer that the SDK is installed on, copy the contents of the IBuySpy Sample folder (under <i>Drive</i>:\Program Files\Microsoft Office 2003 Developer Resources\Microsoft Office 2003 Research Service SDK\Samples) to the IBuySpy Sample folder on the client computer.</li></ol></div></li></ul></li><li>On the client computer, open a command prompt and navigate to IBuySpy Sample\SmartTag.</li><li>Register the smart tag DLL by using the following command-line command:
<pre><code>regsvr32 ProductSmartTag.dll</code></pre>
</li><li>A message box will appear stating, "DllRegisterServer in productsmarttag.dll succeeded." Click <b class="ui">OK</b>.</li><li>To notify Office that this smart tag is available, type the following command at the command line:<pre><code>regedit RegistrySetup.reg</code></pre>
You will be prompted to confirm that you want to import this information into the registry.
Click <b class="ui">Yes</b>.</li><li>A message box will appear stating, "Information in registrysetup.reg has been successfully entered into the registry." Click <b class="ui">OK</b>.</li><li>To make the newly-installed smart tag available and active, close and reopen any applications in which you want to use the smart tag.</li></ol></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="ui">Research </b>task pane.</a></p><div id="ExpCol" class="collapsed" border="0"><p>Before you can search on the IBuySpy research service for the first time, you must add the research service to the <b class="ui">Research</b> task pane by using the URL http://<i>ServerName</i>/IBuySpyService/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> </p></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>The IBuySpy research service, <b class="ui">IBuySpy.com Product Information</b>, is integrated with a product catalog, and lets you browse different categories in the catalog. When you click a specific category, all of the products within that category are listed in the <b class="ui">Research </b>task pane.</p><p>Use the sample customer letter (Customer Letter.doc in <i>Drive</i>:\Program Files\Microsoft Office 2003 Developer Resources\Office 2003 Research Service SDK\Samples\IBuySpy Sample\Documents), to search the product catalog and insert product information.</p><h3>Product Search and Details</h3><p> Customer Letter.doc is a response letter that needs to be written to a customer that liked Counterfeit Creation Wallet, which is one of IBuySpy.com's products. Use the research service to search for related products to suggest to this customer. Without Research services, you would need to open another application or Web page to look up the product information, and manually copy and paste the information into the letter. But with this service, the process is integrated directly with Microsoft Office Word 2003.</p><ol><li>Open Customer Letter.doc in Word.</li><li>While holding down the ALT key, click <b class="ui">products</b> in the document. This opens the <b class="ui">Research</b> task pane.</li><li>Under <b class="ui">Search for</b>, type <b class="bterm">wallets</b>.</li><li>Select the <b class="ui">IBuySpy.com Product Information</b> research service if it has not been selected yet.</li><li>Click <b class="ui">Protection</b> on the <b class="ui">Research</b> task pane.</li><li>Scroll to view the products listed.</li></ol><h3>Inserting Product Information</h3><p>The <b class="ui">Research </b>task pane page lists products that are related to "wallets." For example, the <b class="ui">Bullet Proof Facial Tissue</b> is listed, and may be of interest to the customer. </p><p>In the product details, there is a set of actions that are available from directly within the <b class="ui">Research</b> task pane. These actions make it easy to insert product information.</p><ol><li>Under <b class="ui">Bullet Proof Facial Tissue</b>, click <b class="ui">Product Details</b>.</li><li>Move the insertion point in the Customer Letter document to the white space immediately following the text "…of the following related products."</li><li>Click <b class="ui">Insert Model Name and Description</b> from the actions menu.</li><li>Click <b class="ui">Insert Product Image</b> from the actions menu.</li></ol><h4>Advanced product search</h4><p>The advanced product search allows you to search through the entire product catalog using criteria such as specific product categories, price ranges, and whether the items are in stock.</p><ol><li>Click <b class="ui">Advanced product search</b>.</li><li>Type <b class="bterm">500</b> in the <b class="ui">Product low price (Optional)</b> control.</li><li>Type <b class="bterm">1500</b> in the <b class="ui">Product high price (Optional)</b> control.</li><li>Click <b class="ui">Only show items in stock</b>. </li><li>Click <b class="ui">Go</b>.</li></ol></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>In the <b class="bterm">Search</b> namespace, the IBuySpy 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>/IBuySpyService/Registration.asmx and http://<i>ServerName</i>/IBuySpyService/Query.asmx provide brief descriptions of each of the methods and hyperlinks to the formal definitions 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 IBuySpy research service to the task pane. At this point, it sends a registration request. This method always returns a registration response, and Office 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:</p><pre><code>http://<i>ServerName</i>/IBuySpyService/Query.asmx</code></pre><p>This is the pointer to the <b class="bterm">Query Web</b> method for this research service.</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"><div class="ind"><p><a href="#" class="DropDown" onclick="Outline2()" onkeypress="Outline2()"><img border="0" src="blueup.gif" alt="Show"><b class="bterm">QueryProcessor</b> class</a></p><div id="ExpCol" class="collapsed" border="0"><p>The bulk of the processing done in this solution is handled by the <b class="bterm">QueryProcessor</b> class. It has the following class structure:</p><pre><code>Public Class QueryProcessor
Inherits System.Web.Services.WebService
<WebMethod()> Public Function Query(ByVal queryXml As String) As String
Private Function Response_ProductDetails(…) As String
Private Function Response_ProductSummaryForCategory(…) As String
Private Function Response_CategoryListAsForm(..) As String
Private Function Response_ProductKeywordSearch(…) As String
Private Function Response_NoResults(…) As String
<WebMethod()> Public Function Status() As String
End Class
</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> <b class="bterm">Query</b> parses <b class="bterm">queryXml</b> for search terms, form-based requests, and other search parameters specified by the user. <b class="bterm">Query</b> then determines which results to return by calling the remaining functions that have the <b class="bterm">Response_</b> prefix. These functions are marked as <b class="bterm">Private</b>. They simply serve as utility functions that enable the <b class="bterm">Query</b> function to respond to the user request.</p><p>The following table describes how each of these methods are used:</p><table>
<tr>
<th>Function</th>
<th>Description</th>
</tr>
<tr>
<td>Response_ProductDetails</td>
<td>Returns details on a specific product.</td>
</tr>
<tr>
<td>Response_ProductSummaryForCategory</td>
<td>Returns a summary for all products in a certain category.</td>
</tr>
<tr>
<td>Response_CategoryListAsForm</td>
<td>Returns a form that contains a drop-down list of available product categories.</td>
</tr>
<tr>
<td>Response_ProductKeywordSearch</td>
<td>Returns a response to a keyword search against model name and product description in the product database.</td>
</tr>
<tr>
<td>Response_NoResults</td>
<td>Returns a generic page for any searches that produced no matching results. This function ensures that a user is never left without guidance on what to search for.</td>
</tr>
</table></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">XMLTextWriter</b> object</a></p><div id="ExpCol" class="collapsed" border="0"><p>The <b class="bterm">Query</b> function uses the <b class="bterm">XMLTextWriter</b> object. This object provides a highly efficient and lightweight way of constructing a well-formed XML document. Since the response from the <b class="bterm">Query</b> interface is based on schema-structured XML, it is important to have a well-formed XML document, otherwise the <b class="ui">Research</b> task pane is likely to show an empty pane. The query response supports the <a href="rsxsdResponse.htm" id="HV01084530" lcid=" ">Microsoft.Search.Response Schema</a>.</p><p>Most of the <b class="bterm">Response_</b> routines create an XML writer with the following code:</p><pre><code>Dim ioMemStream As New MemoryStream()
Dim outputXmlWriter As New XmlTextWriter(ioMemStream, Nothing)
</code></pre><p>With this object, the query response can be constructed. For example:</p><pre><code>While productDetailsData.Read
.WriteStartElement("P")
.WriteStartElement("Char")
.WriteAttributeString("bold", "true")
.WriteString("Hologram Cufflinks”))
.WriteEndElement()
.WriteStartElement("Char")
.WriteAttributeString("light", "true")
.WriteString(“THNKDKE1”)
.WriteEndElement()
.WriteEndElement()
End While
</code></pre><p>The following XML is created:</p><pre><code><P>
<Char bold="true">Hologram Cufflinks</Char>
<Char light="true">THNKDKE1</Char>
</P>
</code></pre><p>At first glance, this may appear to be a lot of code to create a simple XML string. However, a typical response packet can be 50 to 100 lines of XML. This can be cumbersome to manage with generic string-handling routines. The <b class="bterm">XMLTextWriter</b> object provides both a memory-efficient way of constructing this XML response packet and an easy way to create and manage code.</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">urn:Microsoft.Search</b> namespace</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 a directive that defines the namespace used for the SOAP message:</p><pre><code><WebService(Namespace:="urn:Microsoft.Search")></code></pre><p>The <b class="ui">Research</b> task pane responds only to SOAP messages with this namespace.</p></div></div>
</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>For more information about the research service schemas, see <a href="rsReferenceSchemas.htm" id="HV01082292" lcid=" ">XML Schemas Overview</a>.</p></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>
|