Globalization Patterns in WCF (WS-I18N implementation)

I recently came across a good Code Project article:

Globalization Patterns in WCF (WS-I18N implementation)

written by Pablo M. Cibraro.

Basically, there exists a standard specs (WS-I18N) describing how to pass international information (e.g. locale & time zone) to a SOAP endpoint in order for that web service to return you localized data.

An interesting aspect of that spec is that it passes the international information out-of-band in the soap header.  It therefore doesn’t contaminate your web service signature and if you skip that header, you gracefully get data in the default locale & time zone.

Now Pablo shows how to implement this pattern (or specs) in WCF.

He first shows the server-side, the hard way, using a message-contract where he defines the entire message format of a web-method, including the international header.

He then goes on and shows how you would set the header on the client-side, using message inspectors.

He finally shows a nicer server-side implementation where you do not use message contract (which are frankly annoying to use) but instead use inspectors to gather information from the header.  This hints toward a great system-strategy where you could set the culture of the request thread to the header-culture.

It’s all great stuff!

One thought on “Globalization Patterns in WCF (WS-I18N implementation)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s