Simple program using WCF _example

              Here we are discussing about how to write a small program using wcf service.  For this we are going to write a small program.  In that we are creating an application which will return ‘SUM’ as the result  and it using the wcf web service to get the added result .

 In the above webpage we can enter the two values and when clicking on the button it will return the result .

We can read the two values by



Now we have to add a new wcf project to calculate the sum . we can use the wcf to read data from the databases also .


 Now we have to select the wcf service 

write the method that you want , in the interface file .



Implement those method in the svc file . Write the operations that you need to do . 





we have to select the url of the service  from the address bar , so we have to see the service in a browser , so use that option . 



select the URL from the address bar




Now we have to create a service reference in the project from which we are invoking the service . So we have to select the Add service Reference option from the reference . We have to create service reference in the project from which we are invoking the service . 


Paste the URL in the URL field and click on the Go button , you can give a different name for the service reference . 


         We can use the class name of the client class , which inherits our methods for the object creation. We can take the name of the class from the reference file . 

create object for the client class and access the corresponding add method with use of the object . 



We can see the output like below




Comments

Popular posts from this blog

Introduction To Oracle10g

Insert

Except