Eric's Blog

Day to day experience in .NET
Welcome to Blogs @ IRM Sign in | Join | Help
 Search

Disclaimer

The content of this site is my own personal opinion and does not in any way represent my employer, it's subsideries or affiliates. These postings are provided "AS IS" with no warranties, and confer no rights.

This Blog

No More http://tempuri.org in My WSDL

When using WCF to create services it is very easy to forget all places where you have to specify the namespace, so that there won't be any http://tempuri.org showing up in the generated wsdl. It is very common to see that the ServiceContract attribute specifies a real namespace, but there is still two (not counting the DataContracts/Schemas) more places where you have to set the namespace or otherwise you will have tempuri.org in your wsdl. The other two is the service namespace and the binding namespace. In a typically scenario the service namespace is set through the ServiceBehavior attribute in your service code and the binding namespace is set in the bindingNamespace attribute of the endpoint element in the configuration file.

[ServiceBehavior(Namespace = Xxx.ServiceContract.Constants.ServiceNamespace)]
public class ManageCompanyService : IManageCompanyService

and in the web.config ...

<endpoint address="" binding="ws2007HttpBinding"
          bindingNamespace="http://eio.se/schemas/medlemsservice/2008/06/" 
          contract="Xxx.ServiceContract.IManageCompanyService">

I often forget about these two, how about you?

You can read a good walkthrough about controlling the namespaces in the generated WSDL here.

Published den 4 mars 2009 12:31 by ericqu
Filed under: , ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server, by Telligent Systems