Optional Xml Fields

When using DataContractSerializer with a data member that has IsRequired set to false, the generated schema has minOccurs of 0. However, when using XmlSerializer with an XML element that has IsNullable set to true, the schema has minOccurs of 1. Instead, the schema has nillable set to true. How do I get the XmlSerializer behavior…

0

Fix for Generating Metadata Behind a Router

When generating metadata to describe a service, an address is published for the location at which the service can be reached. This is the address to which a client of the service should address a message. Ordinarily, the metadata address is obtained by looking at the address at which the service is listening for messages….

0

Referring to Generic Interfaces in Contracts

How do I write a contract type that has a generic parameter in a service configuration file? A contract reference is part of the template for defining a service endpoint through configuration: <endpoint address=”…” binding=”…” contract=”…” /> Now, you need to fill in the contract value based on the full name of the service contract…

4

Fix to Generate Contract Code for Dates

Here’s a bonus entry left from last week. Last week I ran a series covering fixes for WCF that may be hard to find and explaining the details behind each problem. Contract code generation takes a system-independent description of the types used for a messaging operation and generates source code instructions for working with those…

4

Untyped Asynchronous Calls

How do I asynchronously call a service operation without having a typed service contract on the client? An untyped contract is one where there is a single input or output parameter of type Message. Using the Message class rather than strong types allows you to reuse the same contract for any arbitrary message format. To…

0

Customizing Parameter Names

Why does changing the name of a parameter in a service contract break compatibility with existing clients? Each named part of the message that appears in metadata or as part of the wire protocol needs to come up with a name from somewhere. We don’t have any better default name for parameters than the name…

0

Contract First Development through Schema

Christian Weyer and Buddhike de Silva have an article in this month’s MSDN magazine covering contract-first development with WCF. They go over modeling messages and services through schema and then applying that to build a web service with WCF. They also look at tooling for working with schemas including the WSCF Blue contract-first development tool…

0

Data Deserialization Order

Why are the members of a data contract expected in a particular order in order to be read? The order of members is frequently used to build an expectation of what element might be appearing next. Knowing the possible order of data instead of potentially having to accept data in any order tends to make…

0

Overriding Namespaces from Serialization

I’ve defined my own XML namespaces for the members of a data contract and now when I generate the client proxies I get some ugly CLR namespaces for the types. How do I fix this? The mapping from an XML or WSDL namespace to a CLR namespace is a mechanical transformation of breaking apart the…

0

Contract First Development Tool

A beta release of the Web Services Contract First tool is available on CodePlex. This is a Visual Studio 2008 add-in targetting WCF made by the same group in the web services community that did a tool of the same name for ASMX (to tell the two apart, the WCF version is called WSCF Blue…

0