Deploy and Publish Web Service

3,930 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,930
On SlideShare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
31
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Deploy and Publish Web Service

  1. 1. How to Deploy and Publish a Web Service L 3 SSON
  2. 2. <ul><li>Use DISCOvery file to publish a list of web services. </li></ul><ul><li>Build & Deploy a web service apps. </li></ul>utline
  3. 3. DISCOvery File Web Service Discovery language, or DISCO, is Microsoft's XML grammar for describing the location of information about existing web services. How 2 Generate a Discovery File ? http://localhost:<portnumber>/MyWebService/MyWebService.asmx ? DISCO http://localhost/Webservice/Addservice.asmx? DISCO ? DISCO Automatically generated , when we add Web reference to our Web service. DISCOvery file is placed in App_WebReferences
  4. 4. Static Discovery File ( .disco) Create your own XML-based discovery file that can reference more than one Web service. <ul><li><?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?> </li></ul><ul><ul><ul><ul><ul><li><discovery xmlsns=&quot;http://schemas.xmlsoap.org/disco/&quot;> </li></ul></ul></ul></ul></ul><ul><li></discovery> </li></ul>Should contain references to Service descriptions XSD and Any other discovery documents <ul><li>Can add as many references </li></ul><ul><li>Can refer to more than one Web Service's </li></ul>
  5. 5. Dynamic Discovery File ( .vsdisco) WHEN TO USE ? All the Web Service on the web server discoverable. HOW TO ENABLE ? Include an add element in the httpHandlers section of your Machine.config file on the Web server. <add verb=&quot;*&quot; path=&quot;.vsdicso&quot; type=&quot;System.Web.Services.Discovery.DiscoveryRequestHandler,System.Web.Services, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&quot; validate=&quot;false&quot;/>
  6. 6. SECURITY RISK
  7. 7. Steps to create a simple web service w ithout devenv & inetmgr
  8. 8. Creating a Simple Web Service <ul><li>Create a folder named Webservice under wwwroot. </li></ul><ul><li>Create a File <%@ WebService Language=&quot;c#&quot; Class=&quot;AddNumbers&quot;%> using System; using System.Web.Services; public class AddNumbers : WebService { [WebMethod] public int Add(int a, int b) { int sum; sum = a + b; return sum; } } </li></ul><ul><li>Save this file as AddService.asmx </li></ul><ul><li>Now the webservice is created and ready for the clients to use it. </li></ul><ul><li>Now we can call this webservice using http://ip address/Webservice/Addservice.asmx/Add?a=10&b=5 </li></ul>
  9. 9. Deploying the Web Service <ul><li>At the command prompt: WSDL http://ip address ofthe site/WebService/MathService.asmx /n:NameSp /out:FileName.cs This will create a file called FileName.cs. WSDL -> WebServices Description Language (This is an application available at C:Program  FilesMicrosoft.NETFrameworkSDKBin) NameSp -> Name of the NameSpace which will be used in client code for deploying the webservice. </li></ul><ul><li>Compilation CSC /t:library /r:system.web.dll /r:system.xml.dll CreatedFile.cs This will create a dll with the name of the public class of the asmx file.(In our case,  it is &quot;AddNumbers.dll&quot;). CSC is an application available at C:WINNTMicrosoft.NETFrameworkv1.0.2914 </li></ul><ul><li>Put the dll file inside WWWRooTBIN [Create a BIN Folder in WWWRoot]. </li></ul>
  10. 10. Q & A

×