| Download XemanteX's web services free* | |
| Get XemanteXized (Xe-man-ta-sized) Do you want your users to clearly understand the web content you presented? Do you intend to make your web site a cool-place and enjoyable stop for your users? Web publishers like you spend googols of money to make their text intelligible. They want their users to be satisfied readers when they leave the web site. Are you one of those? If so, get XemanteXized! What is “getting XemanteXized”? To get XemanteXized is to be able to get the same effects of XemanteX on your website. It is allowing your users to obtain reading help by a simple click of mouse. It means making your web content more readable and more user-friendly by downloading web services (what are web services?) from XemanteX. Getting Started You will be able to present your web content in a more readable fashion with the same effects as seen on XemanteX when you follow these three steps: Before you can go further please make sure you satisfy these requirements: 1) That you have a web site that is developed using .NET. 2) That you intend to use XemanteX web services for personal and non-profit purposes only. 3) That you have basic knowledge in web development. If you satisfy ALL the above requirements, please go through these three easy steps to get XemanteX web services: 1) Register with XemanteX and obtain a unique key. 2) Download XemanteX web services file. 3) Add few lines of script and a proxy server (.asmx file) to your web site. Register, and download Step 1: Register with XemanteX. This process presents you with a unique key that's used to access XemanteX web services. The unique key will be sent to the e-mail that you entered in the registration form. Registration is easy and free. Please click here to register. Step 2: Download XemanteX web service file. Once you have a unique key, download this DLL file: getXmxDictHelp.dll. Save this file to the bin folder of your web site (where all the references for your web site exist). For example, if your web site is called “myWebSite”, save getXmxDictHelp.dll in the bin folder at the this C:\Inetpub\wwwroot\myWebsite\bin. Step 3: Add few lines of script and a proxy server (.asmx file) to your web site. This step is further divided into 3 steps. a) Copy the HTC file into the web form project folder. b) Write script using JavaScript to access web service using WebService behavior. c) Modify HTML on the client’s web page to handle the double click event. d) Create a proxy server for the web service. Step a: Copy the HTC file into the web form project folder here: http://msdn.microsoft.com/downloads/samples/internet/behaviors/library/webservice/default.asp WebService behavior enables to make a method call to a web service using a scripted language. It is a reusable DHTML component that uses web services by communicating over HTTP using SOAP (Src: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/webservice/overview.asp). Please read the documentation on WebService behavior at the link provided above. In short, remember that this behavior is to make calls to a web service from client using scripted language. Moreover, this behavior is encapsulated in a HTC (HTML component) file. Thus, in order to use WebService behavior we need to have the HTC file in the project’s folder. To use the behavior in our consumeWebSvcDateTime.aspx page, download the WebService HTC File and copy it to your web form project’s folder. You will be able to download HTC file at this link: http://msdn.microsoft.com/downloads/samples/internet/behaviors/library/webservice/default.asp Step b: To invoke XemanteX’s web service method(s), attach the WebService.HTC file to a (or any other valid element) DIV element in client web page as shown below. <DIV id="xmxWbSvc" style="BEHAVIOR: url(webservice.htc)"></DIV>Add the following script to the web page to enable use of WebService behavior and make calls to web services. <SCRIPT language="JavaScript">
function initWebHTC()
{
//init and create short-cut name for web service
xmxWbSvc.useService("xmxClientDictWebSvc.asmx?WSDL","wNmSvc");
}
function selectWordNew()
{
sendWord(document.selection.createRange().text);
}
function sendWord(ltext)
{
var iCallID;
if (xmxWbSvc.wNmSvc)
{
document.getElementById("lblMeaning").innerHTML="Loading...."
iCallID= xmxWbSvc.wNmSvc.callService(gtMngRslt,"getXmxWordHelp",ltext);
}
}
function gtMngRslt(result)
{
//if an error then get error details
if(result.error)
{
//Pull error info from event.result.errorDetail properties
var xfaultcode = result.errorDetail.code;
var xfaultstring = result.errorDetail.string;
var xfaultsoap = result.errorDetail.raw;
// Add code to handle specific error codes here
document.getElementById("lblMeaning").innerHTML="Error: " + xfaultcode + " & _
" ; " + xfaultstring + " ; " + xfaultsoap;
}
else
{
//alert(result.value);
document.getElementById("lblMeaning").innerHTML=result.value;
//clear any selection
var sRng;
sRng = document.selection.createRange();
sRng.execCommand("unselect");
}
}
</SCRIPT>
Step c: Modify HTML on the web page to handle the double click event. <body onload=” initWebHTC()” ondblclick=" selectWordNew ();">Step d: Create a proxy server for the web service. In order to call a web method we need a proxy server. What is a proxy server? A client cannot call the web methods that are located on a remote web server directly. Instead, it has to route the web method calls from the local web server. Create an .asmx file (call it xmxClientDictWebSvc.asmx) in the project where your client page(s) exist(s). Add the following code in this .asmx file: <WebMethod()> Public Function getXmxWordHelp(ByVal selectedWord As String) As String
Dim xmxMainWebSvc As New svcXmxMeaning 'instantiate xmx web svc
Dim uniqueKeyStr As String 'send credentials to srvr
uniqueKeyStr = "ABCDEFGHIJKLMNOP" ’your 16-CHAR unique key
Dim wordMeaning As String
wordMeaning = xmxMainWebSvc.getXmxWordHelp(selectedWord, uniqueKeyStr) 'call it svc
Return wordMeaning
End Function
Finalize.. That is it. You have everything in place. You have the web page as a client to consume the web service. You also have a “proxy” web service for your client. Fire up your project in the browser and double click on any word on the page to see results from the web service – test the web service here. There may be an error from the client saying that the “service unavailable”. This happens when the client could not connect to the remote web service. This error occurs if you do not have an .HTC file or if you mistyped the name of the proxy server’s web method and other related reasons. Write to me if you have such a case and we will see how to proceed. Questions and Comments Please feel free to contact XemanteX at team@xemantex.com for any further inquires, questions and comments. |
|
| * For personal, non-profit, and non-commercial purposes only. | |
| Home | About XemanteX | Services & Using XemanteX | Contact XemanteX | Terms of Use | Privacy Policy | |
| Copyright © 2002-2003 XEMANTEX INC. All rights reserved. | |