Microsoft KB Archive/927845

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 10:25, 21 July 2020 by X010 (talk | contribs) (Text replacement - ">" to ">")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Base


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 "http://tempuri.org.%22

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:

<WorkflowNamespace>.<WorkflowName>_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.

  1. 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.
  2. In Solution Explorer, right-click the generated Web service project, click Add ASP.NET Folder, and then click App_Code.
  3. Right-click the App_Code folder, and then click Add New Item.
  4. Click Class, type WorkflowResolution.cs in the Name box, and then click Add.
  5. When the WorkflowResolution.cs file opens, replace the contents of the file by using the following code:

    using System.Web.Services;
    [WebService(Namespace = "http://MyNamespace/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class MyWebService : WorkflowLibraryName.WorkflowName_WebService
    {
    }

    Note Replace http://MyNamespace/ with the namespace that you want.

  6. 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:

    <WorkflowNamespace.WorkflowName>_WebService

    Do not edit the WebServiceBinding attribute. Other configurations have not been tested. Other configurations are not supported.
  7. Edit the .asmx file for the Web service so that it refers to the new class, as follows:

    <%@WebService Class="WorkflowResolution" %>
  8. Click the Build menu, and then click Rebuild Solution.

Note You have to follow these steps only one time.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Steps to reproduce the problem

  1. In Visual Studio 2005, click the File menu, click New, and then click Project.
  2. Expand Visual C#, click Workflow, click Sequential Workflow Library, type WorkflowLibrary1 in the Name text box, and then click OK.
  3. In Solution Explorer, right-click Workflow1.cs, and then click View Code.
  4. Locate the following code:

    public sealed partial class Workflow1: SequentialWorkflowActivity
    {
        public Workflow1()
        {
            InitializeComponent();
        }
    }
  5. 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();
        }
    }
  6. In Solution Explorer, right-click Workflow1.cs, and then click View Designer.
  7. Drag a WebServiceInputActivity control onto the Workflow1.cs design window.
  8. 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.
  9. In Solution Explorer, right-click WorkflowLibrary1, and then click Publish as Web Service.
  10. In the confirmation dialog box that appears, click OK.
  11. In Solution Explorer, right-click WorkflowLibrary1.Workflow1_WebService.asmx, and then click View in Browser.

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