background preloader

WCF

Facebook Twitter

How to: Perform Message Validation with Schema Validation in WCF. Microsoft Windows Communication Foundation (WCF) 3.5 Microsoft .NET Framework 3.5 Microsoft Visual Studio 2008 This how-to article shows you how to perform message validation using a schema in WCF. You will learn how to create a custom client message inspector and dispatcher message inspector that can be used to validate messages on both the server and the client.

Learn how to create a custom configuration element that will allow exposing the custom endpoint behavior in the configuration file. Learn how to create a custom endpoint behavior that will consume the client and dispatcher message inspectors. Learn how to create custom client and dispatcher message inspectors to validate messages using schemas. Message validation represents one line of defense in the protection of your WCF application. To perform message validation, you first build a schema that represents the operations of your service and the data types consumed by those operations. Understanding WCF Services in Silverlight 2. If you like this document, please consider writing a recommendation for me on my LinkedIn account.

Contents Introduction Regardless of what platform you are working with, you need some mechanism for dealing with errors. When it comes to using WCF in Silverlight we are all very fortunate to be able to build out solutions on the back of many tried and true techniques for error management. If you haven't done so already, you should read the first part of this document entitled Understanding WCF Services in Silverlight (here after "previous document").

SOAP Review Before we take a look at error management over SOAP services, we will take a moment to review SOAP messaging. <s:Envelope xmlns:s=" xmlns=" Here is a message the service could possibly send back to the client: - Programming, Life an... In my previous post I talked about Silverlight 2 unit testing, and I decided the next natural step was to figure out how to integrate Silverlight testing in a continuous integration process. Personally I’m a big fan of this development practice, and have practiced it with great success on several projects. One of the challenges of integrating Silverlight tests into a CI process is the fact that the Silverlight test framework runs inside the browser and you cannot write Silverlight tests using your favorite test framework like NUnit or MSTEST. The power of CI is to build your software as new code is added to the source control, run automated tests, package the software and deploy it to a testing environment.

If the tests fail you stop the deployment and alert the development team. There are several tools you can use to set up a CI server. Personally I use CruiseControl.NET, but CI is more about a practice than a specific tool or technology. Pinvoke.net: the interop wiki! John Howard - Hyper-V and virtualization blog : How-to use MakeCert for trusted root certification. I wasn't originally going to blog this, but my colleague, Mat, and I were discussing encryption late last night. Mat was specifically interested in its use for security traffic in the context of SQL Reporting Service, but we got massively sidetracked and ended up talking about IPSec, MAPI and all sorts of other things along the way. Interesting, none-the-less. One thing Mat wanted to demonstrate was the use of a certificate for encrypting traffic between a SQL Reporting Server and a back-end database.

Why not install a certificate server, he said. My retort was that he was probably barking if this was just for a simple demonstration.... :-) (You're not, really Mat. Honest!) MakeCert.exe allows you to (for test/dev purposes) generate both a trusted root certificate and a certificate signed by that trusted root certificate for encryption purposes (also for signature purposes, but that wasn't relevant in this context). Download makecert.exe from microsoft.com here. Pedram Rezaei's Ramblings : Customising WCF Proxy Generation in Visual Studio 2008. I was asked today how easy it is to hook into the WCF client proxy generation process in Visual Studio 2008. The answer is “It is very easy”.

Visual Studio has this great extensibility point that allows third-parties to create “Custom Tools” for specific files. One of the properties that is accessible to you for files within a Visual Studio project is called “Custom Tool”. The value for this property implicitly maps to a class in an assembly registered with Visual Studio that performs custom code generation for that file. For instance if you have an XSD file, you can create a custom tool which allows you to generate .NET code for that XSD. Client proxy generation also uses the same technique. The content of this map file is very interesting. <GenerateAsynchronousMethods>false</GenerateAsynchronousMethods> <EnableDataBinding>true</EnableDataBinding> <ImportXmlTypes>false</ImportXmlTypes> <GenerateInternalTypes>false</GenerateInternalTypes> <Serializer>Auto</Serializer> return result; if (ctor !

Pedram Rezaei's Ramblings : WCF Authentication: Custom Username and Password Validator. There are a number of authentication techniques supported by WCF. For instance Windows Authentication, X509 Certificates, Issued Tokens, and Username and Password are all mechanisms that can be used for authentication. These client credential types are configured as part of the binding configuration for an endpoint.

For example the config section below customises the netTcpBinding to use an X509 certificate: If you change the Client Credential Type to “UserName”, you can then pass username and passwords to the service and authenticate the client based on these credentials. Sending unencrypted username and password over any communication framework is usually not advisable. If a server certificate is not specified, at service start-up time, you will receive the following exception: “The service certificate is not provided.

By default, when a user name and password is used for authentication, WCF uses Windows to validate the username and password. Public override void <userNameAuthentication.