当前位置: 首页>>代码示例>>C#>>正文


C# LogicalMethodInfo.GetKey方法代码示例

本文整理汇总了C#中System.Web.Services.Protocols.LogicalMethodInfo.GetKey方法的典型用法代码示例。如果您正苦于以下问题:C# LogicalMethodInfo.GetKey方法的具体用法?C# LogicalMethodInfo.GetKey怎么用?C# LogicalMethodInfo.GetKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.Services.Protocols.LogicalMethodInfo的用法示例。


在下文中一共展示了LogicalMethodInfo.GetKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReflectMethod

        internal static SoapReflectedMethod ReflectMethod(LogicalMethodInfo methodInfo, bool client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, string defaultNs) {
            try {
                string methodId = methodInfo.GetKey();
                SoapReflectedMethod soapMethod = new SoapReflectedMethod();
                MethodAttribute methodAttribute = new MethodAttribute();

                object serviceAttr = GetSoapServiceAttribute(methodInfo.DeclaringType);
                bool serviceDefaultIsEncoded = ServiceDefaultIsEncoded(serviceAttr);
                object methodAttr = GetSoapMethodAttribute(methodInfo);
                if (methodAttr == null) {
                    if (client) return null; // method attribute required on the client
                    if (serviceAttr is SoapRpcServiceAttribute) {
                        SoapRpcMethodAttribute method = new SoapRpcMethodAttribute();
                        method.Use = ((SoapRpcServiceAttribute)serviceAttr).Use;
                        methodAttr = method;
                    }
                    else if (serviceAttr is SoapDocumentServiceAttribute) {
                        SoapDocumentMethodAttribute method = new SoapDocumentMethodAttribute();
                        method.Use = ((SoapDocumentServiceAttribute)serviceAttr).Use;
                        methodAttr = method;
                    }
                    else {
                        methodAttr = new SoapDocumentMethodAttribute();
                    }
                }

                if (methodAttr is SoapRpcMethodAttribute) {
                    SoapRpcMethodAttribute attr = (SoapRpcMethodAttribute)methodAttr;

                    soapMethod.rpc = true;
                    soapMethod.use = attr.Use;
                    soapMethod.oneWay = attr.OneWay;
                    methodAttribute.action = attr.Action;
                    methodAttribute.binding = attr.Binding;
                    methodAttribute.requestName = attr.RequestElementName;
                    methodAttribute.requestNs = attr.RequestNamespace;
                    methodAttribute.responseName = attr.ResponseElementName;
                    methodAttribute.responseNs = attr.ResponseNamespace;
                }
                else {
                    SoapDocumentMethodAttribute attr = (SoapDocumentMethodAttribute)methodAttr;
                    
                    soapMethod.rpc = false;
                    soapMethod.use = attr.Use;
                    soapMethod.paramStyle = attr.ParameterStyle;
                    soapMethod.oneWay = attr.OneWay;
                    methodAttribute.action = attr.Action;
                    methodAttribute.binding = attr.Binding;
                    methodAttribute.requestName = attr.RequestElementName;
                    methodAttribute.requestNs = attr.RequestNamespace;
                    methodAttribute.responseName = attr.ResponseElementName;
                    methodAttribute.responseNs = attr.ResponseNamespace;

                    if (soapMethod.use == SoapBindingUse.Default) {
                        if (serviceAttr is SoapDocumentServiceAttribute)
                            soapMethod.use = ((SoapDocumentServiceAttribute)serviceAttr).Use;
                        if (soapMethod.use == SoapBindingUse.Default)
                            soapMethod.use = SoapBindingUse.Literal;
                    }
                    if (soapMethod.paramStyle == SoapParameterStyle.Default) {
                        if (serviceAttr is SoapDocumentServiceAttribute)
                            soapMethod.paramStyle = ((SoapDocumentServiceAttribute)serviceAttr).ParameterStyle;
                        if (soapMethod.paramStyle == SoapParameterStyle.Default)
                            soapMethod.paramStyle = SoapParameterStyle.Wrapped;
                    }
                }

                if (methodAttribute.binding.Length > 0) {
                    if (client) throw new InvalidOperationException(Res.GetString(Res.WebInvalidBindingPlacement, methodAttr.GetType().Name));
                    soapMethod.binding = WebServiceBindingReflector.GetAttribute(methodInfo, methodAttribute.binding);
                }

                WebMethodAttribute webMethodAttribute = methodInfo.MethodAttribute;

                // 
                soapMethod.name = webMethodAttribute.MessageName;
                if (soapMethod.name.Length == 0) soapMethod.name = methodInfo.Name;

                string requestElementName;
                if (soapMethod.rpc) {
                    // in the case when we interop with non .net we might need to chnage the method name.
                    requestElementName = methodAttribute.requestName.Length == 0 || !client ? methodInfo.Name : methodAttribute.requestName;
                }
                else {
                    requestElementName = methodAttribute.requestName.Length == 0 ? soapMethod.name : methodAttribute.requestName;
                }
                string requestNamespace = methodAttribute.requestNs;

                if (requestNamespace == null) {
                    if (soapMethod.binding != null && soapMethod.binding.Namespace != null && soapMethod.binding.Namespace.Length != 0)
                        requestNamespace = soapMethod.binding.Namespace;
                    else
                        requestNamespace = defaultNs;
                }

                string responseElementName;
                if (soapMethod.rpc && soapMethod.use != SoapBindingUse.Encoded)
                {
                    // NOTE: this rule should apply equally to rpc/lit and rpc/enc, but to reduce risk, i'm only applying it to rpc/lit
                    responseElementName = methodInfo.Name + "Response";
//.........这里部分代码省略.........
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:101,代码来源:SoapReflector.cs

示例2: ReflectMethod

 internal static SoapReflectedMethod ReflectMethod(LogicalMethodInfo methodInfo, bool client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, string defaultNs)
 {
     SoapReflectedMethod method2;
     try
     {
         string str2;
         string str4;
         string key = methodInfo.GetKey();
         SoapReflectedMethod method = new SoapReflectedMethod();
         MethodAttribute attribute = new MethodAttribute();
         object soapServiceAttribute = GetSoapServiceAttribute(methodInfo.DeclaringType);
         bool serviceDefaultIsEncoded = ServiceDefaultIsEncoded(soapServiceAttribute);
         object soapMethodAttribute = GetSoapMethodAttribute(methodInfo);
         if (soapMethodAttribute == null)
         {
             if (client)
             {
                 return null;
             }
             if (soapServiceAttribute is SoapRpcServiceAttribute)
             {
                 SoapRpcMethodAttribute attribute2 = new SoapRpcMethodAttribute {
                     Use = ((SoapRpcServiceAttribute) soapServiceAttribute).Use
                 };
                 soapMethodAttribute = attribute2;
             }
             else if (soapServiceAttribute is SoapDocumentServiceAttribute)
             {
                 SoapDocumentMethodAttribute attribute3 = new SoapDocumentMethodAttribute {
                     Use = ((SoapDocumentServiceAttribute) soapServiceAttribute).Use
                 };
                 soapMethodAttribute = attribute3;
             }
             else
             {
                 soapMethodAttribute = new SoapDocumentMethodAttribute();
             }
         }
         if (soapMethodAttribute is SoapRpcMethodAttribute)
         {
             SoapRpcMethodAttribute attribute4 = (SoapRpcMethodAttribute) soapMethodAttribute;
             method.rpc = true;
             method.use = attribute4.Use;
             method.oneWay = attribute4.OneWay;
             attribute.action = attribute4.Action;
             attribute.binding = attribute4.Binding;
             attribute.requestName = attribute4.RequestElementName;
             attribute.requestNs = attribute4.RequestNamespace;
             attribute.responseName = attribute4.ResponseElementName;
             attribute.responseNs = attribute4.ResponseNamespace;
         }
         else
         {
             SoapDocumentMethodAttribute attribute5 = (SoapDocumentMethodAttribute) soapMethodAttribute;
             method.rpc = false;
             method.use = attribute5.Use;
             method.paramStyle = attribute5.ParameterStyle;
             method.oneWay = attribute5.OneWay;
             attribute.action = attribute5.Action;
             attribute.binding = attribute5.Binding;
             attribute.requestName = attribute5.RequestElementName;
             attribute.requestNs = attribute5.RequestNamespace;
             attribute.responseName = attribute5.ResponseElementName;
             attribute.responseNs = attribute5.ResponseNamespace;
             if (method.use == SoapBindingUse.Default)
             {
                 if (soapServiceAttribute is SoapDocumentServiceAttribute)
                 {
                     method.use = ((SoapDocumentServiceAttribute) soapServiceAttribute).Use;
                 }
                 if (method.use == SoapBindingUse.Default)
                 {
                     method.use = SoapBindingUse.Literal;
                 }
             }
             if (method.paramStyle == SoapParameterStyle.Default)
             {
                 if (soapServiceAttribute is SoapDocumentServiceAttribute)
                 {
                     method.paramStyle = ((SoapDocumentServiceAttribute) soapServiceAttribute).ParameterStyle;
                 }
                 if (method.paramStyle == SoapParameterStyle.Default)
                 {
                     method.paramStyle = SoapParameterStyle.Wrapped;
                 }
             }
         }
         if (attribute.binding.Length > 0)
         {
             if (client)
             {
                 throw new InvalidOperationException(System.Web.Services.Res.GetString("WebInvalidBindingPlacement", new object[] { soapMethodAttribute.GetType().Name }));
             }
             method.binding = WebServiceBindingReflector.GetAttribute(methodInfo, attribute.binding);
         }
         WebMethodAttribute methodAttribute = methodInfo.MethodAttribute;
         method.name = methodAttribute.MessageName;
         if (method.name.Length == 0)
         {
             method.name = methodInfo.Name;
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:SoapReflector.cs


注:本文中的System.Web.Services.Protocols.LogicalMethodInfo.GetKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。