Microsoft KB Archive/927845: Difference between revisions
m (Text replacement - "<" to "<") |
m (Text replacement - ">" to ">") |
||
Line 54: | Line 54: | ||
<div class="indent"> | <div class="indent"> | ||
<code><WorkflowNamespace | <code><WorkflowNamespace></code>.<code><WorkflowName></code>_WebService | ||
Line 82: | Line 82: | ||
<div class="indent"> | <div class="indent"> | ||
<p><code><WorkflowNamespace.WorkflowName | <p><code><WorkflowNamespace.WorkflowName></code>_WebService</p> | ||
</div> | </div> | ||
Do not edit the '''WebServiceBinding''' attribute. Other configurations have not been tested. Other configurations are not supported.</li> | Do not edit the '''WebServiceBinding''' attribute. Other configurations have not been tested. Other configurations are not supported.</li> | ||
<li><p>Edit the .asmx file for the Web service so that it refers to the new class, as follows:</p> | <li><p>Edit the .asmx file for the Web service so that it refers to the new class, as follows:</p> | ||
<pre class="codesample"><%@WebService Class="WorkflowResolution" % | <pre class="codesample"><%@WebService Class="WorkflowResolution" %></pre></li> | ||
<li>Click the '''Build''' menu, and then click '''Rebuild Solution'''.</li></ol> | <li>Click the '''Build''' menu, and then click '''Rebuild Solution'''.</li></ol> | ||
Latest revision as of 10:25, 21 July 2020
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.
- 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 = "http://MyNamespace/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class MyWebService : WorkflowLibraryName.WorkflowName_WebService { }
Note Replace
http://MyNamespace/
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:
<WorkflowNamespace.WorkflowName>
_WebService Edit the .asmx file for the Web service so that it refers to the new class, as follows:
<%@WebService Class="WorkflowResolution" %>
- 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
- In Visual Studio 2005, click the File menu, click New, and then click Project.
- Expand Visual C#, click Workflow, click Sequential Workflow Library, type WorkflowLibrary1 in the Name text box, and then click OK.
- In Solution Explorer, right-click Workflow1.cs, and then click View Code.
Locate the following code:
public sealed partial class Workflow1: SequentialWorkflowActivity { public Workflow1() { InitializeComponent(); } }
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(); } }
- In Solution Explorer, right-click Workflow1.cs, and then click View Designer.
- Drag a WebServiceInputActivity control onto the Workflow1.cs design window.
- 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.
- In Solution Explorer, right-click WorkflowLibrary1, and then click Publish as Web Service.
- In the confirmation dialog box that appears, click OK.
- In Solution Explorer, right-click WorkflowLibrary1.Workflow1_WebService.asmx, and then click View in Browser.
You receive the following message:
Additional query words: vs2005 workflow
Keywords: kbtshoot kbcode kbprb KB927845