In a previous post I told you how to get rid of the http://tempuri.org/ namespace in the WSDL of a WCF service. But while testing a WF4 Declarative WorkflowService I was developing for a customer, the ugly tempuri namespace popped-up again in the WSDL generated for this service.
After investigating the properties that are available for a declarative workflowservice I found a solution. In this blogpost I wil show you how to get rid of the tempuri namespace and get a single WSDL file with the target-namespace you specified. To demonstrate the solution I’ve created a simple declarative workflowservice named MyService with a single ReceiveAndSendReply activity:
The namespace I’d like to use for this service is http://infosupport/samples/myservice.
To get rid of the tempuri namespace, you have to execute the following steps:
When you select the Recive activity and look at the propertygrid, you’ll see a property named ServiceContractName that has a namespace enclosed in curly brackets followed by a contract name. Remove both and specify the namespace and contractname for the Receive activity you want to use (in my sample “{http://infosupport/samples/myservice}IMyService”):
Click outside the sequence activity surrounding the ReceiveAndSendReply activity to show the propertygrid for the workflowservice. This will show 3 properties: AllowBufferedReceive, ConfigurationName and Name. Specify your namespace for the service using the Name property just as with the ServiceContractName property in the first step (don’t forget the curly brackets):
After that, specify an explicit configuration for the service in the web.config and use the name specified as ConfigurationName property in the workflowservice as name for the service. Also specify the contractname in the definition of the service-endpoint:
Now the WSDL is generated with the correct target namespace. But there’s still a problem. The WSDL contains a wsdl:import element using the tempuri namespace. This can be fixed using the trick from the first post in the “tempuri series”. Specify your namespace as bindingNamespace attribute in the definition of the service-endpoint in the web.config:
Now the WSDL is generated exactly as I want.