Archive
Create XSD from XML file
I recently required to generate XSD file from XML file,
To accomplish this i used built in tool provided in Visual studio itself,
What you need to do is open your xml file, as you open xml file IDE will show up with new option tab available to generate xsd file option.
Also you can do this from command prompt, there is a xsd.exe file located at
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin or C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin,
set this path to command prompt then you can set any below option and it will generate xsd file,
xsd.exe <schema>.xsd /classes|dataset [/e:] [/l:] [/n:] [/o:] [/s] [/uri:]
xsd.exe <assembly>.dll|.exe [/outputdir:] [/type: […]]
xsd.exe <instance>.xml [/outputdir:]
xsd.exe <schema>.xdr [/outputdir:]
Reference: here
Consume web service from client side/javascript
In many scenarios of web application development we come across the point when we need to call some web service from client side or by javascript,
The ASP.NET 2.0 AJAX Extensions enable this exact same experience of seamless proxy generation for Web services for client-side JavaScript that will run in the browser.
You can author an .asmx file hosted on your server and make calls to methods on that service through a client-side JavaScript class. For example, Figure 1 shows a simple .asmx service that implements a faux stock quote retrieval (with random data).
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. <strong>[System.Web.Script.Services.ScriptService] //This is the line used to enable web service from client side</strong> public class Service : System.Web.Services.WebService { public Service () { //Uncomment the following line if using designed components</div> //InitializeComponent(); } [WebMethod] public string HelloWorld() { return "Hello World"; } } <div><code>
<div> <div><script type="text/javascript"></div> <div>function onclick1() {</div> <div>WebService.HelloWorld(OnLookupComplete);</div> <div>}</div> <div>function OnLookupComplete(result) {</div> <div>var res = document.getElementById("_resultLabel");</div> <div>res.innerHTML = "<b>" + result + "</b>";</div> <div>}</div> <div></script></div> </div>