English 中文(简体)
网上方法添加的外在参数
原标题:Extra parameters added to webmethods

I m reading some MethodInfo from a proxy generated from a wsdl.

其中一种方法有三种(int)参数和int 返回类型,但在我探讨ParailesInfo[] I时,实际看见8个参数:

  • Int32,
  • Boolean,
  • Int32,
  • Boolean,
  • Int32,
  • Boolean,
  • Int32&,
  • Boolean&

这些额外参数源自何处?

附录

更细致的是,所生成的代用法中的代码如下:

  /// <remarks/>
[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]));
}

为什么如此?

附录

如果你像我这样重新 by,那么你可以简单地适用以下法典,很容易避免显示这些额外参数:

if (!parameterInfo[i].Name.EndsWith("Specified") && !parameterInfo[i].IsRetval && !parameterInfo[i].Name.EndsWith("Result"))
{
    // magic
}
最佳回答

我最近亲眼看到这一点。 在某些情况下,在科学、技术和科学部中,它必须使用<代码>minoccurs=0。 世界路德会联合会的代理类别不使用可取消的类型,因此不可能由XmlSerializer确定你是否想要或不想派某个领域。

您可以制定<条码>,但得分。 您还必须制定<条码>专注至<条码>>,使条码的序列化,并将其发送。

http://blogs.msdn.com/b/youssefm/archive/03/22/how-to-get-minoccurs-0-in-the-schema-for-xmlserializer-struct- members.aspx”rel=“nofollow”>here。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签