BUG: No Error Message About Duplicate SOAPAction Values Until First Invocation of Service (323575)



The information in this article applies to:

  • Microsoft Web Services (included with the .NET Framework 1.1)
  • Microsoft Web Services (included with the .NET Framework) 1.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/MethodName, where MethodName 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

  1. Create an XML Web service named MathService.asmx in C:\Inetpub\Wwwroot:
    <%@ WebService Language="C#" Class="MathService" %>
    
    using System;
    using System.Web.Services;
    using System.Web.Services.Protocols;
    
    public class MathService : WebService {
    
       [SoapDocumentMethod(Action="http://localhost/myMathService")]
       [WebMethod] 
       public float Add(float a, float b)
       {
           return a + b;
       }
    
       [SoapDocumentMethod(Action="http://localhost/myMathService")]
       [WebMethod] 
       public float Subtract(float a, float b)
       {
           return a - b;
       }
    }
    					
  2. Open http://localhost/MathService.asmx. Note that the Help page opens as expected.
  3. Generate the Web Service proxy named MathService.cs:
    wsdl http://localhost/MathService.asmx?wsdl /out:MathService.cs
    					
  4. 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("done");
       }
    }
    					
  5. Compile MathService.cs:
    csc /t:exe /r:system.dll;system.web.dll;system.web.services.dll MathService.cs
    					
  6. 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.

REFERENCES

For more information about the SOAP specification, visit the following World Wide Web Consortium (W3C) Web site:

Simple Object Access Protocol (SOAP) 1.1
http://www.w3.org/TR/SOAP


Modification Type:MajorLast Reviewed:9/17/2003
Keywords:kbbug kbnofix KB323575