Note that there are some explanatory texts on larger screens.

plurals
  1. POExtra parameters added to webmethods
    text
    copied!<p>I'm reading some <code>MethodInfo</code> from a proxy generated from a wsdl. </p> <p>One of the methods has three (<code>int</code>) parameters and a <code>int</code> return type, but when I explore the <code>ParameterInfo[]</code> I actually see eight parameters: </p> <ul> <li><code>Int32</code>, </li> <li><code>Boolean</code>, </li> <li><code>Int32</code>, </li> <li><code>Boolean</code>, </li> <li><code>Int32</code>, </li> <li><code>Boolean</code>, </li> <li><code>Int32&amp;</code>, </li> <li><code>Boolean&amp;</code></li> </ul> <p>Where do these extra parameters originate? </p> <p><strong>UPDATE</strong> </p> <p>To elaborate a bit more, the code in the generated proxy looks as following:</p> <pre><code> /// &lt;remarks/&gt; [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/IInleerAppService/AddThreeNumbers", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public void AddThreeNumbers(int one, [System.Xml.Serialization.XmlIgnoreAttribute()] bool oneSpecified, int two, [System.Xml.Serialization.XmlIgnoreAttribute()] bool twoSpecified, int three, [System.Xml.Serialization.XmlIgnoreAttribute()] bool threeSpecified, out int AddThreeNumbersResult, [System.Xml.Serialization.XmlIgnoreAttribute()] out bool AddThreeNumbersResultSpecified) { object[] results = this.Invoke("AddThreeNumbers", new object[] { one, oneSpecified, two, twoSpecified, three, threeSpecified}); AddThreeNumbersResult = ((int)(results[0])); AddThreeNumbersResultSpecified = ((bool)(results[1])); } </code></pre> <p>Why is this? </p> <p>UPDATE</p> <p>If you're bugged by this, as I am, you cane easily avoid displaying those extra parameters by simply applying the following snippet of code:</p> <pre><code>if (!parameterInfo[i].Name.EndsWith("Specified") &amp;&amp; !parameterInfo[i].IsRetval &amp;&amp; !parameterInfo[i].Name.EndsWith("Result")) { // magic } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload