Microsoft KB Archive/323575

= BUG: No Error Message About Duplicate SOAPAction Values Until First Invocation of Service =

Article ID: 323575

Article Last Modified on 2/23/2007

-

APPLIES TO


 * Microsoft Web Services Enhancements for Microsoft .NET 1.1
 * Microsoft Web Services Enhancements for Microsoft .NET 2.0

-



This article was previously published under Q323575



SYMPTOMS
When the RoutingStyle property of an XML Web service is SOAPAction, the SOAPAction values must be unique across the methods on the XML Web service. However, you do not receive an error message about duplicate SOAPAction values until the first invocation of the Web service, although you should have received the error message at Web Services Description Language (WSDL) generation time.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
The Action property gets or sets the SOAPAction HTTP header field of the SOAP request. Typically, it is a Uniform Resource Identifier (URI) that indicates the intent of the request. By default, this is http://tempuri.org/, where  is the name of the XML Web service method. However, the SOAP specification places no restrictions on the format of the URI, or on any rules about whether the URI is resolvable. Web servers, such as firewalls, can use the Action property and its contents to appropriately filter SOAP request messages in HTTP.

Steps to Reproduce the Behavior
  Create an XML Web service named MathService.asmx in C:\Inetpub\Wwwroot: <%@ WebService Language=&quot;C#&quot; Class=&quot;MathService&quot; %>

using System; using System.Web.Services; using System.Web.Services.Protocols;

public class MathService : WebService {

[SoapDocumentMethod(Action=&quot;http://localhost/myMathService&quot;)] [WebMethod] public float Add(float a, float b)  { return a + b;  }

[SoapDocumentMethod(Action=&quot;http://localhost/myMathService&quot;)] [WebMethod] public float Subtract(float a, float b)  { return a - b;  } }                    Open http://localhost/MathService.asmx. Note that the Help page opens as expected.  Generate the Web Service proxy named MathService.cs: wsdl http://localhost/MathService.asmx?wsdl /out:MathService.cs                     Add the following code at the end of MathService.cs: public class Test { public static void Main { MathService service = new MathService; service.Add(1.0, 2.0); Console.WriteLine(&quot;done&quot;); } }                     Compile MathService.cs: csc /t:exe /r:system.dll;system.web.dll;system.web.services.dll MathService.cs                    Run MathService.exe. You receive the following error message:

Unhandled Exception: System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: The methods Add and Subtract use the same SOAPAction 'http://localhost/myMathService'. When the RoutingStyle of the XML Web service is SoapAction, SOAPAction values must be unique across methods on the XML Web service. You can change the SOAPAction with the Action parameter to the SoapDocumentMethod or SoapRpcMethod attributes, or you can specify a RoutingStyle of RequestElement on the XML Web service.

The error is expected, but you should have received it after step 3.</li></ol>

<div class="references_section">