Microsoft KB Archive/927845

= The Web service namespace is set to tempuri.org when you publish a Windows Workflow Foundation workflow as a Web service =

Article ID: 927845

Article Last Modified on 3/22/2007

-

APPLIES TO


 * Windows Workflow Foundation

-





SYMPTOMS
When you publish a Microsoft Windows workflow as a Web service in Microsoft Visual Studio 2005, the namespace for the Web service is always &quot;http://tempuri.org.&quot;



CAUSE
This problem occurs when a workflow uses Web service activities, such as the WebServiceInputActivity activity, the WebServiceOutputActivity activity, and the WebServiceFaultActivity activity. In the workflow assembly, a Web service wrapper is generated and then is compiled. The name of the Web service wrapper is as follows:

. _WebService

When the file is generated, no namespace is specifed. The default namespace, http://tempuri.org, is used instead. During the build process, the Web service wrapper is both generated and deleted. You cannot configure this wrapper or specify a namespace.



RESOLUTION
To resolve this problem, create a new class in the Web service project. The class derives from the generated Web service wrapper class. After you publish the workflow as a Web service, apply the namespace attribute to the class that derives from the Web service wrapper class.  Make sure that the workflow project has been published. If the workflow project has not been published, right-click the workflow project, and then click Publish as Web Service. In Solution Explorer, right-click the generated Web service project, click Add ASP.NET Folder, and then click App_Code. Right-click the App_Code folder, and then click Add New Item. Click Class, type WorkflowResolution.cs in the Name box, and then click Add.  When the WorkflowResolution.cs file opens, replace the contents of the file by using the following code: using System.Web.Services; [WebService(Namespace = &quot;http://MyNamespace/&quot;)] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class MyWebService : WorkflowLibraryName.WorkflowName_WebService { } Note Replace   with the namespace that you want.  Edit the class declaration. Change the base class so that the base class refers to the generated Web service wrapper class for the workflow project. Use the following format:

_WebService

Do not edit the WebServiceBinding attribute. Other configurations have not been tested. Other configurations are not supported.</li>  Edit the .asmx file for the Web service so that it refers to the new class, as follows: <%@WebService Class=&quot;WorkflowResolution&quot; %> </li> Click the Build menu, and then click Rebuild Solution.</li></ol>

Note You have to follow these steps only one time.

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.

<div class="moreinformation_section">

Steps to reproduce the problem
<ol> In Visual Studio 2005, click the File menu, click New, and then click Project.</li> Expand Visual C#, click Workflow, click Sequential Workflow Library, type WorkflowLibrary1 in the Name text box, and then click OK.</li> In Solution Explorer, right-click Workflow1.cs, and then click View Code.</li>  Locate the following code: public sealed partial class Workflow1: SequentialWorkflowActivity {   public Workflow1 {       InitializeComponent; } } </li>  Replace the code that you located in step 4 with the following code: interface WSInterface {   void DoWork; } public sealed partial class Workflow1: SequentialWorkflowActivity {   public Workflow1 {       InitializeComponent; } } </li> In Solution Explorer, right-click Workflow1.cs, and then click View Designer.</li> Drag a WebServiceInputActivity control onto the Workflow1.cs design window.</li> For the InterfaceType property, specify the interface that you created in step 5. Set the IsActivating property to a value of true, and then specify the DoWork method as a value for the MethodName property.</li> In Solution Explorer, right-click WorkflowLibrary1, and then click Publish as Web Service.</li> In the confirmation dialog box that appears, click OK.</li> In Solution Explorer, right-click WorkflowLibrary1.Workflow1_WebService.asmx, and then click View in Browser.</li></ol>

You receive the following message:

This web service is using http://tempuri.org/ as its default namespace.

Recommendation: Change the default namespace before the XML Web service is made public

Additional query words: vs2005 workflow

Keywords: kbtshoot kbcode kbprb KB927845

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.