- Client communicates to UDI node to retrieve a list of available web services that the client has access to.
- Every service listed has a URI pointing to the service's DISCO or WSDL document, which is needed to access the webservice and its 'webmethod" methods.
- After interpreting the DISCO document, follow the URI for the WSDL document related to the chosen webservice.
- Client then adds and parses the WSDL document and creates a proxy object which can then communicate with Webservice and access its "webmethod" methods.
Explain the steps to create a web services and consume it.
Steps to create and consume a webservice
Creation:
- a. Create a new website by selecting "ASP.NET Web Site" and giving it a suitable name.
- b. service.cs file appears inside the solution with a default webmethod named as "HelloWorld()"
- c. Right click on the webservice project and add a web reference instead of adding a normal reference.
- d. A window appears that displays a list of webservices knows to the solution.
- e. Click on "Webservices in this solution"
- f. a search progress bar appears and
- g. Select the service that appears in the list
- h. progress bar appears once again.
- i. web method appears on the screen
- j. Click on "Add reference" button. This would add localhost
- k. solution would have App_WebReference folder
Consumption or Usage:
- a. Add a UI (.aspx) to the webservice project
- b. Add a button and a label to the form
- c. Double click the button to see the click event of the button
- d. Create an object of type service localhost.serviceName
- e. Write code to display the value returned by the webmethod on the label
- f. Execute the solution by setting the added aspx as the startpage.
- g. click on the button and the message "Hello World" would be displayed on the label

0 Comments:
Post a Comment