Consume Calculator Service

Welcome to the part-2 of WCF…Run your service and copy the address which is available in WCF Test Client which is shown as:
Now create a new console Application as shown:
Right Click References in Solution and select Add Service Reference which populates a new window with entries as Address where you need to paste the address of your Calculator service which was copied in Very first step then click GO button and give a name to it as shown:
Serviceref Click on OK..Now client console application have a proxy service in it..just create a object of it then access its operation contracts by supplying required parameter values and get the result..sample of such code is shown as: code Just press Clrl+F5 then supply the values..

the final output would be as shown:



Now the same Calculator service we now going to consume in windows Application..

1. Create new windows application using C# language and name as Windows_Calculator.

2. Add service reference by right click on  solution and paste the URL of the service in Address bar as we did in console application above in two images and press discover button.

3. create the service_reference object and access their methods and code as shown in below image:


one thing we need to observe here is that we are not at all writing any logic code here in consuming clients because all logic is written in service and we just pass appropriate input and retrieve the results.The output of the above windows application would be as:


Hope would be helpful for anyone atleast…


Testing Webservice using Visual studio 2010 SoapUI

Assalamualaykum Wr Br…
SoapUI is a powerful tool to interact with webservices,WCF RESTFul and many other services. In our previous post we have implemented Calculator WCF service which we tested using Visual Studio Integrated Tool named WCF TEST Client. Now the same tool yet with high features is SoapUI. The following screen shows how soapUI looks like:
Now click the file from main menu->New Generic Project, the following screen appears:
Specify the Project Name as “Calci” and Initial WSDL/WADL: here paste the base address from the WCF_Calculator service and append “?wsdl” as shown in above image. Then click OK that results a new appearance as shown. Please Note that the WCF service needs to be running.
Now specify the inputs to ADD method of WCF service to SoapUI for processing the result in ? and ? replace ? with values as shown in above figure and the click the play button which process the inputs and displays the result in response window adjacent to it.
Thaks alot…Will update you with lot of stuff in upcoming posts till the have a Good Day….

All is well

Sample Crystal Report in VS2010

Hi We explore sample crystal report creation in visual studio 2010 using C# start first from database. I create a sample database by name Department and a table named Clg.In this table i have tuples as ID, Dept_name and HOD with 4 records.We display the entire table data as a report.
1. Now create an empty new web-project with name as Sample_crystal.
2. Add a webform named as webform1.aspx and add crystalreport which populates a wizard select Standard report and blank report then click ok.
3. Drag-drop the dataset1.xsd from toolbox and on which drop clg table from server explorer.
4. Drag-drop the crystalreportviewer on to the webform and in page_load event add the code as::
protected void Page_Load(object sender, EventArgs e)
SqlConnection con = new SqlConnection(“Data Source=.\\sqlexpress;Initial Catalog=departmetn;Integrated Security=True;Pooling=False”);
SqlDataAdapter da=new SqlDataAdapter(“select * from clg”,con);
DataSet ds=new DataSet();
CrystalReport1 o = new CrystalReport1();
5. click the field explorer (just as toolbox,server explorer) @ crystalreport.rpt screen select Database fields–>database expert then select our dataset.
6. Expand the database Fields and drag-drop the columns of table on the crystal report Section 3(Details).
Run the application which yields the exact report from database.