Bug 14877 - ManageName attribute not handled for WebMethod
Summary: ManageName attribute not handled for WebMethod
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web.Services ()
Version: master
Hardware: All Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-09-20 09:35 UTC by Neale Ferguson
Modified: 2013-09-23 12:27 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 14877 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Neale Ferguson 2013-09-20 09:35:54 UTC
I had a webservice that was working fine. I duplicated a routine - same name but with different parameters which requires the MessageName attribute. So for the duplicated routine which originally just had:
                [WebMethod (Description="Process VMARCH QUERY TAPES ALL command")]
I changed it to                         
                [WebMethod (Description="Process VMARCH QUERY TAPES ALL command",
                            MessageName="vmaQryTapesAll")]

Pointed browser to: http://localhost:9000/webservice.asmx and now get:

System.ArgumentOutOfRangeException
Argument is out of range.

Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): System.Web.Services.
Exception stack trace:
  at System.Web.Services.Description.MessageCollection.get_Item (Int32 index) [0x00000] in <filename unknown>:0 
  at System.Web.Services.Description.MessageCollection.get_Item (System.String name) [0x00000] in <filename unknown>:0 
  at System.Web.Services.Description.BasicProfileChecker.CheckR2305 (System.Web.Services.Description.ConformanceCheckContext ctx, System.Web.Services.Description.Operation value) [0x00000] in <filename unknown>:0 
  at System.Web.Services.Description.BasicProfileChecker.Check (System.Web.Services.Description.ConformanceCheckContext ctx, System.Web.Services.Description.Operation value) [0x00000] in <filename unknown>:0 
  at System.Web.Services.Description.WebServicesInteroperability.Check (System.Web.Services.Description.ConformanceCheckContext ctx, System.Web.Services.Description.ConformanceChecker checker, System.Web.Services.Description.ServiceDescription sd) [0x00000] in <filename unknown>:0 
  at System.Web.Services.Description.WebServicesInteroperability.Check (WsiProfiles claims, System.Web.Services.Description.ConformanceCheckContext ctx, IEnumerable documents) [0x00000] in <filename unknown>:0 
  at System.Web.Services.Description.WebServicesInteroperability.CheckConformance (WsiProfiles claims, System.Web.Services.Description.ServiceDescriptionCollection services, System.Web.Services.Description.BasicProfileViolationCollection violations) [0x00000] in <filename unknown>:0 
  at ASP.DefaultWsdlHelpGenerator_aspx.Page_Load (System.Object sender, System.EventArgs e) [0x00000] in <filename unknown>:0 
  at System.Web.UI.Control.OnLoad (System.EventArgs e) [0x00000] in <filename unknown>:0 
  at System.Web.UI.Control.LoadRecursive () [0x00000] in <filename unknown>:0 
  at System.Web.UI.Page.ProcessLoad () [0x00000] in <filename unknown>:0 
  at System.Web.UI.Page.ProcessPostData () [0x00000] in <filename unknown>:0 
  at System.Web.UI.Page.InternalProcessRequest () [0x00000] in <filename unknown>:0 
  at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0 

At the bottom is the minimal test case that results in the error. If you rename the 2nd testIt to something else and get rid of the (MessageName...), there's no problem.

This problem has been replicated on three different systems (s390x, 2 x x86_64)

The problem appears to be when System.Web.Services.Description.BasicProfileChecker.CheckR2305 invokes
System.Web.Services.Description.MessageCollection.get_Item using the string "TestInt". The IndexOf comes back with -1 which triggers the throw. The call to IndexOf is:

[  6] . . . . . . ENTER: System.Web.Services.Description.MessageCollection:IndexOf (System.WebDescription.Message) ip: 0x3ffd725d0ac sp: 0x3fff4b13a98 - this[MONO_TYPE_CLASS]: 0x3ffd767ae3:null],ECTT


                public Message this [int index] {
                        get {
                                if (index < 0 || index > Count)
                                        throw new ArgumentOutOfRangeException ();

                                return (Message) List [index];
                        }
                        set { List [index] = value; }
                }

                public Message this [string name] {
                        get { return this [IndexOf ((Message) Table [name])]; }
                }

The trace shows:

[  6] . . . . . . ENTER: System.Web.Services.Description.MessageCollection:IndexOf (System.WebDescription.Message) ip: 0x3ffd725d0ac sp: 0x3fff4b13a98 - this[MONO_TYPE_CLASS]: 0x3ffd767ae3:null],ECTT

As far as I can see from the trace, List.Insert is never called to put things into the table.

-------------------------------------------

<%@ WebService Language="C#" Class="TestService.Testing" %>

using System;
using System.Web.Services;
using System.Xml;
using System.Runtime.InteropServices;

namespace TestService
{
        [WebService (Namespace="http://localhost/TestService",
                     Description="Webservice test case")]
        public class Testing : WebService
        {
                [WebMethod]
                public XmlDocument testIt()
                {
                        XmlDocument doc = new XmlDocument();
                        doc.LoadXml("<TEST>Test Data</TEST>");

                        return(doc);
                }
                [WebMethod (MessageName="testInt")]
                public XmlDocument testIt(int a)
                {
                        XmlDocument doc = new XmlDocument();
                        if (a == 0)
                                doc.LoadXml("<TEST>Test 0</TEST>");
                        else
                                doc.LoadXml("<TEST>Test !0</TEST>");

                        return(doc);
                }
        }
}
Comment 1 Neale Ferguson 2013-09-23 12:27:10 UTC
I note that System.Web.Services.Description.BasicProfileChecker.CheckR2305 checks that the result from get_Item is null or not. However, get_Item doesn't return null but simply throws an exception (


--- a/mcs/class/System.Web.Services/System.Web.Services.Description/BasicProfileChecker.cs
+++ b/mcs/class/System.Web.Services/System.Web.Services.Description/BasicProfileChecker.cs
@@ -418,11 +418,16 @@ namespace System.Web.Services.Description
                        ServiceDescription sd = value.PortType.ServiceDescription;
                        Message omitted = null;
                        foreach (OperationMessage m in value.Messages) {
+                               Message msg;
                                if (m.Name == null)
                                        continue; // it is doubtful, but R2305 is not to check suc
h cases anyways.
-                               Message msg = sd.Messages [m.Name];
-                               if (msg == null)
-                                       continue; // it is doubtful, but R2305 is not to check suc
h cases anyways.
+                               try {
+                                       msg = sd.Messages [m.Name];
+                                       if (msg == null)
+                                               continue; // it is doubtful, but R2305 is not to c
heck such cases anyways.
+                               } catch {
+                                       continue;
+                               }
                                foreach (MessagePart p in msg.Parts) {
                                        if (order != null && Array.IndexOf (order, p.Name) >= 0)
                                                continue;

This circumvents the problem - it is able to discern between testIt and testInt which indicates MessageName is being honored. However, it does report the following:

Basic Profile Conformance

This web service does not conform to WS-I Basic Profile v1.1
R2209: A wsdl:binding in a DESCRIPTION SHOULD bind every wsdl:part of a wsdl:message in the wsdl:portType to which it refers to one of soapbind:body, soapbind:header, soapbind:fault or soapbind:headerfault
Binding 'TestingSoap', in Service Description 'http://localhost/TestService'
Binding 'TestingSoap12', in Service Description 'http://localhost/TestService'
R2710: The operations in a wsdl:binding in a DESCRIPTION MUST result in operation signatures that are different from one another.
Binding 'TestingSoap', in Service Description 'http://localhost/TestService'
Binding 'TestingSoap12', in Service Description 'http://localhost/TestService'
R2304: A wsdl:portType in a DESCRIPTION MUST have operations with distinct values for their name attributes.
PortType 'TestingSoap', in Service Description 'http://localhost/TestService'
PortType 'TestingSoap12', in Service Description 'http://localhost/TestService'
PortType 'TestingHttpGet', in Service Description 'http://localhost/TestService'
PortType 'TestingHttpPost', in Service Description 'http://localhost/TestService'