Another lesser-known highlight of Office 2003 is the built-in Research pane. The Research pane is one of several panes that are available (for instance, the default pane available in Word when you create a new document is the New Document pane, which suggests the various types of document templates that you can use. Built in to the Research pane in Office 2003 are research and query capabilities for the Dictionary, Thesaurus, Translation, Encarta Encyclopedia, MSN Search, Stock Quotes, Company Profiles, and so on. Office 2003 also provides a capability for developing a customized Research pane that can be used within a company or provided as a service. For instance, because customers are probably the most valuable assets in a company, an enterprise could use the Research pane capability by developing and deploying a Customer Research pane, which could provide the relevant information about the customer from a back-end CRM (Customer Relationship Management) or ERP (Enterprise Resource Planning) application, or a combination of those.
Developing a custom research pane (shown in Figure 12.9) is a matter of implementing two Web services:
Figure 12.9. Custom Research pane developed using Web services.
For instance, Listing 12.6 is an implementation of a Registration pane. Actually, this code could be used with appropriate value changes, as is, by your own implementation because this is relatively similar for any research pane registration. Listing 12.6 Custom Research Pane Registration Service<%@ webservice class="CustomerResearchPane" language="C#"%> using System; using System.Web.Services; using System.Xml; using System.IO; [WebService(Namespace="urn:Microsoft.Search")] class CustomerResearchPane { [WebMethod()] public String Registration(String regXML) { String xml; xml= "<?xml version=\"1.0\"?>\n" +"<ProviderUpdate " + "xmlns=\"urn:Microsoft.Search.Registration.Response\">" +" <Status>SUCCESS</Status>" +" <Providers>" +" <Provider>" +" <Message>Customer Research Pane Registered!</Message>" +" <Id>{3D3AA1A7-EB79-4ee9-9002-22F54CB3D852}</Id>" +" <Name>Customerer Research Pane</Name>" +" <QueryPath>" +" http://localhost/WebServices/Query.asmx" +" </QueryPath>" +" <RegistrationPath>" +" http://localhost/WebServices/Registration.asmx" +" </RegistrationPath>" +" <Type>SOAP</Type>" +" <Services>" +" <Service>" +" <Id>{2A6DC8C8-4D9A-4185-A889-FDE1125FF4B3}</Id>" +" <Name>Customer Research Pane</Name>" +" <Description>Customer Research Pane</Description>" +" <Copyright>Hitesh Seth, Inc.</Copyright>" +" <Display>On</Display>" +" <Category>INTRANET_GENERAL</Category>" +" </Service>" +" </Services>" +" </Provider>" +" </Providers>" +"</ProviderUpdate>"; return xml; } } Next is the code (Listing 12.7) that actually implements the query service. Notice that the customer name is extracted from the query XML through a simple XPath lookup. Listing 12.7 Custom Research Pane Query Service<%@ webservice class="CustomResearchPane" language="C#"%> using System.Web.Services; using System.Xml; using System.IO; using System; [WebService(Namespace="urn:Microsoft.Search")] public class CustomResearchPane { [WebMethod()] public String Query(String queryXml) { XmlDocument reqXml = new XmlDocument(); reqXml.LoadXml(queryXml); XmlNamespaceManager ns = new XmlNamespaceManager(reqXml.NameTable); ns.AddNamespace("ns", "urn:Microsoft.Search.Query"); String customer = reqXml.SelectSingleNode("//ns:QueryText",ns).InnerText; String xml; xml = "<?xml version=\"1.0\"?>\n" +"<ResponsePacket " +" xmlns=\"urn:Microsoft.Search.Response\" revision=\"1\">" +" <Response domain=\"{2A6DC8C8-4D9A-4185-A889-FDE1125FF4B3}\">" +" <Range>" +" <Results>" +" <Content" +" xmlns=\"urn:Microsoft.Search.Response.Content\">" +" <P>"+Customer.GetInfo(customer)+"</P>" +" </Content>" +" </Results>" +" </Range>" +" <Status>SUCCESS</Status>" +" </Response>" +"</ResponsePacket>"; return xml; } public class Customer { public static String GetInfo(String customer) { return "Hello "+customer; // For Real World Scenario, get actual // customer details from a CRM/ERP package } } } Another similar capability for developers in Office 2003 is Smart Tags. However, Smart Tags are activated on an Office document while the document is being authored as a drop down and require no separate Research pane to be opened. Smart Tags were introduced in Office XP and have been enhanced in Office 2003. However, .NET programming can be used to create Smart Tags for Office using COM interoperability with Office APIs. |