How to get rid of targetnamespace="http://tempuri.org" in Workflow WCF service WSDL (.NET 3.5)
-
Wednesday, March 05, 2008 3:43 PM
I have created a Workflow Sequential Service which is hosted in IIS.
In the Servicecontract Interface you can define a ServiceContract namespace. Also you can define a namespace in the workflowserviceattributes property. But after changing these namespace properties I still get at the <wsdl : definition targetnamespace:http://tempuri.org.
How can I change that property in a workflowservice (WCF)?
Answers
-
Wednesday, March 26, 2008 4:02 PM
Setting Namespace on WorkflowServiceBehavior should definetly work,unless someother part of code is resetting it to null through servicedescription.Namespace but I will validate it. But to unblock you please try the following.
workflowServiceHost.Description.Namespace = "<Your desired namespace>";; and see it works for you?
-Karthik
All Replies
-
Thursday, March 06, 2008 7:37 AM
After making these changes, for what entities in wsdl are you still seeing the tempuri.org namespace?
-
Thursday, March 06, 2008 10:12 AM
The top targetnamespace. See the very first part of my WSDL output:
In a normal WCF service you would place a ServiceBehavior attribute above the class that implements the ServiceContract interface. Unfortunately there's not a real implementing class in a WorkflowService
Code Snippet<wsdl:definitions name="MyWFService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" -
Thursday, March 06, 2008 6:04 PM
WorkflowServiceattributes for workflow services is corresponding decorator as of WCF ServiceBehaviorAttribute. You should be able to set all the properties as of ServiceBehavior attribute.
-
Thursday, March 06, 2008 8:30 PMAs stated in my first post.
This is what I did:
I defined a namespace on several places:
workflowserviceattributes -> Namespace
ServiceContract interface
I based my WCF namespace knowledge on this article:
http://www.pluralsight.com/blogs/kirillg/archive/2006/06/18/28380.aspx
But still after these changes the toplevel targetnamespace remains: http://tempuri.org -
Wednesday, March 12, 2008 9:26 AM
Nobody? :-)
-
Thursday, March 20, 2008 12:00 PM
I have found that [ServiceContract (Namespace=...)] used on an interface differs in its behavior from [ServiceBehavior (Namespace=...)] used on a class. ServiceBehavior appears to eliminate tempuri from the wsdl, where ServiceContract does not.
Not sure why this would be ... Microsoft?
-
Thursday, March 20, 2008 10:03 PMModerator
The documentation for the two namespace says the following:
1. ServiceContract->Namespace:
The WSDL namespace of the <portType> element. The default value is "http://tempuri.org".
2. ServiceBehavior->Namespace:
The value of the targetNamespace attribute for the <wsdl
efinitions> element that contains the <wsdl
ervice> element. -
Sunday, March 23, 2008 1:23 PMHi Saurabh,
That's exactly my experience with regular WCF Services. In a regular service a use the servicebehavior on the implemented class to define my toplevel namespace.
But on a WF Workflow Service you can't define a servicebehavior. (Or where can I?)
The only thing which comes close, are the workflowserviceattributes, but these doesn't seem to work.
Any other cluess?? MS? -
Tuesday, March 25, 2008 5:13 PMI used the ServiceBehaviourAttribute.Namespace property to set the targetNamespace for the <wsdl: definitions> element in the main wsdl generated by the application's mex (e.g. http://myhost/MyService?wsdl )
However, there are <wsdl: import> elements within the main wsdl that import other secondary wsdl.
1) In the main wsdl, how do I change the namespace in the <wsdl:import namespace="http://tempuri.org" ...> elements from http://tempuri.org to something else?
2) How do i change the targetNamespace for the <wsdl: definitions targetNamespace="http://tempuri.org"> in the secondary wsdl from http://tempuri.org to something else?
Microsoft, please help, else i will have to abandon WCF for this project
-
Wednesday, March 26, 2008 4:02 PM
Setting Namespace on WorkflowServiceBehavior should definetly work,unless someother part of code is resetting it to null through servicedescription.Namespace but I will validate it. But to unblock you please try the following.
workflowServiceHost.Description.Namespace = "<Your desired namespace>";; and see it works for you?
-Karthik
-
Wednesday, March 26, 2008 4:27 PMI walked through the code with Reflector - the WorkflowServiceBehavior isn't being used to set the target namespace - so your solution Karthik is the only one available. I'd suggest building a custom servicehost that derives from WorkflowServiceHost as a general purpose solution (with a servicehostfactory for IIS/WAS hosting).
-
Friday, April 04, 2008 4:21 PM
XREF to BizTalk post on similar issue:
-
Monday, May 26, 2008 6:28 AMI tried to implement the HostFactory, as described in http://www.masteringbiztalk.com/blogs/jon/PermaLink,guid,c5071b9d-103e-46dc-b933-c272d185758d.aspxCode Snippet
public class MyWorkflowServiceHostFactory : WorkflowServiceHostFactory
{
public override ServiceHostBase CreateServiceHost(string constructorString,
Uri[] baseAddresses
)
{
ServiceHostBase sh = base.CreateServiceHost(constructorString, baseAddresses);
sh.Description.Namespace =
"MyNonTempUriNamespace"; return sh;}
}
This workaround removes the tempuri namespace from the wsdl.
Nevertheless, does someone know why the settings from WorkflowServiceAttributes are ignored?
Additionally, when using the svcutil.exe to generate the proxy, the tempuri is not used anywhere, if the service contracts are properly decorated with the Namespace setting.
-
Sunday, June 01, 2008 8:02 PM
Hi Jon,
Thanks for the suggestion. Indeed creating my own workflowservicehost, made it possible to create my own namespace for a WF hosted WCF (web)service.
But the workflowserviceattributes which can be setted in the designer seems to be ignored. Is this a bug or a feature??- Proposed As Answer by Padcom Tuesday, December 16, 2008 11:52 PM
-
Tuesday, December 16, 2008 11:57 PM
Hi all,
to get rid of the tempuri in targetNamespace in root WSDL use the following annotation on implementing class:
[ServiceBehavior(Namespace="http://www.aplaline.com/services/")]
to get rid of the tempuri in wsdl:import as well as targetNamespace in the wsdl0 document use the following configuration option:
<endpoint address="" contract="MagicEightBallServiceLib.IEightBall" binding="basicHttpBinding" bindingNamespace="http://www.aplaline.com/services" />
whereas the "bindingNamespace" is the element to set. this can also be specified using <bindings> node but this is definitely the simpliest form.
and last but not least, the xsd:schema targetNamespace element. to specify the right namespace use ServiceContract annotation on contract interface.
Best regards,
Matthias
- Proposed As Answer by Javafun Sunday, July 25, 2010 10:35 AM
-
Thursday, October 07, 2010 2:38 AM
Matthias' solution works for me.
Thank you so much.

