Designing Your Own Reporting Service: A Web Service to Convert XML to HTML Using XSL - Developing the XML Web Service
(Page 2 of 7 )
Create a new Web Service project (with respect to C#) using Visual Studio.NET 2003 Enterprise Architect and make modifications to your “web.config” file as follows:
<?xml version="1.0" encoding="utf-8" ?>
<add key="XSLLocation" value="c:\inetpub\wwwroot\WSXML2HTML\
Open your “XML2HTML.asmx.cs” (I renamed “Service1.*” to “XML2HTML.*”) and make modifications to your service as follows.
Before proceeding further, you need to remove (or comment) all the statements related to the “HelloWorld” method (as it is intended only for demonstration).
Start with a new method “BuildHTMLString” as follows:
[WebMethod(Description="Builds an HTML string from XML.")]
public string BuildHTMLString(string XML)
Within the above method, no processing really exists. Let us add one more method as follows:
private string GetXSLLocation()
//Get XSL location from config file
string sXSLLocation = ConfigurationSettings.AppSettings.Get("XSLLocation");
The above method simply gets the XSL file path available within the “web.config” file.
blog comments powered by