<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-491061940045971001</id><updated>2011-04-21T18:16:55.308-05:00</updated><category term='WCF'/><title type='text'>ISingh's Blog</title><subtitle type='html'>Microsoft .NET Development Blog</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://isinghblog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/491061940045971001/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://isinghblog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Inder Singh</name><uri>http://www.blogger.com/profile/09936457813038862209</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-491061940045971001.post-4255757249889893573</id><published>2009-03-10T20:01:00.024-05:00</published><updated>2009-03-10T21:48:14.946-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><title type='text'>WCF Service and Adobe LiveCycle Interoperability</title><content type='html'>&lt;span xmlns=""&gt;&lt;br /&gt;&lt;p style="TEXT-ALIGN: justify"&gt;I needed to expose a few WCF services to be consumed by Adobe LiveCycle server and ran into certain interoperability issues. With the help of some very useful blog posts and sample code (provided along with the blog posts) I was able to get past the hurdle. In this post I have compiled the complete details of the problem, solution and the references used.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p style="TEXT-ALIGN: justify"&gt;The root of the problem was WSDL generated by WCF, by default the WSDL generated for a WCF service can consist of multiple files. In certain situations the main WSDL file can include a reference to another WSDL file which in turn refers to separate XSD files to describe the data types used in ServiceContracts. When client consuming the service is developed using .NET then .NET tools are able to process such WSDL (spanning multiple files) without any problem, it might not be a problem for client developed using some other technologies either but in our case the Adobe LiveCycle server was not able to process such WSDL correctly. So, the solution was to flatten the WSDL into one long document containing everything.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;Problem Definition&lt;br /&gt;&lt;/h3&gt;&lt;br /&gt;&lt;p&gt;Now, I will explain the problem we are trying to solve using some code. The sample I am using is again from &lt;strong&gt;&lt;em&gt;Learning WCF&lt;/em&gt;&lt;/strong&gt; by &lt;strong&gt;&lt;em&gt;Michele Bustamante&lt;/em&gt;&lt;/strong&gt;.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="color:gray;"&gt;&lt;em&gt;One of the DataContracts: &lt;/em&gt;&lt;/span&gt;&lt;span style="font-family:Courier New;"&gt;&lt;span style="font-size:10;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;[DataContract(Namespace=http://schemas.thatindigogirl.com/samples/2006/06")]&lt;br /&gt;public class PhotoLink: LinkItem&lt;br /&gt;{&lt;br /&gt;public PhotoLink()&lt;br /&gt;{&lt;br /&gt;this.LinkItemType= LinkItemTypes.Image;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="color:gray;"&gt;&lt;em&gt;ServiceContract:&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;strong&gt;&lt;span style="color:#333333;"&gt;[ServiceContract(Name="PhotoUploadContract",Namespace="&lt;/span&gt;&lt;/strong&gt;&lt;a href="http://www.thatindigogirl.com/samples/2006/06"&gt;&lt;strong&gt;&lt;span style="color:#333333;"&gt;http://www.thatindigogirl.com/samples/2006/06&lt;/span&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;span style="color:#333333;"&gt;")] public interface IPhotoUpload&lt;br /&gt;{&lt;br /&gt;[OperationContract]&lt;br /&gt;void UploadPhoto(PhotoLink fileInfo, byte[] fileData);&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;The WSDL generated for the above Service without any customization consists of a total of five files - two WSDL files and three XSD files. Instead of showing the complete text of the WSDL files I will just show the relevant parts.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The first WSDL file generated from MEX endpoint is relatively short and contains the following import statement:&lt;/p&gt;&lt;p&gt;&lt;span style="color:#333333;"&gt;&lt;strong&gt;&lt;em&gt;&amp;lt;wsdl:import namespace="http://www.thatindigogirl.com/samples/2006/06" location="http://localhost:3107/PhotoApplication/PhotoManagerService.svc?wsdl=wsdl0" /&amp;gt;&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#333333;"&gt;&lt;span style="color:#000000;"&gt;The location attribute points to the second WSDL file and this second WSDL file further refers to external XSD files:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;span style="color:#333333;"&gt;&amp;lt;wsdl:types&amp;gt; &amp;lt;xsd:schema targetNamespace=&lt;/span&gt;&lt;span style="color:#333333;"&gt;&lt;a href="http://www.thatindigogirl.com/samples/2006/06/Imports"&gt;http://www.thatindigogirl.com/samples/2006/06/Imports&lt;/a&gt;&lt;/span&gt;&lt;span style="color:#333333;"&gt;"&gt; &amp;lt;xsd:import schemaLocation="&lt;/span&gt;&lt;/strong&gt;&lt;/em&gt;&lt;a href="http://localhost:3107/PhotoApplication/PhotoManagerService.svc?xsd=xsd0"&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;&lt;strong&gt;http://localhost:3107/PhotoApplication/PhotoManagerService.svc?xsd=xsd0&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;&lt;/a&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;&lt;strong&gt;" namespace="&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;&lt;a href="http://www.thatindigogirl.com/samples/2006/06"&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;&lt;strong&gt;http://www.thatindigogirl.com/samples/2006/06&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;&lt;/a&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;&lt;strong&gt;" /&amp;gt; &amp;lt;xsd:import schemaLocation="&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;&lt;a href="http://localhost:3107/PhotoApplication/PhotoManagerService.svc?xsd=xsd1"&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;&lt;strong&gt;http://localhost:3107/PhotoApplication/PhotoManagerService.svc?xsd=xsd1&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;&lt;/a&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;&lt;strong&gt;" namespace="&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;&lt;a href="http://schemas.microsoft.com/2003/10/Serialization/"&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;&lt;strong&gt;http://schemas.microsoft.com/2003/10/Serialization/&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;&lt;/a&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;&lt;strong&gt;" /&amp;gt; &amp;lt;xsd:import schemaLocation="&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;&lt;a href="http://localhost:3107/PhotoApplication/PhotoManagerService.svc?xsd=xsd2"&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;&lt;strong&gt;http://localhost:3107/PhotoApplication/PhotoManagerService.svc?xsd=xsd2&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;&lt;/a&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;&lt;strong&gt;" namespace="&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;&lt;a href="http://schemas.thatindigogirl.com/samples/2006/06"&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;&lt;strong&gt;http://schemas.thatindigogirl.com/samples/2006/06&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;&lt;/a&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;&lt;strong&gt;" /&amp;gt; &amp;lt;/xsd:schema&amp;gt;&amp;lt;/wsdl:types&amp;gt;&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;The schemaLocation attributes provide the location of external XSD files.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Solution Step 1&lt;br /&gt;&lt;/h3&gt;&lt;br /&gt;&lt;p&gt;I used quite a few blog posts but the following article by &lt;strong&gt;&lt;em&gt;Christian Weyer&lt;/em&gt;&lt;/strong&gt; was most helpful, you can also download code for free which will flatten out the generated WSDL.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;Link to the post: &lt;a href="http://blogs.thinktecture.com/cweyer/archive/2007/05/10/414840.aspx" target="_blank"&gt;Improving WCF Interoperability: Flattening your WSDL&lt;/a&gt;&lt;br /&gt;&lt;p&gt;Christian Weyer showed multiple solutions to the tackle the problem: &lt;/p&gt;&lt;ul&gt;&lt;li&gt;A custom endpoint behavior. &lt;/li&gt;&lt;li&gt;A custom ServiceHost. &lt;/li&gt;&lt;li&gt;A custom ServiceHostFactory to be used when service is hosted in IIS (this was my case). &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;I used the custom ServiceHostFactory to host the service and was able to solve the problem partially, this time WSDL generated consisted of only two files. The first WSDL file referenced the second WSDL file and all the XSD schema definitions were included in line in the second WSDL file. This is one step forward but still it did not solve our problem completely because Adobe LiveCycle required all the content to be in one WSDL file.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;The first WSDL file stays the same as before and refers to the second WSDL file, but the second WSDL file contains all XSD schemas inline as shown below:&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="color:#333333;"&gt;&amp;lt;wsdl:types&amp;gt; &amp;lt;xsd:schema elementFormDefault="qualified" targetNamespace="&lt;/span&gt;&lt;/strong&gt;&lt;a href="http://www.thatindigogirl.com/samples/2006/06"&gt;&lt;strong&gt;&lt;span style="color:#333333;"&gt;http://www.thatindigogirl.com/samples/2006/06&lt;/span&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;span style="color:#333333;"&gt;"&gt;; &amp;lt;xsd:element name="UploadPhoto"&amp;gt; &amp;lt;xsd:complexType&amp;gt; &amp;lt;xsd:sequence&amp;gt; &amp;lt;xsd:element minOccurs="0" name="fileInfo" nillable="true" type="q1:PhotoLink" xmlns:q1="&lt;/span&gt;&lt;/strong&gt;&lt;a href="http://schemas.thatindigogirl.com/samples/2006/06"&gt;&lt;strong&gt;&lt;span style="color:#333333;"&gt;http://schemas.thatindigogirl.com/samples/2006/06&lt;/span&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;span style="color:#333333;"&gt;" /&gt;; &amp;lt;xsd:element minOccurs="0" name="fileData" nillable="true" type="xsd:base64Binary" /&amp;gt; &amp;lt;/xsd:sequence&amp;gt; &amp;lt;/xsd:complexType&amp;gt; &amp;lt;/xsd:element&amp;gt; &amp;lt;xsd:element name="UploadPhotoResponse"&amp;gt; &amp;lt;xsd:complexType&amp;gt; &amp;lt;xsd:sequence /&amp;gt; &amp;lt;/xsd:complexType&amp;gt; &amp;lt;/xsd:element&amp;gt; &amp;lt;/xsd:schema&amp;gt; &amp;lt;xsd:schema elementFormDefault="qualified" targetNamespace="&lt;/span&gt;&lt;/strong&gt;&lt;a href="http://schemas.thatindigogirl.com/samples/2006/06"&gt;&lt;strong&gt;&lt;span style="color:#333333;"&gt;http://schemas.thatindigogirl.com/samples/2006/06&lt;/span&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;span style="color:#333333;"&gt;" xmlns:tns="&lt;/span&gt;&lt;/strong&gt;&lt;a href="http://schemas.thatindigogirl.com/samples/2006/06"&gt;&lt;strong&gt;&lt;span style="color:#333333;"&gt;http://schemas.thatindigogirl.com/samples/2006/06&lt;/span&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;span style="color:#333333;"&gt;"&gt;&lt;br /&gt;...&lt;br /&gt;...&lt;br /&gt;...&lt;br /&gt;. ..&amp;lt;/wsdl:types&amp;gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;h3&gt;Solution Step 2 &lt;/h3&gt;&lt;p&gt;Two more changes were required to get all the WSDL generated in one file:&lt;br /&gt;1. Service Endpoint needs to be in the same namespace as the &lt;em&gt;ServiceContract&lt;/em&gt;. Example, the endpoint for the service was configured as follows: &lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;&amp;lt;endpoint contract="PhotoManagerService.IPhotoUpload" binding="basicHttpBinding" bindingNamespace="&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;a href="http://www.thatindigogirl.com/samples/2006/06%22%3E"&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;http://www.thatindigogirl.com/samples/2006/06"&gt;&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;2. A ServiceBehavior needs be to the service implementation type with the same namespace as &lt;em&gt;ServiceContract&lt;/em&gt;. Example, Service implementation was modified to include a &lt;em&gt;ServiceBehavior&lt;/em&gt; attribute as follows:&lt;br /&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;[System.ServiceModel.ServiceBehavior(Namespace = "&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;a href="http://www.thatindigogirl.com/samples/2006/06"&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;http://www.thatindigogirl.com/samples/2006/06&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;&lt;span style="color:#333333;"&gt;")]&lt;br /&gt;public class PhotoManagerService: IPhotoUpload&lt;br /&gt;{&lt;br /&gt;public void UploadPhoto( ContentTypes.PhotoLink fileInfo, byte[] fileData)&lt;br /&gt;{&lt;br /&gt;PhotoUploadUtil PhotoUploadUtil = new PhotoUploadUtil();&lt;br /&gt;photoUploadUtil.SavePhoto(fileInfo, fileData);&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;With the above two changes in place along with custom ServiceHost, desired results were achieved and the entire WSDL generated including XSD schemas was in one long file.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="TEXT-DECORATION: underline"&gt;Please Note&lt;/span&gt;: There was no need to change namespace of the &lt;em&gt;DataContract&lt;/em&gt; or the &lt;em&gt;Mex Endpoint&lt;/em&gt;. &lt;/p&gt;&lt;br /&gt;&lt;h3&gt;Conclusion&lt;br /&gt;&lt;/h3&gt;&lt;p&gt;I was not too happy to discover this issue, wish there was simpler configuration based solution to generate WSDL in one document but the good thing is that WCF is extensible enough that if we dig beneath the surface desired solutions can be developed. Hence, I won't jump on the bandwagon that WCF is not ready for interoperability.&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/491061940045971001-4255757249889893573?l=isinghblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://isinghblog.blogspot.com/feeds/4255757249889893573/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://isinghblog.blogspot.com/2009/03/wcf-service-and-adobe-livecycle_10.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/491061940045971001/posts/default/4255757249889893573'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/491061940045971001/posts/default/4255757249889893573'/><link rel='alternate' type='text/html' href='http://isinghblog.blogspot.com/2009/03/wcf-service-and-adobe-livecycle_10.html' title='WCF Service and Adobe LiveCycle Interoperability'/><author><name>Inder Singh</name><uri>http://www.blogger.com/profile/09936457813038862209</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-491061940045971001.post-4092101411987207527</id><published>2009-03-07T17:52:00.017-06:00</published><updated>2009-03-07T20:06:08.547-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><title type='text'>WCF DataContractSerializer changes in .NET Framework 3.5 SP1</title><content type='html'>&lt;span xmlns=""&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;I have been reading &lt;a href="http://www.thatindigogirl.com/" target="_blank"&gt;Michele Bustamante's&lt;/a&gt; Learning WCF. Its a very well-written book and the best part is that its written in a Tutorial style with plenty of labs to give hands-on experience otherwise it kind of gets boring to do plain reading. I am learning WCF on my own and not using it on a real project so I am finding this book to be very useful. This book was originally written for WCF released as part of .NET Framework 3.0 targeting Visual Studio 2005, there has been a reprint of the book as well as the accompanying code has been updated for .NET Framework 3.5 and Visual Studio 2008. With the ever changing world of technology, things get outdated pretty quickly hence I am also finding things here and there which have changed. Yesterday, I spent a few hours researching an issue related to &lt;em&gt;DataContract&lt;/em&gt; where the code did not behave as expected so I thought I should write a quick post about my learning. &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;Let's look at a simple &lt;em&gt;ServiceContract:&lt;/em&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;[&lt;span style="color: rgb(43, 145, 175);"&gt;ServiceContract&lt;/span&gt;] &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;interface &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;IEmployeeService&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;[&lt;span style="color: rgb(43, 145, 175);"&gt;OperationContract&lt;/span&gt;]&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Employee&lt;/span&gt; GetEmployeeDetails(&lt;span style="color:blue;"&gt;int&lt;/span&gt; employeeID);&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;The &lt;em&gt;Employee&lt;/em&gt; class:&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;Employee&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;int&lt;/span&gt; _ID;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; _FirstName;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; _LastName;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; _Title;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;public &lt;/span&gt;&lt;span style="color:blue;"&gt;int&lt;/span&gt; ID&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;get &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;return&lt;/span&gt; &lt;span style="color:blue;"&gt;this&lt;/span&gt;._ID;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;}&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;set &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;this&lt;/span&gt;._ID = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;} &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;} &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; FirstName &lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;get&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;return&lt;/span&gt;&lt;br /&gt;&lt;span style="color:blue;"&gt;this&lt;/span&gt;._FirstName;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;set&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;this&lt;/span&gt;._FirstName = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; LastName&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;get&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;return&lt;/span&gt;&lt;br /&gt;&lt;span style="color:blue;"&gt;this&lt;/span&gt;._LastName;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;set&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;this&lt;/span&gt;._LastName = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; Title&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;get&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;return&lt;/span&gt;&lt;br /&gt;&lt;span style="color:blue;"&gt;this&lt;/span&gt;._Title;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;set&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;this&lt;/span&gt;._Title = &lt;span style="color:blue;"&gt;value&lt;/span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;In versions prior to .NET Framework 3.5 SP1, an InvalidDataContractException was thrown if an attempt was made to host this service because WCF required any parameters/return types in the &lt;em&gt;ServiceContract&lt;/em&gt; (other then simple types like int, decimal, string, etc.) to be explicitly marked serialiable either by using a &lt;em&gt;DataContract &lt;/em&gt;or some other mean. Now, with .NET Framework 3.5 SP1 this is no more a requirement, any type not marked as seriailizable is by default serilized using &lt;em&gt;DataContractSerializer&lt;/em&gt;. A few points to note about this default serializion for types:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;The class must have a default constructor(parameterless constructor).&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;Only public read/write properties are serialized.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;If the class is marked as &lt;em&gt;DataContract&lt;/em&gt; then the normal rules apply i.e. only members marked with &lt;em&gt;DataMember&lt;/em&gt; attribute are serialized.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;One benefit resulting from this feature is that if you are exposing types defined in an existing assembly through WCF services, you don't need to make any changes to the existing type they will be automically be serialized for you whereas earlier there is was need to come up with a workaround like create surrogate types.&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;I was not able to find this change easily so thought I should write this post, hope this helps.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=";font-family:Courier New;font-size:10;"  &gt;I have learnt quite a few other quirks related to WCF and LINQ and will be writing more posts as the time permits. &lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/491061940045971001-4092101411987207527?l=isinghblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://isinghblog.blogspot.com/feeds/4092101411987207527/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://isinghblog.blogspot.com/2009/03/wcf-datacontractserializer-changes-in.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/491061940045971001/posts/default/4092101411987207527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/491061940045971001/posts/default/4092101411987207527'/><link rel='alternate' type='text/html' href='http://isinghblog.blogspot.com/2009/03/wcf-datacontractserializer-changes-in.html' title='WCF DataContractSerializer changes in .NET Framework 3.5 SP1'/><author><name>Inder Singh</name><uri>http://www.blogger.com/profile/09936457813038862209</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-491061940045971001.post-3014285389849991950</id><published>2009-03-07T00:21:00.000-06:00</published><updated>2009-03-07T00:41:27.894-06:00</updated><title type='text'>Finally I am joining the blogosphere</title><content type='html'>Yes, I have taken the first step of creating a blog as I have decided to become active in blogosphere. As my profie shows that I am Software Consultant specializing in Microsoft technologies, I plan to use this blog to post my learnings related to Microsoft technologies which might be of interest or help to people like myself.&lt;br /&gt;&lt;br /&gt;I use google search quite a bit to find answers when stuck on some technology problem. Yes, I am one of those who don't like to give up and can spend hours to overcome hurdles to enjoy that sweet taste of success. I have come across so many useful blog posts over the last few years that I am finally motivated to give back to the community (at least that's the hope).&lt;br /&gt;&lt;br /&gt;Recently, I have been spending quite a bit of time learning LINQ and WCF. Reading through a book/article/tutorial is one thing but once you start digging deep you run into so many different issues. I have been stuck very often and have found solutions most of the time and have some useful findings to share. Coming Soon!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/491061940045971001-3014285389849991950?l=isinghblog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://isinghblog.blogspot.com/feeds/3014285389849991950/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://isinghblog.blogspot.com/2009/03/finally-i-am-joining-blogosphere.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/491061940045971001/posts/default/3014285389849991950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/491061940045971001/posts/default/3014285389849991950'/><link rel='alternate' type='text/html' href='http://isinghblog.blogspot.com/2009/03/finally-i-am-joining-blogosphere.html' title='Finally I am joining the blogosphere'/><author><name>Inder Singh</name><uri>http://www.blogger.com/profile/09936457813038862209</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
