tag:blogger.com,1999:blog-84329095980619064452024-03-14T00:55:25.225-07:00WCF Study MaterialFor WCF Class Room Training send me mail at malhotra.isha3388@gmail.comAnonymoushttp://www.blogger.com/profile/08203366298489829818noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-8432909598061906445.post-7627991034080313682013-10-14T07:24:00.000-07:002013-10-14T07:45:10.522-07:00Message Security using Certificate Client Credential in WCF<div dir="ltr" style="text-align: left;" trbidi="on">
<div align="center" class="MsoNormal" style="text-align: center;">
<b><u><span style="font-size: 26.0pt; line-height: 115%;">Message Security
using Certificate Client Credential in WCF<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">In this
article I am explaining how to achieve message security using certificate
client credential. In my last article I described the <a href="http://isha-wcf.blogspot.in/2013/07/message-security-in-wcf-using-username.html" target="_blank">message security using user name client credential</a>.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Following
are the steps to implement message security using Certificate Client
Credential:-<o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span style="font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span style="font-size: 14.0pt; line-height: 115%;">Step 1:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Go to the
IIS Server by typing inetmgr in run<o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span style="font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span style="font-size: 14.0pt; line-height: 115%;">Step 2:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Click on
server certificate<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-no-proof: yes;"><v:shapetype coordsize="21600,21600" filled="f" id="_x0000_t75" o:preferrelative="t" o:spt="75" path="m@4@5l@4@11@9@11@9@5xe" stroked="f">
<v:stroke joinstyle="miter">
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0">
<v:f eqn="sum @0 1 0">
<v:f eqn="sum 0 0 @1">
<v:f eqn="prod @2 1 2">
<v:f eqn="prod @3 21600 pixelWidth">
<v:f eqn="prod @3 21600 pixelHeight">
<v:f eqn="sum @0 0 1">
<v:f eqn="prod @6 1 2">
<v:f eqn="prod @7 21600 pixelWidth">
<v:f eqn="sum @8 21600 0">
<v:f eqn="prod @7 21600 pixelHeight">
<v:f eqn="sum @10 21600 0">
</v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:formulas>
<v:path gradientshapeok="t" o:connecttype="rect" o:extrusionok="f">
<o:lock aspectratio="t" v:ext="edit">
</o:lock></v:path></v:stroke></v:shapetype><v:shape id="Picture_x0020_5" o:spid="_x0000_i1032" style="height: 203.25pt; mso-wrap-style: square; visibility: visible; width: 451.5pt;" type="#_x0000_t75">
<v:imagedata o:title="certi-1" src="file:///C:\Users\Isha\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png">
</v:imagedata></v:shape></span><span style="font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAj4Ni8YA6t_pcz1-h_QAD7rPuK4YHADqrXyzUrtJpXe2eNtUPs9QLYxtzDnm0MqaPQw34ctqnbpwluZt4z83iVtYCU7AadZBaDmYLgPNyp9XHIlb4Md0hAKEP2_gYiJYDu0uounTqj8A/s1600/certi-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="288" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAj4Ni8YA6t_pcz1-h_QAD7rPuK4YHADqrXyzUrtJpXe2eNtUPs9QLYxtzDnm0MqaPQw34ctqnbpwluZt4z83iVtYCU7AadZBaDmYLgPNyp9XHIlb4Md0hAKEP2_gYiJYDu0uounTqj8A/s640/certi-1.png" width="640" /></a></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Figure 1<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><u><span style="font-size: 14.0pt; line-height: 115%;">Step 3:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">After
opening the server certificate on right panel select the create self-signed
certificate<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-no-proof: yes;"><v:shape id="_x0000_i1031" style="height: 194.25pt; mso-wrap-style: square; visibility: visible; width: 264.75pt;" type="#_x0000_t75">
<v:imagedata o:title="certi-2" src="file:///C:\Users\Isha\AppData\Local\Temp\msohtmlclip1\01\clip_image002.png">
</v:imagedata></v:shape></span><span style="font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhW4i4BUzYPovq05QxTYFFx4mPiwfGB-3YDETAF_ZnraQ6WK5y13ZQg-Tjr9I4hPLmDyVSSpzcsYZcnqngdfu9Nmuqc6Yqv5egSXw3CZ-Og09OFTPMVni-YC89BeazrN0AzDWYz2O76-Sc/s1600/certi-2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="468" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhW4i4BUzYPovq05QxTYFFx4mPiwfGB-3YDETAF_ZnraQ6WK5y13ZQg-Tjr9I4hPLmDyVSSpzcsYZcnqngdfu9Nmuqc6Yqv5egSXw3CZ-Og09OFTPMVni-YC89BeazrN0AzDWYz2O76-Sc/s640/certi-2.png" width="640" /></a></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Figure 2<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Now
certificate creation window will be opened. Give a proper name to the
certificate and click ok.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"></span></div>
<a name='more'></a><br />
<br />
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-no-proof: yes;"><v:shape id="Picture_x0020_6" o:spid="_x0000_i1030" style="height: 218.25pt; mso-wrap-style: square; visibility: visible; width: 450.75pt;" type="#_x0000_t75">
<v:imagedata o:title="certi-3" src="file:///C:\Users\Isha\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png">
</v:imagedata></v:shape></span><span style="font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7u0h4fPg_T2WG70pKLZMweaQO0gMM4wZ5kDPydPhuArAB6a2m0_cppdhMYi_o-URbxolq1rFdhgWtEuGqoQ6UQHz4tun4599xzHoIAzyswFHiP2b3XEitFJk_Mx8Oq_JcP4aVwRhZLqM/s1600/certi-3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="486" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7u0h4fPg_T2WG70pKLZMweaQO0gMM4wZ5kDPydPhuArAB6a2m0_cppdhMYi_o-URbxolq1rFdhgWtEuGqoQ6UQHz4tun4599xzHoIAzyswFHiP2b3XEitFJk_Mx8Oq_JcP4aVwRhZLqM/s640/certi-3.png" width="640" /></a></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Figure 3<o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span style="font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span style="font-size: 14.0pt; line-height: 115%;">Step 4:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14pt; line-height: 115%;">Now create a
WCF service. Go to visual studio->New->Website->Wcf Service</span></div>
<div class="MsoNormal">
<b><u><span style="font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span style="font-size: 14.0pt; line-height: 115%;">Step 5:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Make changes
in your web configuration file.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Add
following binding tag in system.sevicemodel tag. In binding tag add message
security and client credential as certificate<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"><</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">bindings</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">wsHttpBinding</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">binding</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">security</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">mode</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">Message</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">message</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">clientCredentialType</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">Certificate</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">message</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">security</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">binding</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">wsHttpBinding</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;"> </</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">bindings</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">></span><span style="color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: medium;"><span style="line-height: 115%;">now add </span></span><span style="color: blue; font-family: Consolas;"><span style="font-size: 19px; line-height: 21px;">behavior</span></span><span style="color: blue; font-family: Consolas; font-size: medium;"><span style="line-height: 115%;"> tag inside the service </span><span style="line-height: 20px;">behavior</span><span style="line-height: 115%;"> tag and
the certificate detail in it which you have created on IIS in the beginning.<o:p></o:p></span></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"><</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">behaviors</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">serviceBehaviors</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">behavior</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <b><</b></span><b><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">serviceCredentials</span></b><b><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span></b><b><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span></b><b><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">serviceCertificate</span></b><b><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span></b><b><span style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">storeLocation</span></b><b><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span></b><b><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span></b><b><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">LocalMachine</span></b><b><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span></b><b><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span></b><b><span style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">findValue</span></b><b><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span></b><b><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span></b><b><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">isha</span></b><b><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span></b><b><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span></b><b><span style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">storeName</span></b><b><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span></b><b><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span></b><b><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">My</span></b><b><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span></b><b><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span></b><b><span style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">x509FindType</span></b><b><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span></b><b><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span></b><b><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">FindByIssuerName</span></b><b><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span></b><b><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">/></span></b><b><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">
</</span></b><b><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">serviceCredentials</span></b><b><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span></b><b><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <!--</span><span style="background: white; color: green; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">
To avoid disclosing metadata information, set the values below to false before
deployment </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">--></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">serviceMetadata</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">httpGetEnabled</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">true</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">httpsGetEnabled</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">true</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">/></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <!--</span><span style="background: white; color: green; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">
To receive exception details in faults for debugging purposes, set the value
below to true. Set to false before
deployment to avoid disclosing exception information </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">--></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">serviceDebug</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">includeExceptionDetailInFaults</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">false</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">/></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">behavior</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">serviceBehaviors</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;"> </</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">behaviors</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">></span><span style="font-size: 14.0pt; line-height: 115%;"> </span><span style="color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Now add
service tag <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"><</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">services</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">service</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">name</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">Service</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">endpoint</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">address</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">""</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">binding</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">wsHttpBinding</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">contract</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">IService</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">/></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">service</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;"> </</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">services</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">></span><span style="color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 14.0pt; line-height: 115%;">Now execute the program and you will the get following window:-<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-no-proof: yes;"><v:shape id="Picture_x0020_7" o:spid="_x0000_i1029" style="height: 207pt; mso-wrap-style: square; visibility: visible; width: 393pt;" type="#_x0000_t75">
<v:imagedata o:title="certi-4" src="file:///C:\Users\Isha\AppData\Local\Temp\msohtmlclip1\01\clip_image004.png">
</v:imagedata></v:shape></span><span style="font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgo5O38OcKhEiITZ72JRmS_Rqj_crLKZuu2RqG2LYdPwwE58_xPGo6wStwpgbldplgtcbkV4vefj4yYLKlz-U6RZ3wCtsQBHEvsChHPUrbd83olcyq0bnpyxfB1ts-lNQJo0ICyVTY3EVQ/s1600/certi-4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="336" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgo5O38OcKhEiITZ72JRmS_Rqj_crLKZuu2RqG2LYdPwwE58_xPGo6wStwpgbldplgtcbkV4vefj4yYLKlz-U6RZ3wCtsQBHEvsChHPUrbd83olcyq0bnpyxfB1ts-lNQJo0ICyVTY3EVQ/s640/certi-4.png" width="640" /></a></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Figure 4<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Now create
the client and add service reference and pass client credential with all the
detail of certificate.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> System;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> System.Collections.Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> System.Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> System.Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> System.Web.UI;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> System.Web.UI.WebControls;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">public</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">partial</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">class</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">_Default</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> : System.Web.UI.</span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">Page</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">protected</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">void</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> Page_Load(</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">object</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> sender, </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">EventArgs</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> e)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> ServiceReference1.</span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">ServiceClient</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> svc = </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">new</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> ServiceReference1.</span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">ServiceClient</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">
svc.ClientCredentials.ClientCertificate.SetCertificate(System.Security.Cryptography.X509Certificates.</span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">StoreLocation</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">.LocalMachine,
System.Security.Cryptography.X509Certificates.</span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">StoreName</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">.My, System.Security.Cryptography.X509Certificates.</span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">X509FindType</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">.FindByIssuerName,
</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">"isha"</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> Response.Write(svc.GetData());<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt; line-height: 115%;">}</span><span style="font-family: Consolas; font-size: 14pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 14pt; line-height: 115%;">Now execute the code and you will get following output<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 14pt; line-height: 115%;">(I simply return string from service to the client)<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-no-proof: yes;"><v:shape id="Picture_x0020_8" o:spid="_x0000_i1028" style="height: 78.75pt; mso-wrap-style: square; visibility: visible; width: 253.5pt;" type="#_x0000_t75">
<v:imagedata o:title="certi-5" src="file:///C:\Users\Isha\AppData\Local\Temp\msohtmlclip1\01\clip_image005.png">
</v:imagedata></v:shape></span><span style="font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1IEEbL3ygzgK46aRmdDH5eYmMpAXL4yIEc0kjazS05IawF6ugh0CdaoemYJgEoQvU_jXD0qAo7t7K5zXsE2kgPOz7jXz6k4PHGtmfMcs-aojLMmt-WbJ68iBFgivSxCY1j1UquzN65Dc/s1600/certi-5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="198" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1IEEbL3ygzgK46aRmdDH5eYmMpAXL4yIEc0kjazS05IawF6ugh0CdaoemYJgEoQvU_jXD0qAo7t7K5zXsE2kgPOz7jXz6k4PHGtmfMcs-aojLMmt-WbJ68iBFgivSxCY1j1UquzN65Dc/s640/certi-5.png" width="640" /></a></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Figure 5<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-size: 19px; line-height: 21px;">if you find any problem to run this code kindly mail me your error at malhotra.isha3388@gmail.com</span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoListParagraph">
<br /></div>
<br />
<div class="MsoNormal">
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/08203366298489829818noreply@blogger.com12tag:blogger.com,1999:blog-8432909598061906445.post-50753707225007229732013-10-08T12:55:00.001-07:002013-10-08T12:55:48.856-07:00Duplex Message Exchange Pattern in WCF with Example<div dir="ltr" style="text-align: left;" trbidi="on">
<div align="center" class="MsoNormal" style="text-align: center;">
<b><u><span style="font-size: 20.0pt; line-height: 115%;">Duplex Message
Exchange Pattern in WCF<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Duplex message
exchange pattern is a way in WCF in which client and service both can send
messages to each other independently. Duplex message exchange pattern also
known as callback.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">As both
client and service need to be connected to exchange messages this patter is
quite complicated and slower than other message exchange pattern.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">To implement
the duplex we have to create the separate interface and we have to create
method which can be either request-reply or one way type.<o:p></o:p></span></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b><u><span style="font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b><u><span style="font-size: 14.0pt; line-height: 115%;">Following are the
steps to implement duplex service in wcf:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<b><u><span style="font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span style="font-size: 14.0pt; line-height: 115%;">Step 1:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Open the
visual studio->File->New->Website->WcfService<o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span style="font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span style="font-size: 14.0pt; line-height: 115%;">Step 2:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Create
interface which you use to call back from service to the client:-<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">[</span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">ServiceContract</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">public</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">interface</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">IDuplexCheck</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> [</span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">OperationContract</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">(IsOneWay=</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">true</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">)]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">void</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> showstatus(</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">string</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> res);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt; line-height: 115%;">}</span><span style="font-family: Consolas; font-size: 14pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span style="font-family: Consolas; font-size: 14pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span style="font-family: Consolas; font-size: 14pt; line-height: 115%;">Step
3:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 14pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 14pt; line-height: 115%;">Create the interface for the service in which you define
your operation:-<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">[</span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">ServiceContract</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">(CallbackContract=</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">typeof</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">(</span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">IDuplexCheck</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">))]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">public</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">interface</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">IService</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: green; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">//IsOneWay=False
represents the duplex communication</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> [</span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">OperationContract</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">(IsOneWay=</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">false</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">)]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">void</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> dataupdated(); <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt; line-height: 115%;">}</span><span style="font-family: Consolas; font-size: 14pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"></span></div>
<a name='more'></a><br /><br />
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">To implement
the call back or duplex service we have to set IsOneWay=True which defines the
duplex. Apart from this add callbackContract
with interface which you defined for call back.<o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span style="font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span style="font-size: 14.0pt; line-height: 115%;">Step 4:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Now
implement this interface into your service and inside the method create the
instance of callback interface. And call your method which interacts with
client during the code execution.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">In this
example I declared showstatus method in which I am simply passing the following
message and put this method into loop which executes 3 times.<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">public</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">class</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">Service</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> : </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">IService</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">public</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">void</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> dataupdated()<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">for</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> (</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">int</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> x = 0; x < 3; x++)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">IDuplexCheck</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> idc = </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">OperationContext</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">.Current.GetCallbackChannel<</span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">IDuplexCheck</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">>();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> idc.showstatus(</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">"Call back request from Service "</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">+x+</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">" Time"</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt; line-height: 115%;">}</span><span style="font-family: Consolas; font-size: 14pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span style="font-family: Consolas; font-size: 14pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span style="font-family: Consolas; font-size: 14pt; line-height: 115%;">Step
5:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 14pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 14pt; line-height: 115%;">To implement the duplex service we have to implement the
wsDualHttpBinding in the following manner:-<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"><</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">services</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">service</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">name</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">Service</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">endpoint</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">address</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">""</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">binding</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">wsDualHttpBinding</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">contract</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">IService</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">/></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">service</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;"> </</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">services</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">></span><span style="color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%;">Now execute the code <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-no-proof: yes;"><v:shapetype coordsize="21600,21600" filled="f" id="_x0000_t75" o:preferrelative="t" o:spt="75" path="m@4@5l@4@11@9@11@9@5xe" stroked="f">
<v:stroke joinstyle="miter">
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0">
<v:f eqn="sum @0 1 0">
<v:f eqn="sum 0 0 @1">
<v:f eqn="prod @2 1 2">
<v:f eqn="prod @3 21600 pixelWidth">
<v:f eqn="prod @3 21600 pixelHeight">
<v:f eqn="sum @0 0 1">
<v:f eqn="prod @6 1 2">
<v:f eqn="prod @7 21600 pixelWidth">
<v:f eqn="sum @8 21600 0">
<v:f eqn="prod @7 21600 pixelHeight">
<v:f eqn="sum @10 21600 0">
</v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:formulas>
<v:path gradientshapeok="t" o:connecttype="rect" o:extrusionok="f">
<o:lock aspectratio="t" v:ext="edit">
</o:lock></v:path></v:stroke></v:shapetype><v:shape id="Picture_x0020_12" o:spid="_x0000_i1029" style="height: 299.25pt; mso-wrap-style: square; visibility: visible; width: 450.75pt;" type="#_x0000_t75">
<v:imagedata o:title="dup-1" src="file:///C:\Users\Isha\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png">
</v:imagedata></v:shape></span><span style="font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWmkPpXm9NA3Gejo94nxJLCR1kESbBP5ig7RANjbP8vEyBN5_cx_-zL0o9wgsEDKmDbm5Ud4xaogfmZCJXi5eAQ3-V4y79F3MZMuCfGsnEE1jCKyj2PPD1QSUxE7TQgVQxPQREfDgWEBY/s1600/dup-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="424" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWmkPpXm9NA3Gejo94nxJLCR1kESbBP5ig7RANjbP8vEyBN5_cx_-zL0o9wgsEDKmDbm5Ud4xaogfmZCJXi5eAQ3-V4y79F3MZMuCfGsnEE1jCKyj2PPD1QSUxE7TQgVQxPQREfDgWEBY/s640/dup-1.png" width="640" /></a></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Figure 1<o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span style="font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span style="font-size: 14.0pt; line-height: 115%;">Step 6:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Now add
service reference at your client side. At client side we have to implement
IServiceCallBack interface which represent the interface we created at the
service to achieve the call back functionality. And implement the method which
we declared in that interface. The input parameter which we are using actually
the result of service.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> System;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> System.Collections.Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> System.Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> System.Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> System.Web.UI;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> System.Web.UI.WebControls;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> System.ServiceModel;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">public</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">partial</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">class</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">_Default</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> : System.Web.UI.</span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">Page</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">,ServiceReference1.</span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">IServiceCallback</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">protected</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">void</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> Page_Load(</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">object</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> sender, </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">EventArgs</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> e)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">if</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> (!IsPostBack)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">InstanceContext</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> ic = </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">new</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">InstanceContext</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">(</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">this</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> ServiceReference1.</span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">ServiceClient</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> svc = </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">new</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> ServiceReference1.</span><span style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">ServiceClient</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">(ic);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> svc.dataupdated();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: green; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">//implementation
of method which declared at Service Level in IDuplexCheck interface</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">public</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">void</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> showstatus(</span><span style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">string</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> res)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> Label1.Text = Label1.Text+ res+</span><span style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">"<br/>"</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt; line-height: 115%;">}</span><span style="font-family: Consolas; font-size: 14pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Consolas; font-size: 14pt; line-height: 115%;">The output of this code is as follows:-<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-no-proof: yes;"><v:shape id="_x0000_i1028" style="height: 97.5pt; mso-wrap-style: square; visibility: visible; width: 236.25pt;" type="#_x0000_t75">
<v:imagedata o:title="dup-2" src="file:///C:\Users\Isha\AppData\Local\Temp\msohtmlclip1\01\clip_image002.png">
</v:imagedata></v:shape></span><span style="font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaEhJLtm_ET_i7Ryvr-e1X1sCqK0XBGDzdPJYnuM9t8g-051gjfpf_O1p-QQBSCxaxuwDpP-SQ6dCpk6zu7_TxQ2HCJV_J1i9urflhpbnknEoJdgOsfO0A5iZLPQGqQrJEFFapgqfJEL4/s1600/dup-2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="264" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaEhJLtm_ET_i7Ryvr-e1X1sCqK0XBGDzdPJYnuM9t8g-051gjfpf_O1p-QQBSCxaxuwDpP-SQ6dCpk6zu7_TxQ2HCJV_J1i9urflhpbnknEoJdgOsfO0A5iZLPQGqQrJEFFapgqfJEL4/s640/dup-2.png" width="640" /></a></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">Figure 2<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%;">for any query send mail at info@techaltum.com</span></div>
<br />
<div class="MsoNormal">
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/08203366298489829818noreply@blogger.com2tag:blogger.com,1999:blog-8432909598061906445.post-39826891122684517182013-09-10T12:31:00.000-07:002013-09-10T23:00:12.158-07:00Instance Management in WCF<div dir="ltr" style="text-align: left;" trbidi="on">
<div align="center" class="MsoNormal" style="text-align: center;">
<b><u><span style="font-family: "Times New Roman","serif"; font-size: 28.0pt; line-height: 115%;">Instance
Management in WCF<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;">Instance management in WCF is the concept in which
we can understand the instance creation of service when client request for the
service. We have to set the <span style="background-color: white; background-position: initial initial; background-repeat: initial initial;">InstanceContextMode in ServiceBehavior</span>. There are three type of instance management
available in WCF and these are as follows:-<o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span style="font-family: "Times New Roman","serif"; font-size: 24.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span style="font-family: "Times New Roman","serif"; font-size: 24.0pt; line-height: 115%;">Per
Call<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;">In per call instance management every time we hit
the service means when we call method it will simply create the new instance of
service and execute the method and give the result to the client. After that it
will simply dispose the instance.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;">There are no overhead on the server in this type
instance management as resources deallocate as the user request complete. At
every method call new instance will be created in per call.<o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;">For
example:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<b><u><span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;">Interface
Code is:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">[</span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">ServiceContract</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">public</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">interface</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">IService</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> [</span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">OperationContract</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">int</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> GetData();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><u><span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;">Service
Class code is:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
System;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
System.Collections.Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
System.Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
System.Runtime.Serialization;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
System.ServiceModel;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
System.ServiceModel.Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">using</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
System.Text;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">[</span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">ServiceBehavior</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">(InstanceContextMode=</span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">InstanceContextMode</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">.PerCall)]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">public</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">class</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">Service</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> : </span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">IService</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">int</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> x = 0;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">public</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">int</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> GetData()<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> x++;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">return</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> x;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><u><span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;">Web
config code:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;">Add this code inside the System.servicemodel tag<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"><</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">services</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"> <</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">service</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">name</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">Service</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"> <</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">endpoint</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">address</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">""</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">binding</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">basicHttpBinding</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">contract</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">IService</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">/></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"> </</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">service</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%; mso-highlight: white;"></</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">services</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">></span><span style="color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"></span></div>
<a name='more'></a><br />
<br />
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;">As you can see the binding that I implemented the
basichttpbinding and now create the client for this service:-<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">ServiceReference1.</span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">ServiceClient</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> svc = </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">new</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> ServiceReference1.</span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">ServiceClient</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
Response.Write(</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"Method Calling First
Time and Result is="</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> + svc.GetData() + </span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"<br/>"</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
Response.Write(</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"Method Calling Second
Time and Result is="</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> + svc.GetData() + </span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"<br/>"</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
Response.Write(</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"Method Calling Third
Time and Result is="</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> + svc.GetData() + </span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"<br/>"</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">);<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt; line-height: 115%;"> Response.Write(</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">"Method Calling Fourth
Time and Result is="</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt; line-height: 115%;"> + svc.GetData() + </span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">"<br/>"</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt; line-height: 115%;">);</span><span style="font-family: 'Times New Roman', serif; font-size: 14pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Times New Roman', serif; font-size: 14pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: 'Times New Roman', serif; font-size: 14pt; line-height: 115%;">Now you can see the output of this code
in the following image:-<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%; mso-no-proof: yes;"><v:shapetype coordsize="21600,21600" filled="f" id="_x0000_t75" o:preferrelative="t" o:spt="75" path="m@4@5l@4@11@9@11@9@5xe" stroked="f">
<v:stroke joinstyle="miter">
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0">
<v:f eqn="sum @0 1 0">
<v:f eqn="sum 0 0 @1">
<v:f eqn="prod @2 1 2">
<v:f eqn="prod @3 21600 pixelWidth">
<v:f eqn="prod @3 21600 pixelHeight">
<v:f eqn="sum @0 0 1">
<v:f eqn="prod @6 1 2">
<v:f eqn="prod @7 21600 pixelWidth">
<v:f eqn="sum @8 21600 0">
<v:f eqn="prod @7 21600 pixelHeight">
<v:f eqn="sum @10 21600 0">
</v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:formulas>
<v:path gradientshapeok="t" o:connecttype="rect" o:extrusionok="f">
<o:lock aspectratio="t" v:ext="edit">
</o:lock></v:path></v:stroke></v:shapetype><v:shape id="Picture_x0020_12" o:spid="_x0000_i1031" style="height: 110.25pt; mso-wrap-style: square; visibility: visible; width: 323.25pt;" type="#_x0000_t75">
<v:imagedata o:title="wcf-1" src="file:///C:\Users\Isha\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png">
</v:imagedata></v:shape></span><span style="color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9AN36vvvYpK5x-FbPGjPvWrdrIlEmnT-gfrMExxRDXZ00O6nyMOeGil5g_MPPBw8xlSu242Fi9h4ktrVyptSwXmO20ZUkmwN9GcV19Q_3MzzDBuETrOhaFszbJRsxyhhEyFovnYX3jWE/s1600/wcf-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="217" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9AN36vvvYpK5x-FbPGjPvWrdrIlEmnT-gfrMExxRDXZ00O6nyMOeGil5g_MPPBw8xlSu242Fi9h4ktrVyptSwXmO20ZUkmwN9GcV19Q_3MzzDBuETrOhaFszbJRsxyhhEyFovnYX3jWE/s640/wcf-1.png" width="640" /></a></div>
<div class="MsoNormal">
<span style="color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: 'Times New Roman', serif; font-size: 14pt; line-height: 115%;">Figure 1<span style="color: blue;"><o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;">As you can see for every calling it will give the
same result as every time when I call the method it will create the new
instance of the service and accordingly giving the result<o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span style="font-family: "Times New Roman","serif"; font-size: 24.0pt; line-height: 115%;">Per
Session<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;">Now move to the per session mode. In per session
mode service holds the object for single instance of proxy which created at
client level. In the following example I have created the two proxy object at
the client level. For every instance of proxy service will holds the instance
at service level and will give result accordingly. <o:p></o:p></span><span style="font-family: 'Times New Roman', serif; font-size: 19px; line-height: 21px;">This is the by default instance mode set in the wcf service. If we do not set any instance mode behavior then by default it will take per Session(Please use wsHttpBinding to check this point)</span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;">For example:-<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;">Service implementation of per session:-<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">[</span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">ServiceBehavior</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">(InstanceContextMode=</span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">InstanceContextMode</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">.PerSession)]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">public</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">class</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">Service</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> : </span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">IService</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">int</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> x = 0;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">public</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">int</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> GetData()<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> x++;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">return</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> x;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">Web configuration setting for Per Session<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"><</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">services</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"> <</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">service</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">name</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">Service</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"> <</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">endpoint</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">address</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">""</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">binding</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">wsHttpBinding</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"> </span><span style="background: white; color: red; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">contract</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">=</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">IService</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">"</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">/></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"> </</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">service</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;"></</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">services</span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">To implement the per session instance management we have to change the
binding as basichttpbinding do not support the per session instance mode.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">Now update the service reference at client side and again execute the
code and you will get following output:-<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">At client side create two instances of proxy and call methods<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">//proxy instance creation<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">ServiceReference1.</span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">ServiceClient</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> svc = </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">new</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> ServiceReference1.</span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">ServiceClient</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
Response.Write(</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"Method Calling First
Time with First instance and Result is="</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> + svc.GetData() + </span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"<br/>"</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
Response.Write(</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"Method Calling Second
Time with First instance and Result is="</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> + svc.GetData() + </span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"<br/>"</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
Response.Write(</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"Method Calling Third
Time with First instance and Result is="</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> + svc.GetData() + </span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"<br/>"</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
Response.Write(</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"Method Calling Fourth
Time with First instance and Result is="</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> + svc.GetData() + </span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"<br/>"</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
ServiceReference1.</span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">ServiceClient</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> svc1 = </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">new</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> ServiceReference1.</span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">ServiceClient</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
Response.Write(</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"<br/><br/>Method
Calling First Time with Second instance and Result is="</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> + svc1.GetData() + </span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"<br/>"</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
Response.Write(</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"Method Calling Second
Time with Second instance and Result is="</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> + svc1.GetData() + </span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"<br/>"</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
Response.Write(</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"Method Calling Third
Time with Second instance and Result is="</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> + svc1.GetData() + </span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"<br/>"</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">
Response.Write(</span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"Method Calling Fourth
Time with Second instance and Result is="</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> + svc1.GetData() + </span><span style="background: white; color: #a31515; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">"<br/>"</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">Output:-<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><o:p><br /></o:p></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1bkasc82HkhB6gHeP6cBgElvkMiIFiFRLgvVfvZd66BFyJnrAKs1h0FGsHGzyIJz9mAtpscjwJ4S8n4ZpN1htZNcakiSmSnft6PqM4cT_z6gcCRrjnm-CKY7XLz_kx4bfKMjWES8FgMg/s1600/wcf-2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="388" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1bkasc82HkhB6gHeP6cBgElvkMiIFiFRLgvVfvZd66BFyJnrAKs1h0FGsHGzyIJz9mAtpscjwJ4S8n4ZpN1htZNcakiSmSnft6PqM4cT_z6gcCRrjnm-CKY7XLz_kx4bfKMjWES8FgMg/s640/wcf-2.png" width="640" /></a></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 14pt;"><v:shape id="Picture_x0020_13" o:spid="_x0000_i1030" style="height: 202.5pt; mso-wrap-style: square; visibility: visible; width: 334.5pt;" type="#_x0000_t75">
<v:imagedata o:title="wcf-2" src="file:///C:\Users\Isha\AppData\Local\Temp\msohtmlclip1\01\clip_image002.png">
</v:imagedata></v:shape></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">Figure 2<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">As we can see that service maintain session for each
instance and work accordingly.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><u><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 24pt;">Single<o:p></o:p></span></u></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">In single type of instance management service will create
single object of service for all clients.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><u><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">For example:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">Set instance mode single <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">[</span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">ServiceBehavior</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">(InstanceContextMode=</span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">InstanceContextMode</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">.Single)]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">public</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">class</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">Service</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> : </span><span style="background: white; color: #2b91af; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">IService</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">int</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> x = 0;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">public</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">int</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> GetData()<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> x++;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> </span><span style="background: white; color: blue; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">return</span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> x;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;">Update the service reference and execute the client
application and see the difference:-<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin3QjuAew7x1HlDdQyP98z4TOW4jAVMwyV9FzUO07-ujywr9zviBeqXicS_o2kfgaysl_-oy_i0SVLoY39G2PLHqq1tXMJyMiI4qOIF20VcpwWwEwTeLY7GMgO9kJL3TbvihqOa30uZAo/s1600/wcf-3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="412" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin3QjuAew7x1HlDdQyP98z4TOW4jAVMwyV9FzUO07-ujywr9zviBeqXicS_o2kfgaysl_-oy_i0SVLoY39G2PLHqq1tXMJyMiI4qOIF20VcpwWwEwTeLY7GMgO9kJL3TbvihqOa30uZAo/s640/wcf-3.png" width="640" /></a></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><o:p><br /></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: 'Times New Roman', serif; font-size: 14pt;"><v:shape id="Picture_x0020_14" o:spid="_x0000_i1029" style="height: 204.75pt; mso-wrap-style: square; visibility: visible; width: 317.25pt;" type="#_x0000_t75">
<v:imagedata o:title="wcf-3" src="file:///C:\Users\Isha\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png">
</v:imagedata></v:shape></span><span style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: 'Times New Roman', serif; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background: white; font-family: "Times New Roman","serif"; font-size: 14.0pt; mso-highlight: white;">Figure 3<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;">As we can see that for single client service created
a single object and we are getting this output.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;">Now I have created one more .net application means
one more client and added the service reference and call the method and I got
the following output:-<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%; mso-no-proof: yes;"><v:shape id="Picture_x0020_5" o:spid="_x0000_i1028" style="height: 204.75pt; mso-wrap-style: square; visibility: visible; width: 327.75pt;" type="#_x0000_t75">
<v:imagedata o:title="wcf-4" src="file:///C:\Users\Isha\AppData\Local\Temp\msohtmlclip1\01\clip_image004.png">
</v:imagedata></v:shape></span><span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgC-_XDrn022su5AI4zTBnIsuxRAjY5l6_Sj5m4PLX7YEcphLP7VpV_AmxFGQs14nc1SZmtRqv88DcbDt-OifNLatYp3OFE-pSZPKQsud1H-2IJ9ZQK8JcADpRt-_a9vREaS2EVcjhMz4/s1600/wcf-4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="398" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgC-_XDrn022su5AI4zTBnIsuxRAjY5l6_Sj5m4PLX7YEcphLP7VpV_AmxFGQs14nc1SZmtRqv88DcbDt-OifNLatYp3OFE-pSZPKQsud1H-2IJ9ZQK8JcADpRt-_a9vREaS2EVcjhMz4/s640/wcf-4.png" width="640" /></a></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;">Figure 4<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif"; font-size: 14.0pt; line-height: 115%;">Hope you enjoyed the article<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div align="center" class="MsoNormal" style="text-align: center;">
</div>
<div class="MsoNormal">
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/08203366298489829818noreply@blogger.com5tag:blogger.com,1999:blog-8432909598061906445.post-13826201467540984382013-07-21T09:39:00.000-07:002013-07-21T09:39:55.112-07:00Message Security in WCF using username client credential<div dir="ltr" style="text-align: left;" trbidi="on">
<div align="center" class="MsoNormal" style="text-align: center;">
<b><u><span lang="EN-IN" style="font-size: 28.0pt; line-height: 115%;">Message
Security in WCF<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">There
are two types of security in WCF. One is the security of Data and second is the
security of medium through which message travel. <o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">When
we talk about the security of data then it is achieved by message security and
if we talk about the security of medium through which message travel which is
protocol security can be achieved by transport level security.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">In
this article I defined how to achieve message level security. There of
different type of client credential and using this client credential we achieve
message security. I am using wsHttpBinding to achieve message level security<o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Type of client Credential in message
security<o:p></o:p></span></u></b></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">1.<span style="font-size: 7pt; line-height: normal;"> </span></span><!--[endif]--><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">None<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">2.<span style="font-size: 7pt; line-height: normal;"> </span></span><!--[endif]--><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Windows<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">3.<span style="font-size: 7pt; line-height: normal;"> </span></span><!--[endif]--><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Username<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">4.<span style="font-size: 7pt; line-height: normal;"> </span></span><!--[endif]--><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Certificate<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -.25in;">
<!--[if !supportLists]--><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">5.<span style="font-size: 7pt; line-height: normal;"> </span></span><!--[endif]--><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Issued token<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">In
this example I am using client credential username.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Following
are the steps to implement the message security using client credential
username<o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Step 1:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Create
a class and inherit usernamepasswordvalidator class in it. This class will be
found on System.IdentityModel.Selectors and override the method validate and
verify the username and password.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> System;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">
System.Collections.Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">
System.Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">
System.Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">
System.IdentityModel.Selectors;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> System.ServiceModel;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">public</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">class</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span lang="EN-IN" style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">Credentioal</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">:</span><span lang="EN-IN" style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">UserNamePasswordValidator</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">public</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">override</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">void</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">
Validate(</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">string</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> userName, </span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">string</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> password)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">if</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">
(userName == </span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">"isha"</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> && password == </span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">"isha123"</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> { }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">else</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">throw</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">new</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span lang="EN-IN" style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">FaultException</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">(</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">"Wrong
userid and pwd"</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt; line-height: 115%;">}</span><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Step 2<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"></span></div>
<a name='more'></a><br /><br />
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Go
to your web.config file customize the binding and add message security and
client credential username.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"><</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">bindings</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">wsHttpBinding</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">binding</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">name</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">sec</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">security</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">mode</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">Message</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">message</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">clientCredentialType</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">UserName</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">message</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">security</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">binding</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">wsHttpBinding</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;"> </</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">bindings</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">></span><span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-family: Consolas; font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-family: Consolas; font-size: 14.0pt; line-height: 115%;">Step 3:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-family: Consolas; font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-family: Consolas; font-size: 14.0pt; line-height: 115%;">Now create service tag and add this binding using bindingconfiguration
tag which is as follows:-<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"><</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">services</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">service</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">name</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">Service</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">endpoint</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">address</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">""</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">binding</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">wsHttpBinding</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">contract</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">IService</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">bindingConfiguration</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">sec</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> ></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">endpoint</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">service</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;"> </</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">services</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">></span><span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Step 4:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">To
implement message level security we need security certificate. So go to your
start button and type inetmgr and choose server certificate<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-no-proof: yes;"><v:shapetype coordsize="21600,21600" filled="f" id="_x0000_t75" o:preferrelative="t" o:spt="75" path="m@4@5l@4@11@9@11@9@5xe" stroked="f">
<v:stroke joinstyle="miter">
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0">
<v:f eqn="sum @0 1 0">
<v:f eqn="sum 0 0 @1">
<v:f eqn="prod @2 1 2">
<v:f eqn="prod @3 21600 pixelWidth">
<v:f eqn="prod @3 21600 pixelHeight">
<v:f eqn="sum @0 0 1">
<v:f eqn="prod @6 1 2">
<v:f eqn="prod @7 21600 pixelWidth">
<v:f eqn="sum @8 21600 0">
<v:f eqn="prod @7 21600 pixelHeight">
<v:f eqn="sum @10 21600 0">
</v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:formulas>
<v:path gradientshapeok="t" o:connecttype="rect" o:extrusionok="f">
<o:lock aspectratio="t" v:ext="edit">
</o:lock></v:path></v:stroke></v:shapetype><v:shape id="Picture_x0020_12" o:spid="_x0000_i1031" style="height: 207pt; mso-wrap-style: square; visibility: visible; width: 468pt;" type="#_x0000_t75">
<v:imagedata o:title="ms-1" src="file:///C:\Users\Avi\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png">
</v:imagedata></v:shape></span><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaafQG0TSn_PNuSL2MQGmURTuYz5Xsupu-6m16E6AcOJgUkJuaBIDzaSTNtM_XeLdKxq7SCMAjRxlgfO0VazpmSJklLPVYXUdtjeADznEID-oQyQ2-9fox_EPRzUaP3dopTtgyEHN_T48/s1600/ms-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="282" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaafQG0TSn_PNuSL2MQGmURTuYz5Xsupu-6m16E6AcOJgUkJuaBIDzaSTNtM_XeLdKxq7SCMAjRxlgfO0VazpmSJklLPVYXUdtjeADznEID-oQyQ2-9fox_EPRzUaP3dopTtgyEHN_T48/s640/ms-1.png" width="640" /></a></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Figure
1<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Now
create the server certificate from the left panal and choose create self-signed
certificate and give it proper name as I give certificate name isha<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-no-proof: yes;"><v:shape id="_x0000_i1030" style="height: 185.25pt; mso-wrap-style: square; visibility: visible; width: 212.25pt;" type="#_x0000_t75">
<v:imagedata o:title="ms-2" src="file:///C:\Users\Avi\AppData\Local\Temp\msohtmlclip1\01\clip_image002.png">
</v:imagedata></v:shape></span><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhweZNZDHvudr_kqVrmWUYU8aOSMBhPAmNisxfk1I2MK3CFKOt47uCXhps0d5c6MkYhmnph3ufxYgszK3D2m7yTjmZ71xhWm2HxgAYKtAyH0kT5ZxhM9CNJsC6wuyH-_sM0wCaKbp-Iln0/s1600/ms-2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="350" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhweZNZDHvudr_kqVrmWUYU8aOSMBhPAmNisxfk1I2MK3CFKOt47uCXhps0d5c6MkYhmnph3ufxYgszK3D2m7yTjmZ71xhWm2HxgAYKtAyH0kT5ZxhM9CNJsC6wuyH-_sM0wCaKbp-Iln0/s400/ms-2.png" width="400" /></a></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Figure
2<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Now
you can see your certificate here in the list<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-no-proof: yes;"><v:shape id="Picture_x0020_13" o:spid="_x0000_i1029" style="height: 104.25pt; mso-wrap-style: square; visibility: visible; width: 468pt;" type="#_x0000_t75">
<v:imagedata o:title="ms-3" src="file:///C:\Users\Avi\AppData\Local\Temp\msohtmlclip1\01\clip_image003.png">
</v:imagedata></v:shape></span><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgekS4sl9vGE902FjMN68cs2Yg8TEbyIyTdwsTHk0gGxnlPEXZaZD7GMqYGzHygyMHzBAAqdYsTFdpu9mwtRTc3iM67cidbgyPUOgIfPuW6PrhYKWsflr2U0ZCPu1TXPNagoHAvby0301U/s1600/ms-3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="142" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgekS4sl9vGE902FjMN68cs2Yg8TEbyIyTdwsTHk0gGxnlPEXZaZD7GMqYGzHygyMHzBAAqdYsTFdpu9mwtRTc3iM67cidbgyPUOgIfPuW6PrhYKWsflr2U0ZCPu1TXPNagoHAvby0301U/s640/ms-3.png" width="640" /></a></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Figure
3<o:p></o:p></span></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Step 5:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Now
go to your web config file again and add this certificate and credential class
in it<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"><</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">behaviors</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">serviceBehaviors</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">behavior</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">serviceCredentials</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">serviceCertificate</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">findValue</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">isha</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">storeLocation</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">LocalMachine</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">storeName</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">My</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">x509FindType</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">FindByIssuerName</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">/></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">userNameAuthentication</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">userNamePasswordValidationMode</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">Custom</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">customUserNamePasswordValidatorType</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">Credentioal, App_Code</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">/><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">serviceCredentials</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <!--</span><span lang="EN-IN" style="background: white; color: green; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> To avoid disclosing metadata information, set the
value below to false before deployment </span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">--></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">serviceMetadata</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">httpGetEnabled</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">true</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">/></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <!--</span><span lang="EN-IN" style="background: white; color: green; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> To receive exception details in faults for
debugging purposes, set the value below to true. Set to false before deployment to avoid
disclosing exception information </span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">--></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> <</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">serviceDebug</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background: white; color: red; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">includeExceptionDetailInFaults</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">=</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">false</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">"</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">/></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">behavior</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"> </</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">serviceBehaviors</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">></span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;"> </</span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">behaviors</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; line-height: 115%; mso-highlight: white;">></span><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Now
execute your service<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-no-proof: yes;"><v:shape id="Picture_x0020_14" o:spid="_x0000_i1028" style="height: 174.75pt; mso-wrap-style: square; visibility: visible; width: 444pt;" type="#_x0000_t75">
<v:imagedata o:title="ms-4" src="file:///C:\Users\Avi\AppData\Local\Temp\msohtmlclip1\01\clip_image004.png">
</v:imagedata></v:shape></span><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhE5WfpnQzOpunq4kEQdrfD-rxBURkDgk8nSDqND4-3nFhhN0WI48E2fI9efpNr_K4F8JSgseU9eT_PhfqrTbHYls9nSWqOJVXZjypWnWjd3qVflpFLxscbA9SW54wEyRfv-kYsYQoYqGg/s1600/ms-4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhE5WfpnQzOpunq4kEQdrfD-rxBURkDgk8nSDqND4-3nFhhN0WI48E2fI9efpNr_K4F8JSgseU9eT_PhfqrTbHYls9nSWqOJVXZjypWnWjd3qVflpFLxscbA9SW54wEyRfv-kYsYQoYqGg/s640/ms-4.png" width="640" /></a></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Figure
4<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Now
create your client application and add this reference and use the following
credential:-<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> System;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">
System.Collections.Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">
System.Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> System.Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">
System.Web.UI;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">using</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">
System.Web.UI.WebControls;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">public</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">partial</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">class</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span lang="EN-IN" style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">_Default</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> : System.Web.UI.</span><span lang="EN-IN" style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">Page</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">protected</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> </span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">void</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">
Page_Load(</span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">object</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> sender, </span><span lang="EN-IN" style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">EventArgs</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> e)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">
ServiceReference1.</span><span lang="EN-IN" style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">ServiceClient</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> sv = </span><span lang="EN-IN" style="background: white; color: blue; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">new</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> ServiceReference1.</span><span lang="EN-IN" style="background: white; color: #2b91af; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">ServiceClient</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">
sv.ClientCredentials.UserName.UserName = </span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">"isha"</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">
sv.ClientCredentials.UserName.Password = </span><span lang="EN-IN" style="background: white; color: #a31515; font-family: Consolas; font-size: 14.0pt; mso-highlight: white;">"isha123"</span><span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;">
Response.Write(sv.GetData(5));<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="background-color: white; background-position: initial initial; background-repeat: initial initial; font-family: Consolas; font-size: 14pt; line-height: 115%;">}</span><span lang="EN-IN" style="font-family: Consolas; font-size: 14pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-family: Consolas; font-size: 14pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-family: Consolas; font-size: 14pt; line-height: 115%;">If you do not pass the credential or pass
wrong credential it will simply give you error.</span><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-family: Consolas; font-size: 14pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-family: Consolas; font-size: 14pt; line-height: 115%;">Hope you enjoyed the article</span></div>
<br />
<div class="MsoNormal">
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/08203366298489829818noreply@blogger.com11tag:blogger.com,1999:blog-8432909598061906445.post-83545166403375617312013-03-27T04:52:00.000-07:002013-03-27T04:52:06.126-07:00WCF Lesson 4:-Fault Contract in WCF<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div align="center" class="MsoNormal" style="text-align: center;">
<b><u><span style="font-size: 20.0pt; line-height: 115%;">Fault Contract in
WCF<o:p></o:p></span></u></b></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b><u><span style="font-size: 20.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
With the help of fault contract we can describe how to
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="9a7178f1-6587-4151-a1ac-eba2a97cf0df" ginger_sofatware_uiphraseguid="83e45fcf-9c32-49bb-a424-9a00ce0835bc" grcontextid="exchange:0">exchange</span> error information from service to client. If we get any error in the
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="4e65acd1-8b61-46b4-a45f-3fd011653e63" ginger_sofatware_uiphraseguid="8cf0052a-b314-4822-a4a0-7653e9b255d1" grcontextid="service:0">service</span> then we can pass this error information from service to client with the
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="b963466c-7695-4b6f-bfba-34ce6a1309bb" ginger_sofatware_uiphraseguid="ce8d471b-b741-4de2-b6fc-2abbd8f926dc" grcontextid="help:0">help</span> of Fault contract.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><u>For Example:-<o:p></o:p></u></b></div>
<div class="MsoNormal">
<b><u><br /></u></b></div>
<div class="MsoNormal">
Everybody is familiar with the error DivideByZero. It occurs
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="c75cf1e3-6592-4501-b5cf-49606f67431a" ginger_sofatware_uiphraseguid="2030d628-7495-4dfc-9885-c5cb688811cf" grcontextid="when:0">when</span> we try to divide a number with zero, It occurs this exception. Same example
I am using here.<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
I create Error class which will be used to pass to the
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="9e90d226-ac57-4731-adcf-f41296268633" ginger_sofatware_uiphraseguid="3dc7069c-605f-4a8c-afd2-790bd743e53c" grcontextid="client:0">client</span> at the time of error occur:-<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">[<span style="color: #2b91af;"><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="07c542dd-0163-4a19-b2e9-5d26a9c89420" ginger_sofatware_uiphraseguid="9002a47a-72fe-4fbe-8648-7ba8d8ffcf75" grcontextid="DataContract:0">DataContract</span></span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="fc268677-19a1-4100-a1ee-fed79625ba64" ginger_sofatware_uiphraseguid="785eee40-5d3c-4b60-8784-17ea773e39ce" grcontextid="public:0">public</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">class</span> <span style="color: #2b91af;">Error</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> [<span style="color: #2b91af;"><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="f1386b17-ecb8-4edb-93f7-336881dbb90a" ginger_sofatware_uiphraseguid="3aa744bb-5e08-4192-9fd6-cd2c0e74dde5" grcontextid="DataMember:0">DataMember</span></span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="375f0eae-682a-487e-b7ed-59c44fbd153f" ginger_sofatware_uiphraseguid="ab0e3070-d92a-4fec-9994-126b2cfebd0f" grcontextid="public:0">public</span></span> <span style="color: blue;">string</span>
<span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="1b21e45a-4f16-4154-8d96-de3125022bb0" ginger_sofatware_uiphraseguid="00e62d9a-5a5c-48f9-8bfe-991e0d4236f4" grcontextid="ErrorMessage:0">ErrorMessage</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> [<span style="color: #2b91af;"><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="1e0b3b3a-a7c1-48e3-b348-e7938f1f4484" ginger_sofatware_uiphraseguid="62c04999-88b1-460c-92f2-feac23364505" grcontextid="DataMember:0">DataMember</span></span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="e885cd7f-4be4-4ca0-a150-a9d70ac79d5b" ginger_sofatware_uiphraseguid="337c6976-bae6-4cd6-9899-7d3395986ba9" grcontextid="public:0">public</span></span> <span style="color: blue;">string</span>
<span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="7e2f4acb-6101-4cf9-bee7-ebfacb011e85" ginger_sofatware_uiphraseguid="ea47ad8a-adc7-4bdc-91dd-48f6ce8308d6" grcontextid="ErrorMethod:0">ErrorMethod</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"></span></div>
<a name='more'></a><br /><br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">Now declare the method in contract class. While creating
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="4776a486-b291-4552-ace1-953777e24ce9" ginger_sofatware_uiphraseguid="4e608106-a00b-4a3f-84cc-25ec441cf89c" grcontextid="the:0">the</span> method you have to assign the fault contract to the method and describe the
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="e3d63bf6-5628-4401-95f7-52a7420dfb6b" ginger_sofatware_uiphraseguid="75c13ff6-b7c7-457f-bcac-05bb2212b799" grcontextid="type:0">type</span> of error which we pass to the client. Here it is the type of Error Class.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">[<span style="color: #2b91af;"><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="59f6820c-0c90-433d-b5ef-6694d6a462e4" ginger_sofatware_uiphraseguid="439ce305-b4c1-4982-ba3e-3d080c40c1c0" grcontextid="ServiceContract:0">ServiceContract</span></span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="040501ee-a9e4-4390-a4b6-ecfe5ec8b683" ginger_sofatware_uiphraseguid="f38e57b6-9a2b-44e4-9139-fac2f04a7838" grcontextid="public:0">public</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">interface</span> <span style="color: #2b91af;">ITechAltum</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> [<span style="color: #2b91af;"><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="2539fb5b-0ca8-4ca9-a6b8-438027d80d44" ginger_sofatware_uiphraseguid="140e12f7-a589-4f6e-a6dc-ad67e5a65f8e" grcontextid="OperationContract:0">OperationContract</span></span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> [<span style="color: #2b91af;"><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="f89bdc3e-f3d6-4d56-b956-d6d2209e750e" ginger_sofatware_uiphraseguid="f0c96dc6-6583-4cdb-b371-f8a7068c2587" grcontextid="FaultContract:0">FaultContract</span></span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="9560b045-fd85-4873-8094-5889a3cfd3cb" ginger_sofatware_uiphraseguid="f0c96dc6-6583-4cdb-b371-f8a7068c2587" grcontextid="(:1">(</span><span style="color: blue;"><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="9840eb6e-2de6-4760-8178-71f5f5007853" ginger_sofatware_uiphraseguid="f0c96dc6-6583-4cdb-b371-f8a7068c2587" grcontextid="typeof:2">typeof</span></span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="da5ffb55-3c97-4730-89e1-041480aa5488" ginger_sofatware_uiphraseguid="f0c96dc6-6583-4cdb-b371-f8a7068c2587" grcontextid="(:3">(</span><span style="color: #2b91af;">Error</span>))]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">int</span> div(<span style="color: blue;">int</span> x, <span style="color: blue;">int</span> y);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><u><span style="font-family: Consolas; font-size: 9.5pt;">Now implement
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="ddee04e8-7f8a-44af-ae94-ebbeb39e1eb6" ginger_sofatware_uiphraseguid="05b2cdaa-2971-42d9-943e-24ee7170aac3" grcontextid="this:0">this</span> method in the Class where we use exception handling.<o:p></o:p></span></u></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="9b2e82e0-9928-4a2a-9cc8-55232e830ba3" ginger_sofatware_uiphraseguid="105d9d1f-06ff-483e-9787-b0c221bb1251" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="49b62956-c851-4293-b534-ed8515bc301e" ginger_sofatware_uiphraseguid="fe485f4e-1263-4418-8e69-bf070bf8f28e" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="f85a8bce-d302-4d45-a4f9-537adc75bc37" ginger_sofatware_uiphraseguid="fe485f4e-1263-4418-8e69-bf070bf8f28e" grcontextid=".:1">.</span>Collections<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="485c4b81-c002-403a-936d-d905107b24a0" ginger_sofatware_uiphraseguid="fe485f4e-1263-4418-8e69-bf070bf8f28e" grcontextid=".:2">.</span>Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="f79c4518-619b-4dc1-bad9-72cf637cce37" ginger_sofatware_uiphraseguid="9fb41ec5-85fe-4e5e-9d58-a5db19c22859" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="acdfb69a-92a5-48a0-8704-4ec53649d54d" ginger_sofatware_uiphraseguid="9fb41ec5-85fe-4e5e-9d58-a5db19c22859" grcontextid=".:1">.</span>Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="240d910a-4a38-47db-8800-b6b98f38cda1" ginger_sofatware_uiphraseguid="3aa95a27-5f71-45f5-a936-3515c892b391" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="dede49db-3337-4812-9b50-8d5734eece90" ginger_sofatware_uiphraseguid="3aa95a27-5f71-45f5-a936-3515c892b391" grcontextid=".:1">.</span>Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="76cfddfe-1626-4be1-a6b6-5924b2fb8730" ginger_sofatware_uiphraseguid="4fca0bde-502c-4a40-a294-24bbcd0d278c" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="2bf6037d-52ec-48eb-9351-29cd82a4cbaa" ginger_sofatware_uiphraseguid="4fca0bde-502c-4a40-a294-24bbcd0d278c" grcontextid=".:1">.</span>ServiceModel;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="96da5a3e-abfb-49f1-82c7-51c3897ee881" ginger_sofatware_uiphraseguid="897f7c9c-0ee7-4151-972c-6f4f07e98dbf" grcontextid="public:0">public</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">class</span> <span style="color: #2b91af;">TechAltum</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="dbda6a8b-f4db-4b28-af0f-62108f5d256d" ginger_sofatware_uiphraseguid="897f7c9c-0ee7-4151-972c-6f4f07e98dbf" grcontextid="::1">:</span><span style="color: #2b91af;">ITechAltum</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="bf88430f-9dca-45b0-8f48-a187a364d388" ginger_sofatware_uiphraseguid="7dd9e7fe-8338-437e-9907-483f2978fa26" grcontextid="public:0">public</span></span> <span style="color: blue;"><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="6b0255a0-0227-4f3b-94f1-fafb6c8a8ffa" ginger_sofatware_uiphraseguid="7dd9e7fe-8338-437e-9907-483f2978fa26" grcontextid="int:1">int</span></span> <span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="6f2e27e7-9af5-4163-81c5-5afea20974b7" ginger_sofatware_uiphraseguid="7dd9e7fe-8338-437e-9907-483f2978fa26" grcontextid="div:2">div</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="748db4ce-22e9-4f36-8e48-d2c19bf158a0" ginger_sofatware_uiphraseguid="7dd9e7fe-8338-437e-9907-483f2978fa26" grcontextid="(:3">(</span><span style="color: blue;"><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="43b667a6-bc95-4412-8708-b7ed0eb9cd1d" ginger_sofatware_uiphraseguid="7dd9e7fe-8338-437e-9907-483f2978fa26" grcontextid="int:4">int</span></span> x, <span style="color: blue;"><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="36229bd9-141f-42c3-969f-1643e13fce03" ginger_sofatware_uiphraseguid="7dd9e7fe-8338-437e-9907-483f2978fa26" grcontextid="int:5">int</span></span> y)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="f5a3e0fd-5229-49e8-9cbe-59f4570b600b" ginger_sofatware_uiphraseguid="e045f3b1-72c0-4e9e-a6b2-96cda5e835e1" grcontextid="try:0">try</span></span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">int</span> z = x / y;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="4c063a41-3bbb-4507-90c4-f77f1406369e" ginger_sofatware_uiphraseguid="d4920ed2-260c-4909-9c22-6278439431ca" grcontextid="return:0">return</span></span> z;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="0a4f40a5-059f-47eb-8240-b09bb202e8ed" ginger_sofatware_uiphraseguid="e4822a56-0ffa-4ea2-bb1b-3c57b52ac4c3" grcontextid="catch:0">catch</span></span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="9ef49040-cdd7-4edb-b109-cf343870b512" ginger_sofatware_uiphraseguid="e4822a56-0ffa-4ea2-bb1b-3c57b52ac4c3" grcontextid="(:1">(</span><span style="color: #2b91af;">Exception</span> e)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">Error</span> er=<span style="color: blue;">new</span> <span style="color: #2b91af;">Error</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="7343fac0-22a5-4b5b-90cc-c3f4f26c9839" ginger_sofatware_uiphraseguid="d9ae39a6-ffd4-4bd3-a729-0755d3cc0cc4" grcontextid="(:0">(</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="58ecf5ae-3db6-4ec4-acbe-d2e9567646d2" ginger_sofatware_uiphraseguid="449a75c7-351c-4996-92e1-39550ef42095" grcontextid="er:0">er</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="8783709b-7382-43ac-84e1-289c16333f9b" ginger_sofatware_uiphraseguid="449a75c7-351c-4996-92e1-39550ef42095" grcontextid=".:1">.</span>ErrorMessage=<span style="color: #a31515;">"You attempted to
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="0c470648-5dd0-48dc-890a-6bd60598bef0" ginger_sofatware_uiphraseguid="4e4c9060-abc0-4d10-a0ad-f6039a0d2eb4" grcontextid="divide:0">divide</span> by zero"</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="ff151ad1-5cd9-446a-90cd-bf82114ab5f2" ginger_sofatware_uiphraseguid="5b85535e-a3e4-47b2-bc44-309466aa037c" grcontextid="er:0">er</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="9fc6607c-426c-4ed5-bf26-a9a978b6c003" ginger_sofatware_uiphraseguid="5b85535e-a3e4-47b2-bc44-309466aa037c" grcontextid=".:1">.</span>ErrorMethod=<span style="color: #a31515;">"Div"</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="bfd3a1e8-e71a-4dd1-9507-e59af287899f" ginger_sofatware_uiphraseguid="610144bd-4576-44d6-94e0-d845b0e398a3" grcontextid="throw:0">throw</span></span> <span style="color: blue;">new</span> <span style="color: #2b91af;">FaultException</span><<span style="color: #2b91af;">Error</span>>(<span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="55e55b90-3db8-428a-b9c0-0cfff4967552" ginger_sofatware_uiphraseguid="610144bd-4576-44d6-94e0-d845b0e398a3" grcontextid="er:1">er</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><u><span style="font-family: Consolas; font-size: 9.5pt;">Now implement it
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="e1c36fb5-0c91-4384-9252-c6db4238dc0e" ginger_sofatware_uiphraseguid="9493a5ff-e1ca-4fa3-b716-ba855f3ddd83" grcontextid="at:0">at</span> the client side:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="d4d58cd5-90a5-4f04-b8c1-cdd78c914cb1" ginger_sofatware_uiphraseguid="2f7df2d7-4adf-4a41-bccf-613aab2e7f1d" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="844b7ff5-5342-441e-a1e1-792721d92dc7" ginger_sofatware_uiphraseguid="b14571f9-6b46-4ca7-a4ba-2abe006fdd30" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="6da2fe18-fc42-46ac-817e-1d3e54a7489b" ginger_sofatware_uiphraseguid="b14571f9-6b46-4ca7-a4ba-2abe006fdd30" grcontextid=".:1">.</span>Collections<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="f827a44c-a606-43f3-9bdf-838ff04a00fc" ginger_sofatware_uiphraseguid="b14571f9-6b46-4ca7-a4ba-2abe006fdd30" grcontextid=".:2">.</span>Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="14040736-ea7f-42f5-8734-062dea0122db" ginger_sofatware_uiphraseguid="fe8558e7-bb80-4efe-b16d-183ed605f1a7" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="dc8909e4-6a51-4d46-917f-9a1070c78bf5" ginger_sofatware_uiphraseguid="fe8558e7-bb80-4efe-b16d-183ed605f1a7" grcontextid=".:1">.</span>Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="a79f444c-4250-48f2-a53a-4f5ec31c34ef" ginger_sofatware_uiphraseguid="86d3da5e-2395-4ecb-8875-97ba7c4b6444" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="88f34432-89f0-48ef-8d62-7bc2812d6310" ginger_sofatware_uiphraseguid="86d3da5e-2395-4ecb-8875-97ba7c4b6444" grcontextid=".:1">.</span>Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="94ba6895-0735-4147-a504-d3efbb0649b0" ginger_sofatware_uiphraseguid="ea207b1b-33e6-4192-9844-cb87ac2250a6" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="2268241d-9e30-43e7-84ce-7406132e3a57" ginger_sofatware_uiphraseguid="ea207b1b-33e6-4192-9844-cb87ac2250a6" grcontextid=".:1">.</span>Web<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="1ef5a1f3-895d-46ed-8ced-9db19999d564" ginger_sofatware_uiphraseguid="ea207b1b-33e6-4192-9844-cb87ac2250a6" grcontextid=".:2">.</span>UI;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="8b10140d-a78a-415f-99f8-d3854c0a613f" ginger_sofatware_uiphraseguid="7a0fc65d-a46e-4d57-aa8b-6979ceb5a6fa" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="c39d0dc6-a35a-4f0f-9f56-678396b26fbf" ginger_sofatware_uiphraseguid="7a0fc65d-a46e-4d57-aa8b-6979ceb5a6fa" grcontextid=".:1">.</span>Web<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="b60c30ab-d2fb-4c7a-bbc2-763d402057fa" ginger_sofatware_uiphraseguid="7a0fc65d-a46e-4d57-aa8b-6979ceb5a6fa" grcontextid=".:2">.</span>UI<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="fa6026dc-ae27-43f3-bbaa-3ac19a484924" ginger_sofatware_uiphraseguid="7a0fc65d-a46e-4d57-aa8b-6979ceb5a6fa" grcontextid=".:3">.</span>WebControls;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="79444f2d-c287-4ef6-8d00-8a2bbdb0736a" ginger_sofatware_uiphraseguid="386df60e-21de-4524-a400-359012a8912e" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="5ae07e48-e9ad-467b-8975-e978e5df608b" ginger_sofatware_uiphraseguid="386df60e-21de-4524-a400-359012a8912e" grcontextid=".:1">.</span>ServiceModel;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="ca2e81e1-0580-4b38-b3e0-9a275700f7b4" ginger_sofatware_uiphraseguid="0e35c5ae-84fd-49c9-bb49-292aba45962e" grcontextid="public:0">public</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">partial</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">_Default</span> :
System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="1a17a4aa-7af1-415d-a7ab-025463b3697f" ginger_sofatware_uiphraseguid="8e218ba4-4b53-41df-a001-1ef23614053e" grcontextid=".:0">.</span>Web<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="d27e36d1-8031-4c30-a672-c2a5f3192961" ginger_sofatware_uiphraseguid="8e218ba4-4b53-41df-a001-1ef23614053e" grcontextid=".:1">.</span>UI<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="40ac42a3-ad2d-48f3-aaf7-8a56ee1dece2" ginger_sofatware_uiphraseguid="8e218ba4-4b53-41df-a001-1ef23614053e" grcontextid=".:2">.</span><span style="color: #2b91af;">Page</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="b98be67f-e0ea-4666-8fcf-d7cef394084d" ginger_sofatware_uiphraseguid="d1b50de6-9e72-49e6-a57b-ebb6d669f027" grcontextid="protected:0">protected</span></span> <span style="color: blue;">void</span>
Page_Load<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="864d2e78-fbde-4b80-833f-0c6a2a64c791" ginger_sofatware_uiphraseguid="9c20a909-3590-4561-a648-ea1a6e36052a" grcontextid="(:0">(</span><span style="color: blue;">object</span> sender, <span style="color: #2b91af;">EventArgs</span> e)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="1b9f1c60-f1ce-40c5-b280-0895929701f4" ginger_sofatware_uiphraseguid="73600ec7-220a-4b6c-aa0a-1ed7043882b9" grcontextid="try:0">try</span></span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">
ServiceReference1.<span style="color: #2b91af;">TechAltumClient</span>
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="a149ef88-6b2f-48d0-9a92-4ccab74e2a84" ginger_sofatware_uiphraseguid="94c4c0c4-d5fb-4786-a13b-e2e467379f7c" grcontextid="svctech:0">svctech</span> = <span style="color: blue;">new</span> ServiceReference1.<span style="color: #2b91af;">TechAltumClient</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="5ee865f2-bd77-4d59-83a0-c992dbe5aab5" ginger_sofatware_uiphraseguid="94c4c0c4-d5fb-4786-a13b-e2e467379f7c" grcontextid="(:1">(</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="867050a0-7497-4d54-8a32-c83b201e9f21" ginger_sofatware_uiphraseguid="c82a1a50-b4cc-44c2-b4ee-bfa3e9f31f3f" grcontextid="int:0">int</span></span> z = <span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="724368be-5d53-4edd-9cad-00ece20e1f21" ginger_sofatware_uiphraseguid="c82a1a50-b4cc-44c2-b4ee-bfa3e9f31f3f" grcontextid="svctech:1">svctech</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="be6561fb-fbad-4920-b8a9-fb3b0d86752a" ginger_sofatware_uiphraseguid="c82a1a50-b4cc-44c2-b4ee-bfa3e9f31f3f" grcontextid=".:2">.</span><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="3471def6-3684-4f5e-857f-65c3dacd605a" ginger_sofatware_uiphraseguid="c82a1a50-b4cc-44c2-b4ee-bfa3e9f31f3f" grcontextid="div:3">div</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="295dda3c-5903-4ade-8be8-9d6150b8e4ca" ginger_sofatware_uiphraseguid="c82a1a50-b4cc-44c2-b4ee-bfa3e9f31f3f" grcontextid="(:4">(</span>5, 0);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="f97834c4-52a7-4058-a997-013d74ac7aaa" ginger_sofatware_uiphraseguid="dd683b7f-4b7d-442e-a632-ef253a1100b7" grcontextid="catch:0">catch</span></span> (<span style="color: #2b91af;">FaultException</span><ServiceReference1.<span style="color: #2b91af;">Error</span>> <span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="f6646b12-16f3-4b6f-bbfa-d5235917dfff" ginger_sofatware_uiphraseguid="dd683b7f-4b7d-442e-a632-ef253a1100b7" grcontextid="er:1">er</span>)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">
Response<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="9e826341-c740-462e-85c1-bbeaeea45753" ginger_sofatware_uiphraseguid="4f54f075-ccc9-4b9a-a910-024074ed598f" grcontextid=".:0">.</span>Write<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="98a7f55e-e4af-4872-9268-42c98ad48aef" ginger_sofatware_uiphraseguid="4f54f075-ccc9-4b9a-a910-024074ed598f" grcontextid="(:1">(</span><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="bc5067fa-44ec-4e24-8696-25ce4dd79c61" ginger_sofatware_uiphraseguid="4f54f075-ccc9-4b9a-a910-024074ed598f" grcontextid="er:2">er</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="6596761f-0dbb-41d6-8a86-a387faab0180" ginger_sofatware_uiphraseguid="4f54f075-ccc9-4b9a-a910-024074ed598f" grcontextid=".:3">.</span>Detail<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="ca25bd0f-9341-480b-933a-12cfe0e00986" ginger_sofatware_uiphraseguid="4f54f075-ccc9-4b9a-a910-024074ed598f" grcontextid=".:4">.</span>ErrorMessage);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">
Response<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="5e24adea-17fc-4c9f-b457-f28518815fce" ginger_sofatware_uiphraseguid="71c49a23-4b07-4b4c-8fc9-beec14259275" grcontextid=".:0">.</span>Write<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="6088a042-37ec-48a7-a411-42ea822cc33c" ginger_sofatware_uiphraseguid="71c49a23-4b07-4b4c-8fc9-beec14259275" grcontextid="(:1">(</span><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="37da34c3-50ee-4986-8292-85e53d7c6eab" ginger_sofatware_uiphraseguid="71c49a23-4b07-4b4c-8fc9-beec14259275" grcontextid="er:2">er</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="e19bb974-dc30-41a9-8b07-b27057953310" ginger_sofatware_uiphraseguid="71c49a23-4b07-4b4c-8fc9-beec14259275" grcontextid=".:3">.</span>Detail<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="88c3ad3a-ce92-4021-a26c-6a8372743c47" ginger_sofatware_uiphraseguid="71c49a23-4b07-4b4c-8fc9-beec14259275" grcontextid=".:4">.</span>ErrorMethod);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">Hope you enjoyed the article.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">Note<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="1861c9fd-f394-427d-bc6d-41b684ec76be" ginger_sofatware_uiphraseguid="62c4584d-f706-4a4e-8121-33923ac3abe9" grcontextid="::0">:</span>-kindly add namespace System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="213648f2-ab80-4034-b761-836ee12373c6" ginger_sofatware_uiphraseguid="62c4584d-f706-4a4e-8121-33923ac3abe9" grcontextid=".:1">.</span>ServiceModel
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="3873adf9-eac3-46f6-9a71-1cf74632f6e2" ginger_sofatware_uiphraseguid="aec73ca6-2c77-4400-a254-98d8dbfc14a1" grcontextid="where:0">where</span> you use <span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="ca11c681-5e47-4833-a653-e4202f23186c" ginger_sofatware_uiphraseguid="aec73ca6-2c77-4400-a254-98d8dbfc14a1" grcontextid="falut:1">falut</span> contract.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal">
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/08203366298489829818noreply@blogger.com0tag:blogger.com,1999:blog-8432909598061906445.post-10627627921234753722013-03-27T03:10:00.000-07:002013-03-27T03:11:46.821-07:00WCF Lesson 3:-Message Contract in WCF<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div align="center" class="MsoNormal" style="text-align: center;">
<b><u><span lang="EN-IN" style="font-size: 20.0pt; line-height: 115%;"><span class="GingerNoCheckStart"></span><span class="GingerNoCheckStart"></span>Message
Contract in WCF<o:p></o:p></span></u></b></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b><u><span lang="EN-IN" style="font-size: 20.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<span lang="EN-IN">Earlier we discuss two contract i.e.
service contract and data contract. Now in this article I will discuss message
contract.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN">In message contract data is sent in the
format of SOAP message which in the form of header and body. With the help of
message header we can implement security by passing credential in header part.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN">For Example:-<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN">Create wcf service and add class to
implement message contract.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">[<span style="color: #2b91af;">MessageContract</span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">public</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">class</span> <span style="color: #2b91af;">EmployeeRecord</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
[<span style="color: #2b91af;">MessageHeader</span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<span style="color: blue;">public</span> <span style="color: blue;">string</span>
token;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
[<span style="color: #2b91af;">MessageBodyMember</span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<span style="color: blue;">public</span> <span style="color: blue;">string</span>
name;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
[<span style="color: #2b91af;">MessageBodyMember</span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<span style="color: blue;">public</span> <span style="color: blue;">int</span>
empid;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br />
<a name='more'></a><br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">Now create contract and create
method in it which takes the EmployeeRecord object as input and return the same<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">[<span style="color: #2b91af;">ServiceContract</span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">public</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">interface</span> <span style="color: #2b91af;">ITechAltum</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
[<span style="color: #2b91af;">OperationContract</span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<span style="color: #2b91af;">EmployeeRecord</span> EmpData(<span style="color: #2b91af;">EmployeeRecord</span> er);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">Now implement it in the class.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
System.Collections.Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System.Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System.Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">public</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">class</span> <span style="color: #2b91af;">TechAltum</span>:<span style="color: #2b91af;">ITechAltum</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<span style="color: blue;">public</span> <span style="color: #2b91af;">EmployeeRecord</span>
EmpData(<span style="color: #2b91af;">EmployeeRecord</span> er)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">if</span>
(er.token == <span style="color: #a31515;">"1234"</span>)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> er.empid = 101;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> er.name = <span style="color: #a31515;">"Isha"</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">return</span>
er;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN">As you can see that it check the token, if
token is valid then it assign information in the same class.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN">Now implement it in the client side.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN">as we know that in the method it takes
EmpRecord types as input and it returns it same as output. But at client side
we will work on Ref parameter in this case which is shown as follows:-<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjB0m0siB6klr7IwVcZEUI2aq4zYe13KFCW6HQQ5k2dJAZzzOFf6gfxqBwla0bPxcbnh2km5ofLRIWGmoCL6ncAJOlD9G0Gng7CllQ_bc-BwE2UNBDTyfIS0N1mIASkMhByrI97zieDHFg/s1600/msg-1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="288" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjB0m0siB6klr7IwVcZEUI2aq4zYe13KFCW6HQQ5k2dJAZzzOFf6gfxqBwla0bPxcbnh2km5ofLRIWGmoCL6ncAJOlD9G0Gng7CllQ_bc-BwE2UNBDTyfIS0N1mIASkMhByrI97zieDHFg/s640/msg-1.png" width="640" /></a></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<v:shapetype coordsize="21600,21600" filled="f" id="_x0000_t75" o:preferrelative="t" o:spt="75" path="m@4@5l@4@11@9@11@9@5xe" stroked="f">
<v:stroke joinstyle="miter">
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0">
<v:f eqn="sum @0 1 0">
<v:f eqn="sum 0 0 @1">
<v:f eqn="prod @2 1 2">
<v:f eqn="prod @3 21600 pixelWidth">
<v:f eqn="prod @3 21600 pixelHeight">
<v:f eqn="sum @0 0 1">
<v:f eqn="prod @6 1 2">
<v:f eqn="prod @7 21600 pixelWidth">
<v:f eqn="sum @8 21600 0">
<v:f eqn="prod @7 21600 pixelHeight">
<v:f eqn="sum @10 21600 0">
</v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:formulas>
<v:path gradientshapeok="t" o:connecttype="rect" o:extrusionok="f">
<o:lock aspectratio="t" v:ext="edit">
</o:lock></v:path></v:stroke></v:shapetype><v:shape alt="Description: C:\Users\Avi\Desktop\msg-1.png" id="_x0000_i1029" style="height: 210.75pt; mso-wrap-style: square; visibility: visible; width: 468pt;" type="#_x0000_t75">
<v:imagedata o:title="msg-1" src="file:///C:\Users\Avi\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png">
</v:imagedata></v:shape><span lang="EN-IN"><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN">Figure 1<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN">As you can see it shows that this method is
void type. So we will pass input as ref type parameter.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN">For Example:-<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
System.Collections.Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System.Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System.Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System.Web.UI;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
System.Web.UI.WebControls;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">public</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">partial</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">_Default</span> : System.Web.UI.<span style="color: #2b91af;">Page</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<span style="color: blue;">protected</span> <span style="color: blue;">void</span>
Page_Load(<span style="color: blue;">object</span> sender, <span style="color: #2b91af;">EventArgs</span> e)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> ServiceReference1.<span style="color: #2b91af;">TechAltumClient</span> svctech = <span style="color: blue;">new</span>
ServiceReference1.<span style="color: #2b91af;">TechAltumClient</span>();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> ServiceReference1.<span style="color: #2b91af;">EmployeeRecord</span> empRec = <span style="color: blue;">new</span>
ServiceReference1.<span style="color: #2b91af;">EmployeeRecord</span>();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> empRec.token = <span style="color: #a31515;">"1234"</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//we pass
input as ref type</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> svctech.EmpData(<span style="color: blue;">ref</span> empRec.token, <span style="color: blue;">ref</span>
empRec.empid, <span style="color: blue;">ref</span> empRec.name);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> Response.Write(empRec.empid + <span style="color: #a31515;">" "</span>
+ empRec.name);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN">Similarly if we do not pass any input
parameter to the service in that case we pass these data as out parameter.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-size: 12.0pt; line-height: 115%;">For Example:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-size: 12.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<span lang="EN-IN">Add another method in your contract which
returns the object of EmployeeRecord and not taking any input:-<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">[<span style="color: #2b91af;">ServiceContract</span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">public</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">interface</span> <span style="color: #2b91af;">ITechAltum</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
[<span style="color: #2b91af;">OperationContract</span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<span style="color: #2b91af;">EmployeeRecord</span> EmpOutData();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN">Now implement it in the class:-<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
System.Collections.Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System.Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System.Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">public</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">class</span> <span style="color: #2b91af;">TechAltum</span>:<span style="color: #2b91af;">ITechAltum</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<span style="color: blue;">public</span>
<span style="color: #2b91af;">EmployeeRecord</span> EmpOutData()<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;">EmployeeRecord</span>
er = <span style="color: blue;">new</span> <span style="color: #2b91af;">EmployeeRecord</span>();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> er.empid = 102;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> er.name = <span style="color: #a31515;">"Priya"</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> er.token = <span style="color: #a31515;">"P-123"</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">return</span>
er;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN">Now see the code at client side:-<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLzYF9-KWG3_6UDjDvLGuSSmFcpGQyT5yxZa_W4LXVdwQepIGMv1Oej4YzZVcPDV6kL_8fid32kzWhPJddcCNIunNFnXLZxHTDqoJdlREY372OLwMQ7zW6GEhnLbk0HNS4l7P5BuoQ9h4/s1600/msg-2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="312" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLzYF9-KWG3_6UDjDvLGuSSmFcpGQyT5yxZa_W4LXVdwQepIGMv1Oej4YzZVcPDV6kL_8fid32kzWhPJddcCNIunNFnXLZxHTDqoJdlREY372OLwMQ7zW6GEhnLbk0HNS4l7P5BuoQ9h4/s640/msg-2.png" width="640" /></a></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<v:shape alt="Description: C:\Users\Avi\Desktop\msg-2.png" id="Picture_x0020_5" o:spid="_x0000_i1028" style="height: 229.5pt; mso-wrap-style: square; visibility: visible; width: 468pt;" type="#_x0000_t75">
<v:imagedata o:title="msg-2" src="file:///C:\Users\Avi\AppData\Local\Temp\msohtmlclip1\01\clip_image002.png">
</v:imagedata></v:shape><span lang="EN-IN"><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN">Figure 2<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN">As you can see that now its taking input as
out and its return type is showing as string. This is message header which is
Token and its data type is string. In this case it will return token.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
System.Collections.Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System.Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System.Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System.Web.UI;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
System.Web.UI.WebControls;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">public</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">partial</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">_Default</span> : System.Web.UI.<span style="color: #2b91af;">Page</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<span style="color: blue;">protected</span> <span style="color: blue;">void</span>
Page_Load(<span style="color: blue;">object</span> sender, <span style="color: #2b91af;">EventArgs</span> e)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> ServiceReference1.<span style="color: #2b91af;">TechAltumClient</span> svctech = <span style="color: blue;">new</span>
ServiceReference1.<span style="color: #2b91af;">TechAltumClient</span>();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> ServiceReference1.<span style="color: #2b91af;">EmployeeRecord</span> empRec = <span style="color: blue;">new</span>
ServiceReference1.<span style="color: #2b91af;">EmployeeRecord</span>();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> empRec.token=.svctech.EmpOutData(<span style="color: blue;">out</span> empRec.empid, <span style="color: blue;">out</span>
empRec.name);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> Response.Write(empRec.empid + <span style="color: #a31515;">" "</span>+
empRec.name+ <span style="color: #a31515;">" "</span> empRec.token);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN">Hope you enjoyed the article.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN">Note:-if you are not aware about the
concept of Ref and Out then kindly study it first.<span class="GingerNoCheckEnd"></span><span class="GingerNoCheckEnd"></span><o:p></o:p></span></div>
</div>
Anonymoushttp://www.blogger.com/profile/08203366298489829818noreply@blogger.com0tag:blogger.com,1999:blog-8432909598061906445.post-17319976959796623512013-03-15T04:57:00.001-07:002013-03-15T04:59:42.867-07:00WCF Lesson 2:- Data Contract in WCF<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div align="center" class="MsoNormal" style="text-align: center;">
<br />
<div class="MsoNormal" style="text-align: left;">
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="f347e29e-e9f1-4e67-9c1a-571eccfd46d6" ginger_sofatware_uiphraseguid="97da906f-4afd-4842-b765-85384c197b5f" grcontextid="for:0">for</span> any query you can mail me at Malhotra.isha3388@gmail.com.</div>
<div class="MsoNormal" style="text-align: left;">
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="3c565a1e-cdcd-4e1a-a8f8-de85cf8beea1" ginger_sofatware_uiphraseguid="6579b395-7181-4777-99a8-20c3254b866a" grcontextid="you:0">you</span> can also mail me your <span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="65a54326-2c10-45f3-b510-217fdd3cbbb6" ginger_sofatware_uiphraseguid="6579b395-7181-4777-99a8-20c3254b866a" grcontextid="wcf:1">wcf</span> problem which you face in your project</div>
<br />
<b><u><span lang="EN-IN" style="font-size: 22.0pt; line-height: 115%;">Data
Contract in WCF<o:p></o:p></span></u></b></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN">In the previous article I described basic
Idea of WCF and Service Contract. Now I am going to describe your data contract.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN">As we know that WCF exchange information in
XML format. Data contract defines which data type is serialized (convert into
Xml). Primitive data types like int, string etc. <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="d5e96ece-ddb0-4ae3-a8bc-c30b8e4e2ee9" ginger_sofatware_uiphraseguid="a5058fda-87d0-42b3-83b0-943b69c5c544" grcontextid="serialized:0">serialized</span> already as they
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="d57ea2b6-e669-46b1-b2c6-2f3efa08236b" ginger_sofatware_uiphraseguid="f72eba37-af57-49c4-aaa9-df0b4bc7f7aa" grcontextid="defined:0">defined</span> in XSD (Xml Schema Definition). But custom data types like classes are
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="ae27b0d5-4a01-4af6-8c26-2ceb1a51e5c9" ginger_sofatware_uiphraseguid="c66c3888-7cde-48a9-8037-79e049329213" grcontextid="not:0">not</span>.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="0677c221-e03a-4e11-9651-e623efd781e5" ginger_sofatware_uiphraseguid="84318e14-0181-45bc-961b-0915863f13f7" grcontextid="Wcf:0">Wcf</span> uses serialization engine i.e. Data
Contract <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="e655b6f3-1fb7-4280-a0f9-b1246bade8e0" ginger_sofatware_uiphraseguid="80113c20-228a-4463-b24a-ea2c71db2498" grcontextid="Serializer:0">Serializer</span> by default to serialize and DE serialize the data.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN">We can use DataContract attribute to
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="c1c3f72e-54cb-4f56-8e19-1f80dc0a303b" ginger_sofatware_uiphraseguid="03e80c60-df51-42a1-bacd-d206759cdbd2" grcontextid="serialize:0">serialize</span> the class and DataMember attribute to Serialize its member. <o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">For Example:-<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<span lang="EN-IN">In following example I simply create a
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="63b20796-cccc-4738-a0ff-5fe40b5e3b6e" ginger_sofatware_uiphraseguid="496b0888-c0cb-48b1-91d8-5ce4bf4f19e8" grcontextid="class:0">class</span> EmpData and declare two members in it. In service I create a simple
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="ce9834b3-e31d-4fee-b1c8-1e8e3b031210" ginger_sofatware_uiphraseguid="0d3af6ca-86b4-444a-9a4c-09359ed0314a" grcontextid="method:0">method</span> which returns the object of EmpData with some information.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-IN"></span></div>
<a name='more'></a><br />
<br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><u><span lang="EN-IN" style="font-family: Consolas; font-size: 14.0pt;">Interface <o:p></o:p></span></u></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="7799e9e3-becb-4008-9b92-e40e605c01b1" ginger_sofatware_uiphraseguid="8373ffaa-422c-4ee9-965e-ed03524099fd" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="0c9f209d-535d-478d-ae48-f37713667005" ginger_sofatware_uiphraseguid="8373ffaa-422c-4ee9-965e-ed03524099fd" grcontextid="System:1">System</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="a739d195-3f1e-4dc6-bea4-c9486ae4bee9" ginger_sofatware_uiphraseguid="a040c0d2-b029-4d60-9439-066d242148a1" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="63a76d10-8804-49c0-8ccb-6bfc842e6378" ginger_sofatware_uiphraseguid="880a0cad-6528-4d15-adf4-d1aaf51de01b" grcontextid=".:0">.</span>Collections<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="a4c980b4-0902-43cf-b31d-24ea538c3277" ginger_sofatware_uiphraseguid="880a0cad-6528-4d15-adf4-d1aaf51de01b" grcontextid=".:1">.</span>Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="0894ef69-88e2-450f-9108-061927aee656" ginger_sofatware_uiphraseguid="d38fd383-42cf-497c-9ee4-9aa499210e92" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="a99cce19-ce9c-4310-8454-2f91987bdf92" ginger_sofatware_uiphraseguid="d38fd383-42cf-497c-9ee4-9aa499210e92" grcontextid=".:1">.</span>Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="e973ddf2-5c58-42ec-a070-0263cca05202" ginger_sofatware_uiphraseguid="394d88b0-c2c0-44f8-afea-c24f526fd174" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="845847ec-2271-4ece-a0ed-374f4615f703" ginger_sofatware_uiphraseguid="394d88b0-c2c0-44f8-afea-c24f526fd174" grcontextid=".:1">.</span>Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="b042d478-1805-46d3-95ed-0aa0076b1954" ginger_sofatware_uiphraseguid="e3a2f28a-a840-414d-b4e5-910fb7126155" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="8e57f80d-cf04-433b-a7af-cec8db261332" ginger_sofatware_uiphraseguid="e3a2f28a-a840-414d-b4e5-910fb7126155" grcontextid=".:1">.</span>ServiceModel;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">[<span style="color: #2b91af;">ServiceContract</span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="4c04922b-5f76-4328-b3bd-b560f3e6a3ef" ginger_sofatware_uiphraseguid="8f4bedd7-50cd-4c33-849d-2d100f2c5cc2" grcontextid="public:0">public</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">interface</span> <span style="color: #2b91af;">ITechAltum</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
[<span style="color: #2b91af;">OperationContract</span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<span style="color: #2b91af;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="53be2b7a-1fdd-4667-b4cc-24fa5a97df5a" ginger_sofatware_uiphraseguid="02410e17-5c46-4309-9a87-796ebeec1bea" grcontextid="EmpData:0">EmpData</span></span> EmpRec<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="e810059b-906b-40ce-8bd4-011a9a129b1b" ginger_sofatware_uiphraseguid="02410e17-5c46-4309-9a87-796ebeec1bea" grcontextid="(:1">(</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><u><span lang="EN-IN" style="font-family: Consolas; font-size: 16.0pt;">Data
Member Class<o:p></o:p></span></u></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="cbcbc795-fed2-4854-9736-6aa83a4ad37d" ginger_sofatware_uiphraseguid="2c45e0f3-f959-4ae2-9a87-f16f3a4afe93" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="02364dc9-2154-48d7-9965-b8ecf6e6a2bc" ginger_sofatware_uiphraseguid="2c45e0f3-f959-4ae2-9a87-f16f3a4afe93" grcontextid="System:1">System</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="b16f4a19-d060-4ed7-9174-6b68361eddd8" ginger_sofatware_uiphraseguid="e44cd8b9-ccfa-499c-85cd-cfeeeeb38cae" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="c6ed07e7-bf67-4d41-bf63-19d881fdbdc4" ginger_sofatware_uiphraseguid="a7ab3b6f-4a17-4ecc-8082-f6153088914f" grcontextid=".:0">.</span>Collections<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="ce0a5406-73b2-4000-8810-fb7326375519" ginger_sofatware_uiphraseguid="a7ab3b6f-4a17-4ecc-8082-f6153088914f" grcontextid=".:1">.</span>Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="f47a9b98-a39f-49a0-90a9-be805662e503" ginger_sofatware_uiphraseguid="53177039-c952-4eec-842c-743590655352" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="32a39fef-04b3-4673-9f63-07bd0c3ef735" ginger_sofatware_uiphraseguid="53177039-c952-4eec-842c-743590655352" grcontextid=".:1">.</span>Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="7a96e4c7-546c-43c3-8457-43be413e090b" ginger_sofatware_uiphraseguid="f5a181e2-80dd-4f53-afb4-3825fac2beb7" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="feac2694-92af-4bfd-a6be-93c9b7100565" ginger_sofatware_uiphraseguid="f5a181e2-80dd-4f53-afb4-3825fac2beb7" grcontextid=".:1">.</span>Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="1a6f3eb6-26f9-4605-8abd-3f14a41a746e" ginger_sofatware_uiphraseguid="54ce347d-85f5-4853-ab70-80e3b930af1c" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="7a1a2653-eb66-4c55-8538-1372f9ac6933" ginger_sofatware_uiphraseguid="54ce347d-85f5-4853-ab70-80e3b930af1c" grcontextid=".:1">.</span>ServiceModel;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="a2853389-c68d-4221-8c02-476bf972664f" ginger_sofatware_uiphraseguid="98f6fd00-1025-4d9c-be79-8ff37db89797" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="cb76fb0a-7195-4c9d-b6a1-05642d9bebab" ginger_sofatware_uiphraseguid="244e22fd-a437-40be-987a-56d9fe215730" grcontextid=".:0">.</span>Runtime<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="63ac9d67-6bf9-4b00-afaa-22595738c7c3" ginger_sofatware_uiphraseguid="244e22fd-a437-40be-987a-56d9fe215730" grcontextid=".:1">.</span>Serialization;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">[<span style="color: #2b91af;">DataContract</span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="b3284585-ba8f-4c45-ab1b-1dcb11c39ad9" ginger_sofatware_uiphraseguid="b106d8a8-60e2-45fb-b976-77391f4eb4bf" grcontextid="public:0">public</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">class</span> <span style="color: #2b91af;">EmpData</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
[<span style="color: #2b91af;">DataMember</span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="e7c44fce-0b76-4bd9-8a24-f23d5c655f29" ginger_sofatware_uiphraseguid="b37a6c5a-91e5-44ee-b7cd-46495e196a7a" grcontextid="public:0">public</span></span> <span style="color: blue;"><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="65b8833f-5583-4ad4-9569-f117d8a3470e" ginger_sofatware_uiphraseguid="b37a6c5a-91e5-44ee-b7cd-46495e196a7a" grcontextid="int:1">int</span></span>
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="d003e55b-50bc-4b3d-a5c0-2be4bebfef70" ginger_sofatware_uiphraseguid="15ca7979-39f7-44d0-a771-ab00a0cdafb0" grcontextid="id:0">id</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
[<span style="color: #2b91af;">DataMember</span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="c5ed1733-940e-4e90-ac66-5773e3333165" ginger_sofatware_uiphraseguid="e10e5802-f4c7-4bca-8c48-9ee02c6f3782" grcontextid="public:0">public</span></span> <span style="color: blue;">string</span>
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="7d412dda-da4d-4553-948b-8fb179c38463" ginger_sofatware_uiphraseguid="c2a7789e-8e2d-4208-9140-9465fe6fa8a1" grcontextid="name:0">name</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="13eb0462-ddb2-4ca8-874d-934aa8d4f28e" ginger_sofatware_uiphraseguid="f42a6c9f-d310-4338-b05b-a61b589aedf5" grcontextid="public:0">public</span></span> <span style="color: blue;"><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="5408f688-53f9-4acc-be1c-8ca15b457f1f" ginger_sofatware_uiphraseguid="f42a6c9f-d310-4338-b05b-a61b589aedf5" grcontextid="int:1">int</span></span>
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="08d67e12-c709-446b-81bb-9d0c09c98d1a" ginger_sofatware_uiphraseguid="1a04ca72-fc77-44ef-9532-92abf6384124" grcontextid="age:0">age</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">As you can see here that I didn’t assign
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="a70ab068-8a5f-4f21-a37e-7fc77664c7d4" ginger_sofatware_uiphraseguid="a7770581-5879-404f-a05b-96d890e6193d" grcontextid="data:0">data</span> member <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="678fe766-d624-4e6b-9fb7-d7b7b393e56b" ginger_sofatware_uiphraseguid="a7770581-5879-404f-a05b-96d890e6193d" grcontextid="attribute:1">attribute</span> <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="36564777-7f0f-49d3-a207-541637b0e8c3" ginger_sofatware_uiphraseguid="a7770581-5879-404f-a05b-96d890e6193d" grcontextid="on:2">on</span> age. So this will not serialize and will not be accessed
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="9080d97a-28ff-45d7-87a0-259a0e9ad37c" ginger_sofatware_uiphraseguid="eccc5485-87d6-431d-a8cb-725081b49c03" grcontextid="the:0">the</span> outside.<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN">I implement this interface in the following
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="387ce9f3-296d-40a8-986c-17cc1845e136" ginger_sofatware_uiphraseguid="5c68ad0a-009f-4737-8877-1a8bd4720bbf" grcontextid="class:0">class</span>:-<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="23ec6cfa-2aef-4aa7-8302-a5cea5cb7f2e" ginger_sofatware_uiphraseguid="4b170e98-ed7b-434b-bc38-299fd0956166" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="a357227f-3961-44f0-ba0c-a05d51c038fb" ginger_sofatware_uiphraseguid="4b170e98-ed7b-434b-bc38-299fd0956166" grcontextid="System:1">System</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="f234055d-1152-45a6-baa5-3188e3aae303" ginger_sofatware_uiphraseguid="f934d302-8209-4304-b7bd-41149cfb1b4e" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="d73ba140-5067-4668-ad60-44b9b4105105" ginger_sofatware_uiphraseguid="9d12f14e-e074-4853-8c83-a3e4459e628a" grcontextid=".:0">.</span>Collections<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="ba0653b7-e0bf-4176-a6f7-f575e7c45a7a" ginger_sofatware_uiphraseguid="9d12f14e-e074-4853-8c83-a3e4459e628a" grcontextid=".:1">.</span>Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="82a37bc7-4ef6-4099-8cea-15fd4b56089b" ginger_sofatware_uiphraseguid="6215b153-3d55-4175-a91f-cf8fc072d5ca" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="a3211ce5-7ff1-4855-b65a-da72247b7851" ginger_sofatware_uiphraseguid="6215b153-3d55-4175-a91f-cf8fc072d5ca" grcontextid=".:1">.</span>Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="b483c5e4-b30f-4fff-8341-9413c115a2e3" ginger_sofatware_uiphraseguid="0e44f2b7-8af7-4dc7-8c83-8ae27e5163f0" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="474813b7-a1a6-43f1-9611-2918d0c2f438" ginger_sofatware_uiphraseguid="0e44f2b7-8af7-4dc7-8c83-8ae27e5163f0" grcontextid=".:1">.</span>Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="bce40dee-466f-4bd8-8109-ed578b6496cf" ginger_sofatware_uiphraseguid="ae41c988-da3b-445b-8720-949e4d85825f" grcontextid="public:0">public</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">class</span> <span style="color: #2b91af;">TechAltum</span>: <span style="color: #2b91af;">ITechAltum</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="d6eae012-64ef-4f84-aa53-8ca1919a31a3" ginger_sofatware_uiphraseguid="a03d800c-dfba-4dbe-8a7d-1220c589ac4c" grcontextid="public:0">public</span></span> <span style="color: #2b91af;">EmpData</span>
<span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="e55f6b79-270d-4425-92a4-3ae2f361a719" ginger_sofatware_uiphraseguid="c8ed5343-3f65-45c6-97e2-f527164fa4a6" grcontextid="EmpRec:0">EmpRec</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="93bdcbc6-9b83-48f0-bf58-c385ac0257f0" ginger_sofatware_uiphraseguid="c8ed5343-3f65-45c6-97e2-f527164fa4a6" grcontextid="(:1">(</span>)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: #2b91af;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="9a5ef5bb-ef2f-4ab6-9efb-8ca2636f2378" ginger_sofatware_uiphraseguid="40c20907-b6ce-471a-ae74-34777b429fd7" grcontextid="EmpData:0">EmpData</span></span>
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="aecdb199-15af-4a14-a820-dac7b67264ad" ginger_sofatware_uiphraseguid="ae47233f-e10b-4178-bfde-e72196c236c6" grcontextid="ev:0">ev</span> = <span style="color: blue;">new</span> <span style="color: #2b91af;">EmpData</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="0a0450d1-4ed3-4532-ade1-90868fd2f3c6" ginger_sofatware_uiphraseguid="ae47233f-e10b-4178-bfde-e72196c236c6" grcontextid="(:1">(</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="3beb0293-e0f6-4cf4-b2df-af47b691b5b0" ginger_sofatware_uiphraseguid="db0ef361-c1d8-4a47-a5ba-2ab512f2b7f7" grcontextid="ev.id:0">ev.id</span> = 101;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="1b2d27d3-257f-4dfc-a665-a214fede1a5d" ginger_sofatware_uiphraseguid="ca4abeb2-ccd2-4138-8126-692fd711ce4d" grcontextid="ev:0">ev</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="ec01ac77-aa5a-4a97-917f-1c00888db122" ginger_sofatware_uiphraseguid="ca4abeb2-ccd2-4138-8126-692fd711ce4d" grcontextid=".:1">.</span>name = <span style="color: #a31515;">"<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="c5b25ae3-a772-4af8-804f-af2685c9aa9a" ginger_sofatware_uiphraseguid="ca4abeb2-ccd2-4138-8126-692fd711ce4d" grcontextid="isha:2">isha</span>"</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="b3502446-f710-4a2a-888e-70c3934b3048" ginger_sofatware_uiphraseguid="2da40088-7e18-4b0c-b6fa-21c1f9aa8e23" grcontextid="ev:0">ev</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="ef1ba61d-dddd-487c-8803-1d7b0fc0573b" ginger_sofatware_uiphraseguid="2da40088-7e18-4b0c-b6fa-21c1f9aa8e23" grcontextid=".:1">.</span>age = 25;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="6e6543fb-fffa-49b3-8971-55b216692172" ginger_sofatware_uiphraseguid="2f988cc5-e9d7-46d4-b79a-8e1aa0839c91" grcontextid="return:0">return</span></span>
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="c3b56854-27f6-4d22-8429-9aa6c12f90cd" ginger_sofatware_uiphraseguid="ae1314d2-d59c-48a8-b35a-280c13af72b8" grcontextid="ev:0">ev</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;">Changes in <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="1670e757-1226-406e-835f-ff4ce9664b4c" ginger_sofatware_uiphraseguid="af0c1dab-e9c8-4ac1-942e-141827e407a0" grcontextid="Sevice:0">Sevice</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="91099ab9-6ffb-41c6-a5bc-c5604dc17ef3" ginger_sofatware_uiphraseguid="af0c1dab-e9c8-4ac1-942e-141827e407a0" grcontextid=".:1">.</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="b2a42f99-a669-4832-bee9-765ec9f7d716" ginger_sofatware_uiphraseguid="af0c1dab-e9c8-4ac1-942e-141827e407a0" grcontextid="svc:2">svc</span><o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="background: yellow; font-family: Consolas; font-size: 9.5pt; mso-highlight: yellow;"><%</span><span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;">@</span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<span style="color: maroon;">ServiceHost</span> <span style="color: red;">Language</span><span style="color: blue;">="C#"</span> <span style="color: red;">Debug</span><span style="color: blue;">="true"</span> <span style="color: red;">Service</span><span style="color: blue;">="TechAltum"</span> <span style="color: red;">CodeBehind</span><span style="color: blue;">="~/App_Code/TechAltum.cs"</span> <span style="background: yellow; mso-highlight: yellow;">%><o:p></o:p></span></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><u><span lang="EN-IN" style="font-size: 14.0pt; line-height: 115%;"><br /></span></u></b></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 12.0pt; line-height: 115%;">Now
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="adaf5ede-4ec8-4a54-be2e-be72c056b36a" ginger_sofatware_uiphraseguid="ec753bd6-dc1e-44aa-9286-897ce870d1b8" grcontextid="implement:0">implement</span> it <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="df47cb04-6eb7-440e-b0c7-67f2a62945f5" ginger_sofatware_uiphraseguid="ec753bd6-dc1e-44aa-9286-897ce870d1b8" grcontextid="in:1">in</span> the client side. As we know that our service will return the
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="ee341dd8-6567-4e22-9fd5-72da1e029b6b" ginger_sofatware_uiphraseguid="cadaa14a-c766-454a-9282-b480be3d4468" grcontextid="object:0">object</span> of EmpData class. So we also have to create the object of that class. <o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 12.0pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="8ede05c4-7a09-4760-9e76-f75107681715" ginger_sofatware_uiphraseguid="0644dc82-ad0f-41f8-8a16-1aa08ad8b284" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="1ec8a937-43ef-4ac1-b9dd-9796bd6e055b" ginger_sofatware_uiphraseguid="0644dc82-ad0f-41f8-8a16-1aa08ad8b284" grcontextid="System:1">System</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="cfe5a1d7-0d35-46f9-be50-19ef40668deb" ginger_sofatware_uiphraseguid="c543f0c2-cb52-4eba-a723-54027e26cd00" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="4740b6ea-b236-4f80-89f3-544848bf39ec" ginger_sofatware_uiphraseguid="ed6832a1-7b58-4da0-a8cb-d2188d6cc337" grcontextid=".:0">.</span>Collections<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="bfa674e5-260b-4ebc-ad1f-28f4f406daaa" ginger_sofatware_uiphraseguid="ed6832a1-7b58-4da0-a8cb-d2188d6cc337" grcontextid=".:1">.</span>Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="cd3c8ff2-0b01-4dfa-ac70-29fe5c083ef3" ginger_sofatware_uiphraseguid="19cd3218-4d74-411e-b17c-17dbec4f85f0" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="1ea0bed0-8eaf-4f9e-9aa1-5ef02d957fc6" ginger_sofatware_uiphraseguid="19cd3218-4d74-411e-b17c-17dbec4f85f0" grcontextid=".:1">.</span>Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="9790f8c1-6e9c-403f-89a7-5d075167715f" ginger_sofatware_uiphraseguid="6769a806-48a2-45c0-b972-df9a789c3709" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="7c8e94ee-0b68-4fe4-8d44-567c271c00ce" ginger_sofatware_uiphraseguid="6769a806-48a2-45c0-b972-df9a789c3709" grcontextid=".:1">.</span>Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="8f9e35ea-a638-4480-9c83-9396a509e6e9" ginger_sofatware_uiphraseguid="2941a2c7-e31e-45c4-b75c-23af4fd43dc0" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="dab735c4-012b-42b8-9ca4-2213cda332a0" ginger_sofatware_uiphraseguid="2941a2c7-e31e-45c4-b75c-23af4fd43dc0" grcontextid=".:1">.</span>Web<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="58463a68-110c-48ae-9849-be04ac57c4e6" ginger_sofatware_uiphraseguid="2941a2c7-e31e-45c4-b75c-23af4fd43dc0" grcontextid=".:2">.</span>UI;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="9cf04eb7-87a0-4de1-8ec5-5b21cb20a887" ginger_sofatware_uiphraseguid="523b7797-f777-478c-a20a-2ed38fc03e41" grcontextid="using:0">using</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="5a4503eb-b2ad-40ec-809a-6a31bbd8eb99" ginger_sofatware_uiphraseguid="9e0da545-83a7-43f9-a841-843283e9bd1a" grcontextid=".:0">.</span>Web<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="2e33dbe9-1fd8-4095-9993-aeacf9bd3ea1" ginger_sofatware_uiphraseguid="9e0da545-83a7-43f9-a841-843283e9bd1a" grcontextid=".:1">.</span>UI<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="2ee5ccae-6828-4ad1-98ee-538c99f17398" ginger_sofatware_uiphraseguid="9e0da545-83a7-43f9-a841-843283e9bd1a" grcontextid=".:2">.</span>WebControls;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="97ca4312-a321-46ec-a84a-0ca000afc9d6" ginger_sofatware_uiphraseguid="15a9acf3-902e-49a0-a412-1738462d06bb" grcontextid="public:0">public</span></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">partial</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">_Default</span> : System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="54d1385e-be3e-41b3-ba64-d608117a8750" ginger_sofatware_uiphraseguid="15a9acf3-902e-49a0-a412-1738462d06bb" grcontextid=".:1">.</span>Web<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="64ac5c3d-0d0a-4073-9df9-1c55d1ee1c8f" ginger_sofatware_uiphraseguid="15a9acf3-902e-49a0-a412-1738462d06bb" grcontextid=".:2">.</span>UI<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="1ece042d-385b-4d33-bc72-7a2cf2d91f73" ginger_sofatware_uiphraseguid="15a9acf3-902e-49a0-a412-1738462d06bb" grcontextid=".:3">.</span><span style="color: #2b91af;">Page</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
<span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="f5b23d23-6f10-45b9-bdd1-26f8427feb9d" ginger_sofatware_uiphraseguid="9fe82692-3c37-40f0-84b6-20d9edb496fd" grcontextid="protected:0">protected</span></span> <span style="color: blue;">void</span>
Page_Load<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="08ec26cc-4102-44e4-93ee-8c4fae54f6a0" ginger_sofatware_uiphraseguid="8ce64ab3-7e15-4734-9685-f8cdbfbe52be" grcontextid="(:0">(</span><span style="color: blue;">object</span> sender, <span style="color: #2b91af;">EventArgs</span> e)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> ServiceReference1.<span style="color: #2b91af;">TechAltumClient</span> <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="aebca60e-544c-49d7-865a-cd95e0274f41" ginger_sofatware_uiphraseguid="e125e97e-e398-4d30-b001-1c3a76dc4bc2" grcontextid="ta:0">ta</span> = <span style="color: blue;">new</span>
ServiceReference1.<span style="color: #2b91af;">TechAltumClient</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="318be034-ff69-4eb8-bbbf-a6e1b85426af" ginger_sofatware_uiphraseguid="874c4a51-178e-45d7-b01b-5419aa0f5081" grcontextid="(:0">(</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> ServiceReference1.<span style="color: #2b91af;">EmpData</span> <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="cae32bbf-c908-4ee3-b4ad-00a5ff5015af" ginger_sofatware_uiphraseguid="c2b4e26b-823f-4210-bfa3-05a6fbe9b02c" grcontextid="ed:0">ed</span> = <span style="color: blue;">new</span>
ServiceReference1.<span style="color: #2b91af;">EmpData</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="a56c1663-c6a9-4eb3-b63a-e51eb0870e93" ginger_sofatware_uiphraseguid="416a1e9e-0a1e-4bca-923b-74ecb9962a98" grcontextid="(:0">(</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="a7aaa87b-df00-4325-983f-165aa2629a9d" ginger_sofatware_uiphraseguid="a7c3b947-1370-44cd-b146-7d10101dd216" grcontextid="ed:0">ed</span> = <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="016cd312-de02-4d27-89a9-88932d02d535" ginger_sofatware_uiphraseguid="a7c3b947-1370-44cd-b146-7d10101dd216" grcontextid="ta:1">ta</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="98314e28-0081-4e66-8d8c-4a21efccfddb" ginger_sofatware_uiphraseguid="a7c3b947-1370-44cd-b146-7d10101dd216" grcontextid=".:2">.</span>EmpRec<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="601839b5-12ee-45ae-b5a4-3fd353a2aa65" ginger_sofatware_uiphraseguid="a7c3b947-1370-44cd-b146-7d10101dd216" grcontextid="(:3">(</span>);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"> Response<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="209eacbc-45b3-4c17-ab8d-92605361681e" ginger_sofatware_uiphraseguid="f8a45df0-f3e6-4084-91d1-667427c58ff1" grcontextid=".:0">.</span>Write<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="a8145ca4-de23-4e94-a4b5-0bec2b1254f0" ginger_sofatware_uiphraseguid="f8a45df0-f3e6-4084-91d1-667427c58ff1" grcontextid="(:1">(</span><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="d4950d6b-243c-46b1-bbb6-bfa6cc311161" ginger_sofatware_uiphraseguid="f8a45df0-f3e6-4084-91d1-667427c58ff1" grcontextid="ed.id:2">ed.id</span> + <span style="color: #a31515;">" "</span> + <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="a0c3d96e-b396-49ac-b3f7-d6685fc5514a" ginger_sofatware_uiphraseguid="f8a45df0-f3e6-4084-91d1-667427c58ff1" grcontextid="ed:3">ed</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="24375937-b64d-4be5-a7ef-e8da370e09dd" ginger_sofatware_uiphraseguid="f8a45df0-f3e6-4084-91d1-667427c58ff1" grcontextid=".:4">.</span>name);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">
}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;">As we didn’t serialize the age so
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="6359df2f-ef89-43c3-983f-efde23129e39" ginger_sofatware_uiphraseguid="cb1feaeb-5110-40ba-aea2-f27bd96be965" grcontextid="we:0">we</span> will not able to access it on our client side as shown in the following
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="afaebf1b-e6ce-41ba-bce7-4a7ef6756e64" ginger_sofatware_uiphraseguid="3743ca12-9872-417e-a45a-3dbf66b1b8bc" grcontextid="image:0">image</span> of code.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXgdb1rYjTNlCNh1n6wtr_FxNycK6noaSomjkSlmoFB9C8rdlZUwLZm2KTnAhu4KxAZLGc2S4Y1z1Wc7AvSK2pR_-n0-EWGxOoxzchqp0bLf2sP94DSF9zJpKxZXIAYPYMH5iCboqrBdw/s1600/Untitled.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="358" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXgdb1rYjTNlCNh1n6wtr_FxNycK6noaSomjkSlmoFB9C8rdlZUwLZm2KTnAhu4KxAZLGc2S4Y1z1Wc7AvSK2pR_-n0-EWGxOoxzchqp0bLf2sP94DSF9zJpKxZXIAYPYMH5iCboqrBdw/s640/Untitled.png" width="640" /></a></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-no-proof: yes;"><v:shapetype coordsize="21600,21600" filled="f" id="_x0000_t75" o:preferrelative="t" o:spt="75" path="m@4@5l@4@11@9@11@9@5xe" stroked="f">
<v:stroke joinstyle="miter">
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0">
<v:f eqn="sum @0 1 0">
<v:f eqn="sum 0 0 @1">
<v:f eqn="prod @2 1 2">
<v:f eqn="prod @3 21600 pixelWidth">
<v:f eqn="prod @3 21600 pixelHeight">
<v:f eqn="sum @0 0 1">
<v:f eqn="prod @6 1 2">
<v:f eqn="prod @7 21600 pixelWidth">
<v:f eqn="sum @8 21600 0">
<v:f eqn="prod @7 21600 pixelHeight">
<v:f eqn="sum @10 21600 0">
</v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:f></v:formulas>
<v:path gradientshapeok="t" o:connecttype="rect" o:extrusionok="f">
<o:lock aspectratio="t" v:ext="edit">
</o:lock></v:path></v:stroke></v:shapetype><v:shape alt="Description: C:\Users\Avi\Desktop\Untitled.png" id="Picture_x0020_13" o:spid="_x0000_i1028" style="height: 480pt; mso-wrap-style: square; visibility: visible; width: 468pt;" type="#_x0000_t75">
<v:imagedata o:title="Untitled" src="file:///C:\Users\Avi\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png">
</v:imagedata></v:shape></span><span lang="EN-IN" style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-IN" style="font-size: 12.0pt; line-height: 115%;">As
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="45a94079-1491-439e-84e7-e5991eb836dd" ginger_sofatware_uiphraseguid="3d0afd6e-cb92-4039-9908-f26d6d34aba1" grcontextid="we:0">we</span> can see that it shows only id and name not age.<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/08203366298489829818noreply@blogger.com14tag:blogger.com,1999:blog-8432909598061906445.post-42717205626397823722012-07-12T11:21:00.000-07:002013-03-15T04:59:21.517-07:00WCF-Lesson 1<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal">
This is the basic application to
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="18f6ddf3-45c7-4499-bc25-062ff9ffc187" ginger_sofatware_uiphraseguid="9bde7804-c093-4ff8-965d-868c90852e25" grcontextid="interact:0">interact</span> with <span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="12118bc6-06e4-4d05-97e4-bd425fc3b8e0" ginger_sofatware_uiphraseguid="9bde7804-c093-4ff8-965d-868c90852e25" grcontextid="wcf:1">wcf</span> service.<o:p></o:p></div>
<div class="MsoNormal">
for any query you can mail me at Malhotra.isha3388@gmail.com.</div>
<div class="MsoNormal">
you can also mail me your wcf problem which you face in your project</div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b><u><span style="font-size: 22pt; line-height: 115%;">Basic Application
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="9ca15004-7760-4711-af27-3bb0ea0cc504" ginger_sofatware_uiphraseguid="e580ee2f-1f77-47e5-a1b7-a8db10ec0e50" grcontextid="with:0">with</span> the help of WCF<o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="59c3788f-a4fc-403d-a72c-0845b9539f34" ginger_sofatware_uiphraseguid="0b55df99-8f4d-415a-8328-c00321f9349a" grcontextid="Wcf:0">Wcf</span> stands for windows communication foundation. It is
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="303261da-0976-4890-9673-2f06c9d1d365" ginger_sofatware_uiphraseguid="00786205-00a2-434c-a114-a5471490e2a5" grcontextid="introduced:0">introduced</span> in .<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="aa7acb31-bf08-4754-98ee-9a0f5a831da8" ginger_sofatware_uiphraseguid="00786205-00a2-434c-a114-a5471490e2a5" grcontextid="net:1">net</span> framework 3.0.<o:p></o:p></div>
<div class="MsoNormal">
<span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="80a44d99-f5fa-4c82-ad68-21f81f974913" ginger_sofatware_uiphraseguid="3109942a-abeb-4e0d-ace9-2e33ca09881d" grcontextid="Wcf:0">Wcf</span> is <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="dc3f4fb0-7e72-4541-80dd-cac5e90fe9c4" ginger_sofatware_uiphraseguid="3109942a-abeb-4e0d-ace9-2e33ca09881d" grcontextid="network:1">network</span>-distributed service oriented technology. It
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="5e98898e-180e-4d4f-a2c9-b3c84e9f78d8" ginger_sofatware_uiphraseguid="454f197d-1bf7-4343-bff3-7bbc4b90ea66" grcontextid="is:0">is</span> combination Web Service, Remoting, MSMQ and Com+.<o:p></o:p></div>
<div class="MsoNormal">
System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="80d9f584-0548-4257-b9c0-197ee0fa03e7" ginger_sofatware_uiphraseguid="c82c4191-3ea5-4d8d-92fe-21238896e736" grcontextid=".:0">.</span><span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="a27f7c9f-d701-4ae9-afaa-ef6f3c5a52d4" ginger_sofatware_uiphraseguid="c82c4191-3ea5-4d8d-92fe-21238896e736" grcontextid="servicemodal:1">servicemodal</span> is <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="26930762-a7ee-4300-b6c4-f4e90bed5b81" ginger_sofatware_uiphraseguid="c82c4191-3ea5-4d8d-92fe-21238896e736" grcontextid="namespace:2">namespace</span> for wcf service.<o:p></o:p></div>
<div align="center" class="MsoNormal" style="text-align: center;">
<b><u><span style="font-size: 16pt; line-height: 115%;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="c5ff46a8-f10c-4be7-b5d2-267a2e00ec46" ginger_sofatware_uiphraseguid="e699adb4-758e-45ef-8109-985f2a0867f9" grcontextid="EndPoints:0">EndPoints</span><o:p></o:p></span></u></b></div>
<div class="MsoNormal">
<span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="48282f01-98c1-4f4f-9a5d-45934064af32" ginger_sofatware_uiphraseguid="91bd97ea-091c-46e6-870e-0db88428b230" grcontextid="Wcf:0">Wcf</span> consists of many endpoints. Following is the component
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="ddc4abcc-de82-48ea-85b5-1644f9e9c4d2" ginger_sofatware_uiphraseguid="36e0b673-ee57-4dd4-85ed-031a72eba2ba" grcontextid="of:0">of</span> Endpoint.<o:p></o:p></div>
<div class="MsoNormal">
->Address<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="bf6687d9-e215-4f71-bc3f-23cdbb7a6ec5" ginger_sofatware_uiphraseguid="a8741b1c-defc-429b-bf38-8f04fd48bbdf" grcontextid="::0">:</span>- it describes where the service resides in the
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="28963c99-6c94-4209-97aa-f3d4eeea4499" ginger_sofatware_uiphraseguid="dc113f6a-b6a1-4d4e-b2a3-a60c8c86e687" grcontextid="network:0">network</span>.<o:p></o:p></div>
<div class="MsoNormal">
->Binding<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="d712033e-ff03-48f9-b39c-deb99a47344d" ginger_sofatware_uiphraseguid="7d98b14f-f6cd-4865-a2e5-d9f285e7da8e" grcontextid="::0">:</span>-it describes how the service interacts with <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="f6b841fb-85a5-4dc1-ad0f-3a312f7c6cf8" ginger_sofatware_uiphraseguid="7d98b14f-f6cd-4865-a2e5-d9f285e7da8e" grcontextid="application:1">application</span>.<o:p></o:p></div>
<div class="MsoNormal">
->Contracts<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="6d35d5b7-085a-462d-bbb4-cdfbdda17a29" ginger_sofatware_uiphraseguid="df178207-dbe7-46c0-a87c-321b8c356704" grcontextid="::0">:</span>-it describes what service will do.<o:p></o:p></div>
<div class="MsoNormal">
</div>
<a name='more'></a><br />
<br />
<div class="MsoNormal">
<b>Note<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="3e14097b-a6e0-4c4d-b22b-e6eff0b4dca0" ginger_sofatware_uiphraseguid="86f26222-305d-427a-ae20-7739875b37b4" grcontextid="::0">:</span>-all endpoints
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="d1837505-bfef-4902-9b2b-5fdd696c1134" ginger_sofatware_uiphraseguid="b9e01928-cb60-421d-b26b-d9eb8af9eb98" grcontextid="mentioned:0">mentioned</span> in the web<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="a010c9ac-f08a-4e39-994f-1fc630df698a" ginger_sofatware_uiphraseguid="b9e01928-cb60-421d-b26b-d9eb8af9eb98" grcontextid=".:1">.</span>config file.<o:p></o:p></b></div>
<div class="MsoNormal">
<b><u>Example:-<o:p></o:p></u></b></div>
<div class="MsoNormal">
Following is the basic example of wcf service. This is
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="627bbc13-0ac0-450d-904b-fe488fd3800d" ginger_sofatware_uiphraseguid="a40a328c-527f-45db-ad31-68e61d1a1e80" grcontextid="example:0">example</span> is made to only interact with you and describe you what the wcf service
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="d26db4e5-a5e2-412c-a815-2c09d9cd6e8d" ginger_sofatware_uiphraseguid="041921e1-af6b-4378-8bca-82b719431c4e" grcontextid="is:0">is</span>…<o:p></o:p></div>
<div class="MsoNormal">
In wcf service we have to work with Interface and Class.<o:p></o:p></div>
<div class="MsoNormal">
In interface we declare the method which will be implemented
in the class.<o:p></o:p></div>
<div class="MsoNormal">
Every Wcf Service should have at least one Service
Contract<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="78086e1e-e4f2-4d40-ad69-1871f9a4a2d3" ginger_sofatware_uiphraseguid="fda2d6db-cf68-4b60-9a1d-64d2165f1bbd" grcontextid="(:0">(</span>as contract defines what the service will do). It defines using [ServiceContract] (same like
[<span class="GINGER_SOFATWARE_noSuggestion GINGER_SOFATWARE_correct" ginger_sofatware_markguid="fc88c784-11b2-4cb6-af86-a19ad9f494f6" ginger_sofatware_uiphraseguid="f4fa574e-513f-4735-8e98-bcf8aa4067da" grcontextid="WebService:0">WebService</span>] in <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="32812e90-0c54-4174-9a09-0d611b6bd0c7" ginger_sofatware_uiphraseguid="f4fa574e-513f-4735-8e98-bcf8aa4067da" grcontextid="Web Servi ce:1">Web Servi ce</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="fe7519ce-2303-4cea-b8a3-86caa1047f87" ginger_sofatware_uiphraseguid="f4fa574e-513f-4735-8e98-bcf8aa4067da" grcontextid="):2">)</span>and [OperationContract<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="7e445f87-85f9-499d-abc1-99f39db37380" ginger_sofatware_uiphraseguid="f4fa574e-513f-4735-8e98-bcf8aa4067da" grcontextid="]:3">]</span>(same like [WebMethod] in
Web Service) Attribute.<o:p></o:p></div>
<div class="MsoNormal">
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="dcce8bbb-8e53-4544-b549-6b6733b0f83e" ginger_sofatware_uiphraseguid="a7b927b2-482a-4cbd-81ee-992ecfdab28f" grcontextid="Following steps:0">Following steps</span> describe the wcf service. By using this
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="7d532c3e-8f2a-469e-865c-33ac8f0280c7" ginger_sofatware_uiphraseguid="6f103c68-10f6-4f5c-a3fd-3b69f613a4ab" grcontextid="steps:0">steps</span> you can create the basic application for wcf:-<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l2 level1 lfo1; text-indent: -18.0pt;">
1.<span style="font-size: 7pt;">
</span>Open visual studio 2010. Go to the
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="9c3c6ae2-c844-44dc-b452-6c35c7437721" ginger_sofatware_uiphraseguid="1f1e9eca-4ba1-4452-af17-28ec5a9ea4c9" grcontextid="file:0">file</span>->New->Website.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
Following window will be opened.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
Select wcf service <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="e3425fc3-0ead-433e-b2d3-3da2b26b6d53" ginger_sofatware_uiphraseguid="095053d8-dfb8-4a4d-8583-5669e9bf67f0" grcontextid="form:1">form</span> this window.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpLast">
<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3oWPZ9K72MDW7Rhw7HmwWJDBRVu2iPnCJzsuhxOhXfshxgNKhk-VLEerf2kIBJX6PQQYQyNCeQM67HDJ9gduFvkmdNjtsCVo6pSnhHnvz_riVh3DZOoOJZ58AcC1pGtCJPnLns-TOJ3M/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="356" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3oWPZ9K72MDW7Rhw7HmwWJDBRVu2iPnCJzsuhxOhXfshxgNKhk-VLEerf2kIBJX6PQQYQyNCeQM67HDJ9gduFvkmdNjtsCVo6pSnhHnvz_riVh3DZOoOJZ58AcC1pGtCJPnLns-TOJ3M/s640/1.png" width="640" /></a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoListParagraph" style="mso-list: l2 level1 lfo1; tab-stops: 93.0pt; text-indent: -18.0pt;">
2.<span style="font-size: 7pt;"> </span>As
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="c563bff6-324c-429f-8b8f-b3f30d1c1421" ginger_sofatware_uiphraseguid="0a555dfe-826f-4fac-acb2-9348153b28d0" grcontextid="we:0">we</span> can see one interface <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="48acb382-9d7c-4fc4-96a6-f0672f69686b" ginger_sofatware_uiphraseguid="0a555dfe-826f-4fac-acb2-9348153b28d0" grcontextid="IService:1">IService</span> and one Class Service<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="68004c40-bc7b-40c6-beea-3399acc1caaa" ginger_sofatware_uiphraseguid="0a555dfe-826f-4fac-acb2-9348153b28d0" grcontextid=".:2">.</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="028d0baa-d1d1-4e5b-bf9d-812e12e27212" ginger_sofatware_uiphraseguid="0a555dfe-826f-4fac-acb2-9348153b28d0" grcontextid="cs:3">cs</span>. <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="214d2ae7-6b0c-4f95-b231-091f0a553a05" ginger_sofatware_uiphraseguid="eae10f46-3247-416d-b063-2d84a5073ba8" grcontextid="when:0">when</span> we open the
wcf service all <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="f8f008c8-2135-47e5-9188-8e14066a0337" ginger_sofatware_uiphraseguid="50016b19-71a1-4b99-aa6e-2354842945fc" grcontextid="configuration:1">configuration</span> made with this interface and class. If we will
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="2ccd0ea6-4265-4c4c-a269-6392431e275c" ginger_sofatware_uiphraseguid="06e36b32-4d77-418e-9dfc-c1b6a0614cb7" grcontextid="work:0">work</span> with the same interface and service we need not to change any
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="f48debc4-e4a1-4449-93cd-e1320bffb034" ginger_sofatware_uiphraseguid="ce19c3fe-76dc-40ca-8c70-a3442c8d3e9a" grcontextid="configuration:0">configuration</span>. But if we want to make our own interface and class we have to
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="04f4f3a6-3d02-42da-ab92-c01d3558e527" ginger_sofatware_uiphraseguid="0de6a7b3-f9e9-473c-86d0-400a2330fa80" grcontextid="make:0">make</span> some changes in <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="a7c34671-7a89-42f5-89b2-885fd235a2fa" ginger_sofatware_uiphraseguid="0de6a7b3-f9e9-473c-86d0-400a2330fa80" grcontextid="configuration file:1">configuration file</span>. <o:p></o:p></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjgoOd-oqwFFd5q-scnW915b5JOJwyxzcoCTCKlsYQsTnvyBQj20Y9E2KU6g7OU9ulcDWSU2L5CX1BJIgVcR6Gm1WvKEPFQIB3QzYYX8IFFxAprsb1eXUogviiM8siobPlqU6b4ksmrXM/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="358" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjgoOd-oqwFFd5q-scnW915b5JOJwyxzcoCTCKlsYQsTnvyBQj20Y9E2KU6g7OU9ulcDWSU2L5CX1BJIgVcR6Gm1WvKEPFQIB3QzYYX8IFFxAprsb1eXUogviiM8siobPlqU6b4ksmrXM/s640/2.png" width="640" /></a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l2 level1 lfo1; tab-stops: 93.0pt; text-indent: -18.0pt;">
3.<span style="font-size: 7pt;"> </span>As
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="871965e1-ec84-4566-83b1-76c1078cb6a1" ginger_sofatware_uiphraseguid="dcae8a44-ff4b-4366-9176-499dd46d4d26" grcontextid="we:0">we</span> deleted inbuilt interface and class and created our own interface
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="0ab76b45-3be5-4a5a-be41-e6279868bbe5" ginger_sofatware_uiphraseguid="3b42fc7e-58a0-4c2c-bc8e-3608e400232a" grcontextid="Itechnology:0">Itechnology</span> and try to add [ServiceContract] but its not showing <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="f48f74e0-d9ff-4302-8d4e-2a89a28773b8" ginger_sofatware_uiphraseguid="3b42fc7e-58a0-4c2c-bc8e-3608e400232a" grcontextid="becoz:1">becoz</span> we
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="c37930ca-24ed-4a10-abbf-f61a2eac3d34" ginger_sofatware_uiphraseguid="bc4d7403-b854-4fb1-98cc-c21ef36cb3e7" grcontextid="didn’t:0">didn’t</span> use the namespace System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="1fb5cbd6-9bf9-46ba-81b1-b7a639a6ece5" ginger_sofatware_uiphraseguid="bc4d7403-b854-4fb1-98cc-c21ef36cb3e7" grcontextid=".:1">.</span>ServiceModal.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh84wJJFHKITiUrWKzacvGWQFkTokJ8QWgjDjz9P_lQ2_1RtaF-tMY5y_DvUiymNa8BIvVN535MhZEfnuTR2IE8E3-9jLx39Hu46mKha2jsFI-Yv9c0_rto39yYObqICEAL5eK0wmONIkE/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="358" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh84wJJFHKITiUrWKzacvGWQFkTokJ8QWgjDjz9P_lQ2_1RtaF-tMY5y_DvUiymNa8BIvVN535MhZEfnuTR2IE8E3-9jLx39Hu46mKha2jsFI-Yv9c0_rto39yYObqICEAL5eK0wmONIkE/s640/3.png" width="640" /></a></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo1; tab-stops: 93.0pt; text-indent: -18.0pt;">
4.<span style="font-size: 7pt;"> </span>In
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="8c358566-edd6-49e3-b49e-4ca1fdaaf51d" ginger_sofatware_uiphraseguid="888311de-5e1b-470f-b572-b679db4e1fc8" grcontextid="this:0">this</span> step we will add the system<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="24460205-7a93-4687-9399-9bcefb687d10" ginger_sofatware_uiphraseguid="888311de-5e1b-470f-b572-b679db4e1fc8" grcontextid=".:1">.</span>ServiceModal namespace and <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="4155036f-5d91-43c4-93bc-ab00db5b9149" ginger_sofatware_uiphraseguid="888311de-5e1b-470f-b572-b679db4e1fc8" grcontextid="then add:2">then add</span> the
[ServiceContract]<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLMRZ9DmNXkElqc2X3n0pcKDENBaSPSOPN3JL6P47ONoOP46wiABGL6dt8dhXhFUedsDItXfVaUYZBJEd8xHHkdOgcZ2ZDC7A6ofX4EkBjCssSj26jR6tiQ4HE8e5EV09UOzI6rFhgSJQ/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="358" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLMRZ9DmNXkElqc2X3n0pcKDENBaSPSOPN3JL6P47ONoOP46wiABGL6dt8dhXhFUedsDItXfVaUYZBJEd8xHHkdOgcZ2ZDC7A6ofX4EkBjCssSj26jR6tiQ4HE8e5EV09UOzI6rFhgSJQ/s640/5.png" width="640" /></a></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo1; tab-stops: 93.0pt; text-indent: -18.0pt;">
5.<span style="font-size: 7pt;"> </span>In
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="55eac1e6-92d9-456e-ab1c-d0f608969283" ginger_sofatware_uiphraseguid="0b7d9012-a0e7-42e1-979e-a6ca1bc5445a" grcontextid="this step we:0">this step we</span> add the method which takes the 2 parameters and returns its sum.
We also add class name <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="5ed053ca-60d9-48f3-b7a9-a86479b6905b" ginger_sofatware_uiphraseguid="56a65470-5eae-4e9e-8486-01732c9e050a" grcontextid="TechnologyImplementation:0">TechnologyImplementation</span>. <o:p></o:p></div>
<div class="MsoListParagraphCxSpLast">
<br /></div>
<div align="center" class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center;">
<span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="eee01d0f-abba-4c5a-b997-bebc50fec702" ginger_sofatware_uiphraseguid="0e11ccac-7afd-402f-a641-27b46a4c87d6" grcontextid="Itechnology:0">Itechnology</span>
Interface</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="b6205131-4a2b-4666-8e38-ddb0ffbd524b" ginger_sofatware_uiphraseguid="6e917a65-04f3-4431-a09b-2664af067883" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="95b1d1ae-3cc2-41e8-a275-09f6e7ec4d59" ginger_sofatware_uiphraseguid="6e917a65-04f3-4431-a09b-2664af067883" grcontextid="System:1">System</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="86b9bcee-507e-44a0-b7f0-e6658ca20b2e" ginger_sofatware_uiphraseguid="cd3de700-564f-4a49-a830-7a63c90c9e01" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="03a68c72-d7b1-4c73-a302-f28824e10f92" ginger_sofatware_uiphraseguid="cd3de700-564f-4a49-a830-7a63c90c9e01" grcontextid=".:1">.</span>Collections<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="99844668-ec1d-4e3b-96f4-ecd0438ee4fe" ginger_sofatware_uiphraseguid="cd3de700-564f-4a49-a830-7a63c90c9e01" grcontextid=".:2">.</span>Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="009ac37a-9c76-487c-a14f-eb4dba522567" ginger_sofatware_uiphraseguid="1ebacd88-dfe8-4ef8-932c-8a92e20ffc41" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="5471563c-0724-498d-a543-5c4a316f120b" ginger_sofatware_uiphraseguid="1ebacd88-dfe8-4ef8-932c-8a92e20ffc41" grcontextid=".:1">.</span>Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="0cfe7f8b-eaf7-4639-b09b-abeb9f72b965" ginger_sofatware_uiphraseguid="c12d4664-66c8-4cb2-9a29-c86df0644c57" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="417df498-f63e-48a4-9009-af82d683d491" ginger_sofatware_uiphraseguid="c12d4664-66c8-4cb2-9a29-c86df0644c57" grcontextid=".:1">.</span>Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="4fd98f12-ee6e-4ca3-9b80-bbb42b24d604" ginger_sofatware_uiphraseguid="a41c0d5a-63dd-4673-a790-4f415dad963d" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="0238035f-18bf-4b08-bfaf-ceabcf894e43" ginger_sofatware_uiphraseguid="a41c0d5a-63dd-4673-a790-4f415dad963d" grcontextid=".:1">.</span>ServiceModel;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">[<span style="color: #2b91af;">ServiceContract</span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="3ed251a2-418f-47de-957b-a0f57076ae87" ginger_sofatware_uiphraseguid="fd105dc9-eaa8-4774-bf16-5930e29347f8" grcontextid="public:0">public</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">interface</span> <span style="color: #2b91af;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="17a05096-a0bb-4e46-b8af-1c0af51260d5" ginger_sofatware_uiphraseguid="fd105dc9-eaa8-4774-bf16-5930e29347f8" grcontextid="Itechnology:1">Itechnology</span></span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> [<span style="color: #2b91af;">OperationContract</span>]<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">int</span> sum(<span style="color: blue;">int</span> x, <span style="color: blue;">int</span> y);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpFirst">
<br /></div>
<div align="center" class="MsoListParagraphCxSpLast" style="tab-stops: 93.0pt; text-align: center;">
<span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt; line-height: 115%;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="0d7a8739-9f94-490c-9215-31fca29689a4" ginger_sofatware_uiphraseguid="5bcaa778-7ad6-4c79-a41a-897d2c87b599" grcontextid="TechnologyImplementation:0">TechnologyImplementation</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="92277f9b-1a6b-45c3-bced-5065749c7718" ginger_sofatware_uiphraseguid="5bcaa778-7ad6-4c79-a41a-897d2c87b599" grcontextid=".:1">.</span><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="b4d62a36-b587-47ee-a298-85b0c7356eaf" ginger_sofatware_uiphraseguid="5bcaa778-7ad6-4c79-a41a-897d2c87b599" grcontextid="cs:2">cs</span> Class</span><o:p></o:p></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="ed3da1fd-2979-4538-8f27-08a4dd857018" ginger_sofatware_uiphraseguid="23436177-14d4-489f-be96-d7dbaee9ae83" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="909dd0d8-bae6-4155-8eee-ef001e490458" ginger_sofatware_uiphraseguid="23436177-14d4-489f-be96-d7dbaee9ae83" grcontextid="System:1">System</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="6ecf5589-30bf-4abf-952c-b6d1c781dfd7" ginger_sofatware_uiphraseguid="75e73a6b-05b3-43b4-b6e7-99ee400ac449" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="fe86be8c-80ce-4d2d-8edb-73c271249ddc" ginger_sofatware_uiphraseguid="75e73a6b-05b3-43b4-b6e7-99ee400ac449" grcontextid=".:1">.</span>Collections<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="44a3ba9b-f7eb-4a87-b8d1-bf29d9ef10f2" ginger_sofatware_uiphraseguid="75e73a6b-05b3-43b4-b6e7-99ee400ac449" grcontextid=".:2">.</span>Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="04651a75-bf1e-430a-9227-9b9f7b7acbc4" ginger_sofatware_uiphraseguid="1a8a61ea-88be-4448-8946-ff509bfe440f" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="59e19739-4fc2-4d95-b162-c4feba5cf2a2" ginger_sofatware_uiphraseguid="1a8a61ea-88be-4448-8946-ff509bfe440f" grcontextid=".:1">.</span>Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="9e74244f-4cae-4153-b5bd-964fa2050047" ginger_sofatware_uiphraseguid="c14abb02-0320-474c-87dc-184acc8124af" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="d355de5a-4f50-4922-92be-4310e0f333d5" ginger_sofatware_uiphraseguid="c14abb02-0320-474c-87dc-184acc8124af" grcontextid=".:1">.</span>Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: grey; font-family: Consolas; font-size: 9.5pt;">///</span><span style="color: green; font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: grey; font-family: Consolas; font-size: 9.5pt;"><<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="50f933a6-1c1d-40d4-9ccc-7124a54da91d" ginger_sofatware_uiphraseguid="3c76f437-e64c-48be-b7da-2e87c247967b" grcontextid="summary:0">summary</span>></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: grey; font-family: Consolas; font-size: 9.5pt;">///</span><span style="color: green; font-family: Consolas; font-size: 9.5pt;"> Summary description for
<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="73ea0210-6d6a-4c51-9e64-41ffc2170be9" ginger_sofatware_uiphraseguid="26fb77a3-ada6-4ef9-99cc-7b4b374fabdd" grcontextid="TechnologyImplementation:0">TechnologyImplementation</span></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: grey; font-family: Consolas; font-size: 9.5pt;">///</span><span style="color: green; font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: grey; font-family: Consolas; font-size: 9.5pt;"></<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="23b3d2a0-460c-4132-867e-e55bf801c196" ginger_sofatware_uiphraseguid="9926496c-b149-4dbd-902d-56664dff3437" grcontextid="summary:0">summary</span>></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="5b5b1fdb-f827-456e-b075-1636f73c86f4" ginger_sofatware_uiphraseguid="047da3a7-2459-4d04-975c-2ffb48fd5b77" grcontextid="public:0">public</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">class</span> <span style="color: #2b91af;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="04d47bc1-74d5-43ca-abaf-2a3a68b137ee" ginger_sofatware_uiphraseguid="047da3a7-2459-4d04-975c-2ffb48fd5b77" grcontextid="TechnologyImplementation:1">TechnologyImplementation</span></span>: <span style="color: #2b91af;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="47eb849d-aec7-47d4-b1a5-4c4b38a27e0e" ginger_sofatware_uiphraseguid="047da3a7-2459-4d04-975c-2ffb48fd5b77" grcontextid="Itechnology:2">Itechnology</span></span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="a14ed129-fa5d-410c-8506-28bc77ad86cc" ginger_sofatware_uiphraseguid="604421ad-cbab-4cdf-ade0-6dfce74ed1c7" grcontextid="public:0">public</span></span> <span style="color: blue;">int</span> sum<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="ab698021-7579-4a46-9c47-78ad9a711b55" ginger_sofatware_uiphraseguid="604421ad-cbab-4cdf-ade0-6dfce74ed1c7" grcontextid="(:1">(</span><span style="color: blue;">int</span> x, <span style="color: blue;">int</span> y)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="336feded-f7fa-42d0-92fe-318349ffdfd7" ginger_sofatware_uiphraseguid="ba38ef73-8198-42a9-a506-9310c6dc2e43" grcontextid="return:0">return</span></span> x + y;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpFirst">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo1; tab-stops: 93.0pt; text-indent: -18.0pt;">
6.<span style="font-size: 7pt;"> </span>Make
changes in Web.Config file.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l1 level1 lfo2; tab-stops: 93.0pt; text-indent: -18.0pt;">
a)<span style="font-size: 7pt;">
</span>In <system.serviceModel> tag include new
tag <services><o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l1 level1 lfo2; tab-stops: 93.0pt; text-indent: -18.0pt;">
b)<span style="font-size: 7pt;">
</span>Add service name. this name should be the name
which is the name of your class.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l1 level1 lfo2; tab-stops: 93.0pt; text-indent: -18.0pt;">
c)<span style="font-size: 7pt;">
</span>Add your endpoint in <services> tag.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l1 level1 lfo2; tab-stops: 93.0pt; text-indent: -18.0pt;">
d)<span style="font-size: 7pt;">
</span>Leave the address blank as this is the basic
application and running on local host so no need to give the address. We will
learn this attribute in next lesson.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l1 level1 lfo2; tab-stops: 93.0pt; text-indent: -18.0pt;">
e)<span style="font-size: 7pt;">
</span>Add the contract name. contract name should be
the Interface name which you added.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l1 level1 lfo2; tab-stops: 93.0pt; text-indent: -18.0pt;">
f)<span style="font-size: 7pt;">
</span>Give the binding name basicHttpBinding as its
simle binding without any security and will run on http protocol.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; tab-stops: 93.0pt;">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; tab-stops: 93.0pt;">
<br /></div>
<div class="MsoListParagraphCxSpLast">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><?</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">xml</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt;">version</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">=</span><span style="font-family: Consolas; font-size: 9.5pt;">"<span style="color: blue;">1.0</span>"<span style="color: blue;">?></span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">configuration</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> <</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">system.web</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> <</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">compilation</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt;">debug</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">=</span><span style="font-family: Consolas; font-size: 9.5pt;">"<span style="color: blue;">true</span>"<span style="color: blue;"> </span><span style="color: red;">targetFramework</span><span style="color: blue;">=</span>"<span style="color: blue;">4.0</span>"<span style="color: blue;">/></span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> </</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">system.web</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> <</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">system.serviceModel</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">
<</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">services</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">
<</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">service</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt;">name</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">=</span><span style="font-family: Consolas; font-size: 9.5pt;">"<span style="color: blue;">TechnologyImplementation</span>"<span style="color: blue;">></span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">
<</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">endpoint</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt;">address</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">=</span><span style="font-family: Consolas; font-size: 9.5pt;">""<span style="color: blue;"> </span><span style="color: red;">contract</span><span style="color: blue;">=</span>"<span style="color: blue;">Itechnology</span>"<span style="color: blue;"> </span><span style="color: red;">binding</span><span style="color: blue;">=</span>"<span style="color: blue;">basicHttpBinding</span>"<span style="color: blue;">></</span><span style="color: #a31515;">endpoint</span><span style="color: blue;">></span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">
</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">
</</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">service</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">
</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">
</span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">
</</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">services</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> <</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">behaviors</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> <</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">serviceBehaviors</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> <</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">behavior</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> <!--</span><span style="color: green; font-family: Consolas; font-size: 9.5pt;"> To avoid disclosing
metadata information, set the value below to false and remove the metadata
endpoint above before deployment </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">--></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> <</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">serviceMetadata</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt;">httpGetEnabled</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">=</span><span style="font-family: Consolas; font-size: 9.5pt;">"<span style="color: blue;">true</span>"<span style="color: blue;">/></span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> <!--</span><span style="color: green; font-family: Consolas; font-size: 9.5pt;"> To receive exception
details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid
disclosing exception information </span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">--></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> <</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">serviceDebug</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt;">includeExceptionDetailInFaults</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">=</span><span style="font-family: Consolas; font-size: 9.5pt;">"<span style="color: blue;">false</span>"<span style="color: blue;">/></span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> </</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">behavior</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> </</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">serviceBehaviors</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> </</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">behaviors</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> <</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">serviceHostingEnvironment</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt;">multipleSiteBindingsEnabled</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">=</span><span style="font-family: Consolas; font-size: 9.5pt;">"<span style="color: blue;">true</span>"<span style="color: blue;">/></span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> </</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">system.serviceModel</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> <</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">system.webServer</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> <</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">modules</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> </span><span style="color: red; font-family: Consolas; font-size: 9.5pt;">runAllManagedModulesForAllRequests</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">=</span><span style="font-family: Consolas; font-size: 9.5pt;">"<span style="color: blue;">true</span>"<span style="color: blue;">/></span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"> </</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">system.webServer</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"></</span><span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;">configuration</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">></span><span style="font-family: Consolas; font-size: 9.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoListParagraphCxSpFirst">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo1; tab-stops: 93.0pt; text-indent: -18.0pt;">
7.<span style="font-size: 7pt;"> </span>Make
changes in Service.svc file.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; tab-stops: 93.0pt; text-indent: -18.0pt;">
a)<span style="font-size: 7pt;">
</span>Give the service name same the name of your
class.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; tab-stops: 93.0pt; text-indent: -18.0pt;">
b)<span style="font-size: 7pt;">
</span>Add class name in codebehind.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 54.0pt; mso-add-space: auto; mso-list: l0 level1 lfo3; tab-stops: 93.0pt; text-indent: -18.0pt;">
c)<span style="font-size: 7pt;">
</span>And after that run the application<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 0.0001pt;">
<span style="background-color: yellow; font-family: Consolas; font-size: 9.5pt;"><%</span><span style="color: blue; font-family: Consolas; font-size: 9.5pt;">@</span><span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: maroon;">ServiceHost</span> <span style="color: red;">Language</span><span style="color: blue;">="C#"</span>
<span style="color: red;">Debug</span><span style="color: blue;">="true"</span>
<span style="color: red;">Service</span><span style="color: blue;">="TechnologyImplementation"</span>
<span style="color: red;">CodeBehind</span><span style="color: blue;">="~/App_Code/TechnologyImplementation.cs"</span>
<span style="background-color: yellow;">%><o:p></o:p></span></span></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQld3N3Dd29cQFFJzmZoyZwgRz_um5XjkgEochlQvy6-nPoAyC7s3D0WSrW-RgN6o4NvBLpq5G1SbCkGhEBqQX6ducoa4xX6T7ifmSBlyWneg0ikoHcT07BNopnSs-zijsaUAPhgJpDLg/s1600/14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="358" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQld3N3Dd29cQFFJzmZoyZwgRz_um5XjkgEochlQvy6-nPoAyC7s3D0WSrW-RgN6o4NvBLpq5G1SbCkGhEBqQX6ducoa4xX6T7ifmSBlyWneg0ikoHcT07BNopnSs-zijsaUAPhgJpDLg/s640/14.png" width="640" /></a></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpLast">
<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l2 level1 lfo1; tab-stops: 198.0pt; text-indent: -18.0pt;">
8.<span style="font-size: 7pt;"> </span>Copy
this url and create new website where we will call this service. And click on
the add service reference.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
<o:p></o:p></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMZtuXYcScggwYJp9iHnx81MMZo8LFoO6khEE_8Uj1qd2pIDcZjV78LQwmOdsKlULcnybrqSe3B4BXmxTb8XhMuAjxZfnPa3oFuG2DevclFL_wvukn_13RMSzhkM_ifaJQCXVMvNxogV4/s1600/16.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="359" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMZtuXYcScggwYJp9iHnx81MMZo8LFoO6khEE_8Uj1qd2pIDcZjV78LQwmOdsKlULcnybrqSe3B4BXmxTb8XhMuAjxZfnPa3oFuG2DevclFL_wvukn_13RMSzhkM_ifaJQCXVMvNxogV4/s640/16.png" width="640" /></a></div>
<div class="MsoListParagraphCxSpLast">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAigo2KyTN7sd_KUdbOKJAUSaj8jUW7M3qqBDAiLvKEwY4LsRIDn3A7bEhEaAlvT7hnjhAQry7B04UzOMr56opI0R7nzYNSR-BqFxdGkxnbr-YBgL6BdvRa54gHqg2Mova9ax0WntxmwM/s1600/18.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="358" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAigo2KyTN7sd_KUdbOKJAUSaj8jUW7M3qqBDAiLvKEwY4LsRIDn3A7bEhEaAlvT7hnjhAQry7B04UzOMr56opI0R7nzYNSR-BqFxdGkxnbr-YBgL6BdvRa54gHqg2Mova9ax0WntxmwM/s640/18.png" width="640" /></a></div>
<div class="MsoNormal">
<o:p></o:p></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l2 level1 lfo1; tab-stops: 291.0pt; text-indent: -18.0pt;">
9.<span style="font-size: 7pt;"> </span>Paste
this url here and click on the go Button and after that click on ok to add the
service<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo1; tab-stops: 291.0pt; text-indent: -18.0pt;">
10.<span style="font-size: 7pt;"> </span>Create
web page <o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnJQTOcjzFtXBge5uNk4jbeaID_Df038sOtSpTL8t1LL4ReEgwGFgG0h7LFq4ewOiOjM1OE3AGyjhs4uqZRnJ7qcRuH4qbJLDYxcQXnky7kZfhwyLU0m_wf41TaTIUi4itlZiJCPz7m4I/s1600/19.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="358" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnJQTOcjzFtXBge5uNk4jbeaID_Df038sOtSpTL8t1LL4ReEgwGFgG0h7LFq4ewOiOjM1OE3AGyjhs4uqZRnJ7qcRuH4qbJLDYxcQXnky7kZfhwyLU0m_wf41TaTIUi4itlZiJCPz7m4I/s640/19.png" width="640" /></a></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo1; tab-stops: 291.0pt; text-indent: -18.0pt;">
11.<span style="font-size: 7pt;"> </span>Do
following coding<o:p></o:p></div>
<div class="MsoListParagraphCxSpLast">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="fb62cd25-e6c4-462d-9136-d14068f734a4" ginger_sofatware_uiphraseguid="11574232-0983-4742-bf00-c26e29b6dad2" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> <span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="75960c21-12a9-4684-9dad-7374fb4942e9" ginger_sofatware_uiphraseguid="11574232-0983-4742-bf00-c26e29b6dad2" grcontextid="System:1">System</span>;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="fccfccdf-caeb-47df-9782-1106d8bc0ff4" ginger_sofatware_uiphraseguid="e422137d-eaa1-47ba-9444-fc3af9764f27" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="aefcbe5e-ae77-4876-939e-65a828765368" ginger_sofatware_uiphraseguid="e422137d-eaa1-47ba-9444-fc3af9764f27" grcontextid=".:1">.</span>Collections<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="ec23dd51-f4c8-4750-9c51-84f2f2c4eaa5" ginger_sofatware_uiphraseguid="e422137d-eaa1-47ba-9444-fc3af9764f27" grcontextid=".:2">.</span>Generic;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="ffc6d989-5748-43bf-947b-8c2d583fb6ca" ginger_sofatware_uiphraseguid="2653a9f6-e3b6-40c7-9ab4-80086c250fdd" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="f2026407-f1e2-4f6a-8ae1-c4b8b23755aa" ginger_sofatware_uiphraseguid="2653a9f6-e3b6-40c7-9ab4-80086c250fdd" grcontextid=".:1">.</span>Linq;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;"><span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="350d0e05-b8bb-444b-8a3b-8b355e74e589" ginger_sofatware_uiphraseguid="d3b052f9-3c18-4e4b-8e2c-b307feeccb91" grcontextid="using:0">using</span></span><span style="font-family: Consolas; font-size: 9.5pt;"> System<span class="GINGER_SOFATWARE_correct" ginger_sofatware_markguid="65c94ada-3949-41c8-9a09-139089efc1f4" ginger_sofatware_uiphraseguid="d3b052f9-3c18-4e4b-8e2c-b307feeccb91" grcontextid=".:1">.</span>Web;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System.Web.UI;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="font-family: Consolas; font-size: 9.5pt;"> System.Web.UI.WebControls;<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Consolas; font-size: 9.5pt;">public</span><span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">partial</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">_Default</span> :
System.Web.UI.<span style="color: #2b91af;">Page</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">protected</span> <span style="color: blue;">void</span>
Page_Load(<span style="color: blue;">object</span> sender, <span style="color: #2b91af;">EventArgs</span> e)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">protected</span> <span style="color: blue;">void</span>
Button1_Click(<span style="color: blue;">object</span> sender, <span style="color: #2b91af;">EventArgs</span> e)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> {<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">int</span> x = <span style="color: #2b91af;">Convert</span>.ToInt32(TextBox1.Text);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">int</span> y = <span style="color: #2b91af;">Convert</span>.ToInt32(TextBox2.Text);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//create the object of class declared in wcf</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> ServiceReference1.<span style="color: #2b91af;">ItechnologyClient</span>
ic = <span style="color: blue;">new</span> ServiceReference1.<span style="color: #2b91af;">ItechnologyClient</span>();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: green;">//call the method which defined in the wcf service</span><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> <span style="color: blue;">int</span> z = ic.sum(x, y);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">
Label1.Text = z.ToString();<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Consolas; font-size: 9.5pt;">}<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpFirst">
<br /></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo1; tab-stops: 291.0pt; text-indent: -18.0pt;">
12.<span style="font-size: 7pt;"> </span>And
finally run the application<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpMiddle">
In this way this
is the basic application to interact with wcf service.<o:p></o:p></div>
<div class="MsoListParagraphCxSpMiddle">
<br /></div>
<div class="MsoListParagraphCxSpLast">
<br /></div>
</div>
Anonymoushttp://www.blogger.com/profile/08203366298489829818noreply@blogger.com0