Ron Jacobs

Windows Workflow Foundation

How to get rid of http://tempuri.org in a Workflow Service

How to get rid of http://tempuri.org in a Workflow Service

  • Comments 1

Edit: Ignore this really old post and view How to eliminate tempuri.org from your service WSDL

Somebody was asking earlier today how to eliminate the namespace http://tempuri.org from their WSDL with a WorkflowService.

I had no idea but soon enough somebody from the team came up with the answer.  It was something you would never guess in a million years so I decided this has to go on the blog.

When you create a WorkflowService the namespace of your service is declared as a part of the ServiceContractName.  For example, in the Introduction to Workflow Services Hands On Lab You create a service named SubmitApplication.xamlx and set the ServiceContractName to {http://contoso.com/hr/}IApplicationService

Everything inside the curly braces is the namespace.  Everything after is the contract name.  Fine – this looks good right?  I assumed that was all you would need but then…  Look at this WSDL.

<wsdl:definitions name="SubmitApplication" targetNamespace="http://tempuri.org/" >

 

Doh!  There it is, right in front of me…  Now other parts of the WSDL are using the correct namespace so maybe it is not that big of a deal but still, I want to get rid of http://tempuri.org!!

Ready for the solution?  It’s non-obvious but here goes...

The name of the WorkflowService is actually an XName which means it includes a namespace.  If you don’t provide a namespace, guess what you get?  http://tempuri.org!

If you want to get rid of it, you have to use a namespace prefix.  Earlier when I set the ServiceContractName it created an xmlns declaration in the XAML for me. It’s buried in the long list of xmlns declarations but you will find it if you search for p: (I deleted a bunch of stuff below so you can see it.

Edit: 5/3/11 - You can set the XName in the WorkflowService Name property by using braces {http://contoso.com/hr}SubmitApplication that way you won't have to edit the XAML directly.

<WorkflowService Name="SubmitApplication" xmlns:p="http://contoso.com/hr/" >
 
Now to apply this namespace to the Name property you have to edit the XAMLX file in the XML editor (the designer doesn’t allow this).  The fix is so simple…
 
<WorkflowService Name="p:SubmitApplication" xmlns:p="http://contoso.com/hr/" >
 
Notice the namespace prefix?  Just put a p: in front of the name and you are all done!
 
Now look at the WSDL.
<wsdl:definitions name="SubmitApplication" targetNamespace="http://contoso.com/hr/" >
Wohoo!
Edit: 6/5/2010
Unfortunately there is still one tempuri.org in the WSDL and for the life of me I can't find a way to get rid of it.  I'll let you know if I find out how to eliminate it.
Edit: 4/13/2011
Sadly... still I must report there is just no way to get rid of this tempuri.org.  If this really bothers you, please submit a bug (or vote on an existing one at http://connect.microsoft.com)
Edit: 5/3/2011
An interesting blog post on eliminating tempuri.org from WCF Services is here.  The solution won't work for Workflow Services but it's good information anyway.
Edit: 5/12/11 Edit: Ignore this really old post and view How to eliminate tempuri.org from your service WSDL
  • I'm currently using Beta 2 and had the same problem as you.  When I added the prefix in, it changed the defaultNamespace as you said it would.  But when I scanned down I found that the wsdl:import for the wsdl0 now had namespace="http://tempuri.org" whereas before it was using the uri from the xamlx file.  If I remove the prefix on the WorkflowService Name both revert to their previous values.  Did you see this behaviour?

Page 1 of 1 (1 items)