internal override SoapServerMethod RouteRequest() { object requestElement; string str = base.ServerProtocol.Request.Headers["SOAPAction"]; if (str == null) { throw new SoapException(System.Web.Services.Res.GetString("UnableToHandleRequestActionRequired0"), new XmlQualifiedName("Client", "http://schemas.xmlsoap.org/soap/envelope/")); } if (base.ServerType.routingOnSoapAction) { if (str.StartsWith("\"", StringComparison.Ordinal) && str.EndsWith("\"", StringComparison.Ordinal)) { str = str.Substring(1, str.Length - 2); } requestElement = System.Web.HttpUtility.UrlDecode(str); } else { try { requestElement = base.GetRequestElement(); } catch (SoapException) { throw; } catch (Exception exception) { if (((exception is ThreadAbortException) || (exception is StackOverflowException)) || (exception is OutOfMemoryException)) { throw; } throw new SoapException(System.Web.Services.Res.GetString("TheRootElementForTheRequestCouldNotBeDetermined0"), new XmlQualifiedName("Server", "http://schemas.xmlsoap.org/soap/envelope/"), exception); } } TraceMethod caller = Tracing.On ? new TraceMethod(this, "RouteRequest", new object[0]) : null; if (Tracing.On) { Tracing.Enter("RouteRequest", caller, new TraceMethod(base.ServerType, "GetMethod", new object[] { requestElement }), Tracing.Details(base.ServerProtocol.Request)); } SoapServerMethod method = base.ServerType.GetMethod(requestElement); if (Tracing.On) { Tracing.Exit("RouteRequest", caller); } if (method != null) { return(method); } if (base.ServerType.routingOnSoapAction) { throw new SoapException(System.Web.Services.Res.GetString("WebHttpHeader", new object[] { "SOAPAction", (string)requestElement }), new XmlQualifiedName("Client", "http://schemas.xmlsoap.org/soap/envelope/")); } throw new SoapException(System.Web.Services.Res.GetString("TheRequestElementXmlnsWasNotRecognized2", new object[] { ((XmlQualifiedName)requestElement).Name, ((XmlQualifiedName)requestElement).Namespace }), new XmlQualifiedName("Client", "http://schemas.xmlsoap.org/soap/envelope/")); }
internal override SoapServerMethod RouteRequest() { object methodKey; string methodUriString = ServerProtocol.Request.Headers[Soap.Action]; if (methodUriString == null) { throw new SoapException(Res.GetString(Res.UnableToHandleRequestActionRequired0), new XmlQualifiedName(Soap.ClientCode, Soap.Namespace)); } if (ServerType.routingOnSoapAction) { if (methodUriString.StartsWith("\"") && methodUriString.EndsWith("\"")) { methodUriString = methodUriString.Substring(1, methodUriString.Length - 2); } methodKey = HttpUtility.UrlDecode(methodUriString); } else { try { methodKey = GetRequestElement(); } catch (SoapException) { throw; } catch (Exception e) { throw new SoapException(Res.GetString(Res.TheRootElementForTheRequestCouldNotBeDetermined0), new XmlQualifiedName(Soap.ServerCode, Soap.Namespace), e); } } SoapServerMethod method = ServerType.GetMethod(methodKey); if (method == null) { if (ServerType.routingOnSoapAction) { throw new SoapException(Res.GetString(Res.WebHttpHeader, Soap.Action, (string)methodKey), new XmlQualifiedName(Soap.ClientCode, Soap.Namespace)); } else { throw new SoapException(Res.GetString(Res.TheRequestElementXmlnsWasNotRecognized2, ((XmlQualifiedName)methodKey).Name, ((XmlQualifiedName)methodKey).Namespace), new XmlQualifiedName(Soap.ClientCode, Soap.Namespace)); } } return(method); }
public SoapServerType (Type type, WebServiceProtocols protocolsSupported) : base (type) { // FIXME: these calls could be altered. Here they // are invoked to verify attributes. if ((protocolsSupported & WebServiceProtocols.HttpSoap) != 0) LogicalType.GetTypeStub ("Soap"); if ((protocolsSupported & WebServiceProtocols.HttpSoap12) != 0) LogicalType.GetTypeStub ("Soap12"); foreach (LogicalMethodInfo m in LogicalType.LogicalMethods) { SoapServerMethod sm = new SoapServerMethod (type, m); serverMethods.Add (sm.Action, sm); } }
public SoapServerType(Type type, WebServiceProtocols protocolsSupported) : base(type) { // FIXME: these calls could be altered. Here they // are invoked to verify attributes. if ((protocolsSupported & WebServiceProtocols.HttpSoap) != 0) { LogicalType.GetTypeStub("Soap"); } if ((protocolsSupported & WebServiceProtocols.HttpSoap12) != 0) { LogicalType.GetTypeStub("Soap12"); } foreach (LogicalMethodInfo m in LogicalType.LogicalMethods) { SoapServerMethod sm = new SoapServerMethod(type, m); serverMethods.Add(sm.Action, sm); } }
public SoapServerType(Type type, WebServiceProtocols protocolsSupported) : base(type) { this.protocolsSupported = protocolsSupported; bool soap11 = (protocolsSupported & WebServiceProtocols.HttpSoap) != 0; bool soap12 = (protocolsSupported & WebServiceProtocols.HttpSoap12) != 0; LogicalMethodInfo[] methodInfos = WebMethodReflector.GetMethods(type); ArrayList mappings = new ArrayList(); WebServiceAttribute serviceAttribute = WebServiceReflector.GetAttribute(type); object soapServiceAttribute = SoapReflector.GetSoapServiceAttribute(type); routingOnSoapAction = SoapReflector.GetSoapServiceRoutingStyle(soapServiceAttribute) == SoapServiceRoutingStyle.SoapAction; serviceNamespace = serviceAttribute.Namespace; serviceDefaultIsEncoded = SoapReflector.ServiceDefaultIsEncoded(type); SoapReflectionImporter soapImporter = SoapReflector.CreateSoapImporter(serviceNamespace, serviceDefaultIsEncoded); XmlReflectionImporter xmlImporter = SoapReflector.CreateXmlImporter(serviceNamespace, serviceDefaultIsEncoded); SoapReflector.IncludeTypes(methodInfos, soapImporter); WebMethodReflector.IncludeTypes(methodInfos, xmlImporter); SoapReflectedMethod[] soapMethods = new SoapReflectedMethod[methodInfos.Length]; SoapExtensionTypeElementCollection extensionTypes = WebServicesSection.Current.SoapExtensionTypes; ArrayList highPri = new ArrayList(); ArrayList lowPri = new ArrayList(); for (int i = 0; i < extensionTypes.Count; i++) { SoapExtensionTypeElement element = extensionTypes[i]; if (element == null) continue; SoapReflectedExtension extension = new SoapReflectedExtension(element.Type, null, element.Priority); if (element.Group == PriorityGroup.High) highPri.Add(extension); else lowPri.Add(extension); } HighPriExtensions = (SoapReflectedExtension[]) highPri.ToArray(typeof(SoapReflectedExtension)); LowPriExtensions = (SoapReflectedExtension[]) lowPri.ToArray(typeof(SoapReflectedExtension)); Array.Sort(HighPriExtensions); Array.Sort(LowPriExtensions); HighPriExtensionInitializers = SoapReflectedExtension.GetInitializers(type, HighPriExtensions); LowPriExtensionInitializers = SoapReflectedExtension.GetInitializers(type, LowPriExtensions); for (int i = 0; i < methodInfos.Length; i++) { LogicalMethodInfo methodInfo = methodInfos[i]; SoapReflectedMethod soapMethod = SoapReflector.ReflectMethod(methodInfo, false, xmlImporter, soapImporter, serviceAttribute.Namespace); mappings.Add(soapMethod.requestMappings); if (soapMethod.responseMappings != null) mappings.Add(soapMethod.responseMappings); mappings.Add(soapMethod.inHeaderMappings); if (soapMethod.outHeaderMappings != null) mappings.Add(soapMethod.outHeaderMappings); soapMethods[i] = soapMethod; } XmlMapping[] xmlMappings = (XmlMapping[])mappings.ToArray(typeof(XmlMapping)); TraceMethod caller = Tracing.On ? new TraceMethod(this, ".ctor", type, protocolsSupported) : null; if (Tracing.On) Tracing.Enter(Tracing.TraceId(Res.TraceCreateSerializer), caller, new TraceMethod(typeof(XmlSerializer), "FromMappings", xmlMappings, this.Evidence)); XmlSerializer[] serializers = null; if (AppDomain.CurrentDomain.IsHomogenous) { serializers = XmlSerializer.FromMappings(xmlMappings); } else { #pragma warning disable 618 // If we're in a non-homogenous domain, legacy CAS mode is enabled, so passing through evidence will not fail serializers = XmlSerializer.FromMappings((xmlMappings), this.Evidence); #pragma warning restore 618 } if (Tracing.On) Tracing.Exit(Tracing.TraceId(Res.TraceCreateSerializer), caller); int count = 0; for (int i = 0; i < soapMethods.Length; i++) { SoapServerMethod serverMethod = new SoapServerMethod(); SoapReflectedMethod soapMethod = soapMethods[i]; serverMethod.parameterSerializer = serializers[count++]; if (soapMethod.responseMappings != null) serverMethod.returnSerializer = serializers[count++]; serverMethod.inHeaderSerializer = serializers[count++]; if (soapMethod.outHeaderMappings != null) serverMethod.outHeaderSerializer = serializers[count++]; serverMethod.methodInfo = soapMethod.methodInfo; serverMethod.action = soapMethod.action; serverMethod.extensions = soapMethod.extensions; serverMethod.extensionInitializers = SoapReflectedExtension.GetInitializers(serverMethod.methodInfo, soapMethod.extensions); serverMethod.oneWay = soapMethod.oneWay; serverMethod.rpc = soapMethod.rpc; serverMethod.use = soapMethod.use; serverMethod.paramStyle = soapMethod.paramStyle; serverMethod.wsiClaims = soapMethod.binding == null ? WsiProfiles.None : soapMethod.binding.ConformsTo; ArrayList inHeaders = new ArrayList(); ArrayList outHeaders = new ArrayList(); for (int j = 0; j < soapMethod.headers.Length; j++) { SoapHeaderMapping mapping = new SoapHeaderMapping(); SoapReflectedHeader soapHeader = soapMethod.headers[j]; mapping.memberInfo = soapHeader.memberInfo; mapping.repeats = soapHeader.repeats; mapping.custom = soapHeader.custom; mapping.direction = soapHeader.direction; mapping.headerType = soapHeader.headerType; if (mapping.direction == SoapHeaderDirection.In) inHeaders.Add(mapping); else if (mapping.direction == SoapHeaderDirection.Out) outHeaders.Add(mapping); else { inHeaders.Add(mapping); outHeaders.Add(mapping); } } serverMethod.inHeaderMappings = (SoapHeaderMapping[])inHeaders.ToArray(typeof(SoapHeaderMapping)); if (serverMethod.outHeaderSerializer != null) serverMethod.outHeaderMappings = (SoapHeaderMapping[])outHeaders.ToArray(typeof(SoapHeaderMapping)); // check feasibility of routing on request element for soap 1.1 if (soap11 && !routingOnSoapAction && soapMethod.requestElementName.IsEmpty) throw new SoapException(Res.GetString(Res.TheMethodDoesNotHaveARequestElementEither1, serverMethod.methodInfo.Name), new XmlQualifiedName(Soap.Code.Client, Soap.Namespace)); // we can lookup methods by action or request element if (methods[soapMethod.action] == null) methods[soapMethod.action] = serverMethod; else { // duplicate soap actions not allowed in soap 1.1 if we're routing on soap action if (soap11 && routingOnSoapAction) { SoapServerMethod duplicateMethod = (SoapServerMethod)methods[soapMethod.action]; throw new SoapException(Res.GetString(Res.TheMethodsAndUseTheSameSoapActionWhenTheService3, serverMethod.methodInfo.Name, duplicateMethod.methodInfo.Name, soapMethod.action), new XmlQualifiedName(Soap.Code.Client, Soap.Namespace)); } duplicateMethods[soapMethod.action] = serverMethod; } if (methods[soapMethod.requestElementName] == null) methods[soapMethod.requestElementName] = serverMethod; else { // duplicate request elements not allowed in soap 1.1 if we're routing on request element if (soap11 && !routingOnSoapAction) { SoapServerMethod duplicateMethod = (SoapServerMethod)methods[soapMethod.requestElementName]; throw new SoapException(Res.GetString(Res.TheMethodsAndUseTheSameRequestElementXmlns4, serverMethod.methodInfo.Name, duplicateMethod.methodInfo.Name, soapMethod.requestElementName.Name, soapMethod.requestElementName.Namespace), new XmlQualifiedName(Soap.Code.Client, Soap.Namespace)); } duplicateMethods[soapMethod.requestElementName] = serverMethod; } } }
internal override bool Initialize() { // try to guess the request version so we can handle any exceptions that might come up GuessVersion(); message = new SoapServerMessage(this); onewayInitException = null; if (null == (serverType = (SoapServerType)GetFromCache(typeof(SoapServerProtocol), Type)) && null == (serverType = (SoapServerType)GetFromCache(typeof(SoapServerProtocol), Type, true))) { lock (InternalSyncObject) { if (null == (serverType = (SoapServerType)GetFromCache(typeof(SoapServerProtocol), Type)) && null == (serverType = (SoapServerType)GetFromCache(typeof(SoapServerProtocol), Type, true))) { bool excludeSchemeHostPortFromCachingKey = this.IsCacheUnderPressure(typeof(SoapServerProtocol), Type); serverType = new SoapServerType(Type, protocolsSupported); AddToCache(typeof(SoapServerProtocol), Type, serverType, excludeSchemeHostPortFromCachingKey); } } } // We delay throwing any exceptions out of the extension until we determine if the method is one-way or not. Exception extensionException = null; try { message.highPriConfigExtensions = SoapMessage.InitializeExtensions(serverType.HighPriExtensions, serverType.HighPriExtensionInitializers); // // Allow derived classes to modify the high priority extensions list. // message.highPriConfigExtensions = ModifyInitializedExtensions(PriorityGroup.High, message.highPriConfigExtensions); // For one-way methods we rely on Request.InputStream guaranteeing that the entire request body has arrived message.SetStream(Request.InputStream); #if DEBUG //Debug.Assert(message.Stream.CanSeek, "Web services SOAP handler assumes a seekable stream."); // use exception in the place of Debug.Assert to avoid throwing asserts from a server process such as aspnet_ewp.exe if (!message.Stream.CanSeek) throw new InvalidOperationException("Non-Seekable stream " + message.Stream.GetType().FullName + " Web services SOAP handler assumes a seekable stream."); #endif message.InitExtensionStreamChain(message.highPriConfigExtensions); message.SetStage(SoapMessageStage.BeforeDeserialize); message.ContentType = Request.ContentType; message.ContentEncoding = Request.Headers[ContentType.ContentEncoding]; message.RunExtensions(message.highPriConfigExtensions, false); extensionException = message.Exception; } catch (Exception e) { if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException) { throw; } if (Tracing.On) Tracing.ExceptionCatch(TraceEventType.Warning, this, "Initialize", e); extensionException = e; } // set this here since we might throw before we init the other extensions message.allExtensions = message.highPriConfigExtensions; // maybe the extensions that just ran changed some of the request data so we can make a better version guess GuessVersion(); try { this.serverMethod = RouteRequest(message); // the RouteRequest impl should throw an exception if it can't route the request but just in case... if (this.serverMethod == null) throw new SoapException(Res.GetString(Res.UnableToHandleRequest0), new XmlQualifiedName(Soap.Code.Server, Soap.Namespace)); } catch (Exception e) { if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException) { throw; } if (helper.RequestNamespace != null) SetHelper(SoapServerProtocolHelper.GetHelper(this, helper.RequestNamespace)); // version mismatches override other errors CheckHelperVersion(); throw; } this.isOneWay = serverMethod.oneWay; if (extensionException == null) { try { SoapReflectedExtension[] otherReflectedExtensions = (SoapReflectedExtension[]) CombineExtensionsHelper(serverMethod.extensions, serverType.LowPriExtensions, typeof(SoapReflectedExtension)); object[] otherInitializers = (object[]) CombineExtensionsHelper(serverMethod.extensionInitializers, serverType.LowPriExtensionInitializers, typeof(object)); message.otherExtensions = SoapMessage.InitializeExtensions(otherReflectedExtensions, otherInitializers); // // Allow derived classes to modify the other extensions list. // message.otherExtensions = ModifyInitializedExtensions(PriorityGroup.Low, message.otherExtensions); message.allExtensions = (SoapExtension[]) CombineExtensionsHelper(message.highPriConfigExtensions, message.otherExtensions, typeof(SoapExtension)); } catch (Exception e) { if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException) { throw; } if (Tracing.On) Tracing.ExceptionCatch(TraceEventType.Warning, this, "Initialize", e); extensionException = e; } } if (extensionException != null) { if (isOneWay) onewayInitException = extensionException; else if (extensionException is SoapException) throw extensionException; else throw SoapException.Create(Version, Res.GetString(Res.WebConfigExtensionError), new XmlQualifiedName(Soap.Code.Server, Soap.Namespace), extensionException); } return true; }
internal override SoapServerMethod RouteRequest() { object methodKey; string methodUriString = ServerProtocol.Request.Headers[Soap.Action]; if (methodUriString == null) { throw new SoapException(Res.GetString(Res.UnableToHandleRequestActionRequired0), new XmlQualifiedName(Soap.Code.Client, Soap.Namespace)); } if (ServerType.routingOnSoapAction) { if (methodUriString.StartsWith("\"", StringComparison.Ordinal) && methodUriString.EndsWith("\"", StringComparison.Ordinal)) { methodUriString = methodUriString.Substring(1, methodUriString.Length - 2); } methodKey = HttpUtility.UrlDecode(methodUriString); } else { try { methodKey = GetRequestElement(); } catch (SoapException) { throw; } catch (Exception e) { if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException) { throw; } throw new SoapException(Res.GetString(Res.TheRootElementForTheRequestCouldNotBeDetermined0), new XmlQualifiedName(Soap.Code.Server, Soap.Namespace), e); } } TraceMethod caller = Tracing.On ? new TraceMethod(this, "RouteRequest") : null; if (Tracing.On) { Tracing.Enter("RouteRequest", caller, new TraceMethod(ServerType, "GetMethod", methodKey), Tracing.Details(ServerProtocol.Request)); } SoapServerMethod method = ServerType.GetMethod(methodKey); if (Tracing.On) { Tracing.Exit("RouteRequest", caller); } if (method == null) { if (ServerType.routingOnSoapAction) { throw new SoapException(Res.GetString(Res.WebHttpHeader, Soap.Action, (string)methodKey), new XmlQualifiedName(Soap.Code.Client, Soap.Namespace)); } else { throw new SoapException(Res.GetString(Res.TheRequestElementXmlnsWasNotRecognized2, ((XmlQualifiedName)methodKey).Name, ((XmlQualifiedName)methodKey).Namespace), new XmlQualifiedName(Soap.Code.Client, Soap.Namespace)); } } return(method); }
internal override SoapServerMethod RouteRequest() { string action = ContentType.GetAction(ServerProtocol.Request.ContentType); SoapServerMethod method = null; bool duplicateAction = false, duplicateRequestElement = false; TraceMethod caller = Tracing.On ? new TraceMethod(this, "RouteRequest") : null; if (action != null && action.Length > 0) { action = HttpUtility.UrlDecode(action); if (Tracing.On) { Tracing.Enter("RouteRequest", caller, new TraceMethod(ServerType, "GetMethod", action), Tracing.Details(ServerProtocol.Request)); } method = ServerType.GetMethod(action); if (Tracing.On) { Tracing.Exit("RouteRequest", caller); } if (method != null) { if (ServerType.GetDuplicateMethod(action) != null) { method = null; duplicateAction = true; } } } XmlQualifiedName requestElement = XmlQualifiedName.Empty; if (method == null) { // try request element requestElement = GetRequestElement(); if (Tracing.On) { Tracing.Enter("RouteRequest", caller, new TraceMethod(ServerType, "GetMethod", requestElement), Tracing.Details(ServerProtocol.Request)); } method = ServerType.GetMethod(requestElement); if (Tracing.On) { Tracing.Exit("RouteRequest", caller); } if (method != null) { if (ServerType.GetDuplicateMethod(requestElement) != null) { method = null; duplicateRequestElement = true; } } } if (method == null) { // try to figure out what happened... if (action == null || action.Length == 0) { // they didn't send a soap action and we couldn't route on request element // require soap action for future requests: throw new SoapException(Res.GetString(Res.UnableToHandleRequestActionRequired0), Soap12FaultCodes.SenderFaultCode); } else if (duplicateAction) { // what went wrong with the request element? if (duplicateRequestElement) { // server's fault -- nothing the client could have done to prevent this throw new SoapException(Res.GetString(Res.UnableToHandleRequest0), Soap12FaultCodes.ReceiverFaultCode); } else { // probably client's fault -- we didn't recognize the request element they sent throw new SoapException(Res.GetString(Res.TheRequestElementXmlnsWasNotRecognized2, requestElement.Name, requestElement.Namespace), Soap12FaultCodes.SenderFaultCode); } } else { // neither action nor request element worked out for us. since they sent an action, // we'll suggest they do a better job next time throw new SoapException(Res.GetString(Res.UnableToHandleRequestActionNotRecognized1, action), Soap12FaultCodes.SenderFaultCode); } } return(method); }
internal override bool Initialize() { this.GuessVersion(); this.message = new SoapServerMessage(this); this.onewayInitException = null; this.serverType = (SoapServerType)base.GetFromCache(typeof(SoapServerProtocol), base.Type); if (this.serverType == null) { lock (ServerProtocol.InternalSyncObject) { this.serverType = (SoapServerType)base.GetFromCache(typeof(SoapServerProtocol), base.Type); if (this.serverType == null) { this.serverType = new SoapServerType(base.Type, this.protocolsSupported); base.AddToCache(typeof(SoapServerProtocol), base.Type, this.serverType); } } } Exception innerException = null; try { this.message.highPriConfigExtensions = SoapMessage.InitializeExtensions(this.serverType.HighPriExtensions, this.serverType.HighPriExtensionInitializers); this.message.highPriConfigExtensions = this.ModifyInitializedExtensions(PriorityGroup.High, this.message.highPriConfigExtensions); this.message.SetStream(base.Request.InputStream); this.message.InitExtensionStreamChain(this.message.highPriConfigExtensions); this.message.SetStage(SoapMessageStage.BeforeDeserialize); this.message.ContentType = base.Request.ContentType; this.message.ContentEncoding = base.Request.Headers["Content-Encoding"]; this.message.RunExtensions(this.message.highPriConfigExtensions, false); innerException = this.message.Exception; } catch (Exception exception2) { if (((exception2 is ThreadAbortException) || (exception2 is StackOverflowException)) || (exception2 is OutOfMemoryException)) { throw; } if (Tracing.On) { Tracing.ExceptionCatch(TraceEventType.Warning, this, "Initialize", exception2); } innerException = exception2; } this.message.allExtensions = this.message.highPriConfigExtensions; this.GuessVersion(); try { this.serverMethod = this.RouteRequest(this.message); if (this.serverMethod == null) { throw new SoapException(System.Web.Services.Res.GetString("UnableToHandleRequest0"), new XmlQualifiedName("Server", "http://schemas.xmlsoap.org/soap/envelope/")); } } catch (Exception exception3) { if (((exception3 is ThreadAbortException) || (exception3 is StackOverflowException)) || (exception3 is OutOfMemoryException)) { throw; } if (this.helper.RequestNamespace != null) { this.SetHelper(SoapServerProtocolHelper.GetHelper(this, this.helper.RequestNamespace)); } this.CheckHelperVersion(); throw; } this.isOneWay = this.serverMethod.oneWay; if (innerException == null) { try { SoapReflectedExtension[] reflectedExtensions = (SoapReflectedExtension[])CombineExtensionsHelper(this.serverMethod.extensions, this.serverType.LowPriExtensions, typeof(SoapReflectedExtension)); object[] extensionInitializers = (object[])CombineExtensionsHelper(this.serverMethod.extensionInitializers, this.serverType.LowPriExtensionInitializers, typeof(object)); this.message.otherExtensions = SoapMessage.InitializeExtensions(reflectedExtensions, extensionInitializers); this.message.otherExtensions = this.ModifyInitializedExtensions(PriorityGroup.Low, this.message.otherExtensions); this.message.allExtensions = (SoapExtension[])CombineExtensionsHelper(this.message.highPriConfigExtensions, this.message.otherExtensions, typeof(SoapExtension)); } catch (Exception exception4) { if (((exception4 is ThreadAbortException) || (exception4 is StackOverflowException)) || (exception4 is OutOfMemoryException)) { throw; } if (Tracing.On) { Tracing.ExceptionCatch(TraceEventType.Warning, this, "Initialize", exception4); } innerException = exception4; } } if (innerException != null) { if (!this.isOneWay) { if (innerException is SoapException) { throw innerException; } throw SoapException.Create(this.Version, System.Web.Services.Res.GetString("WebConfigExtensionError"), new XmlQualifiedName("Server", "http://schemas.xmlsoap.org/soap/envelope/"), innerException); } this.onewayInitException = innerException; } return(true); }
internal SoapServerType(Type type, ProtocolsEnum versionsSupported) : base(type) { this.versionsSupported = versionsSupported; bool soap11 = (versionsSupported & ProtocolsEnum.HttpSoap) != 0; bool soap12 = (versionsSupported & ProtocolsEnum.HttpSoap12) != 0; LogicalMethodInfo[] methodInfos = WebMethodReflector.GetMethods(type); ArrayList mappings = new ArrayList(); WebServiceAttribute serviceAttribute = WebServiceReflector.GetAttribute(type); object soapServiceAttribute = SoapReflector.GetSoapServiceAttribute(type); routingOnSoapAction = SoapReflector.GetSoapServiceRoutingStyle(soapServiceAttribute) == SoapServiceRoutingStyle.SoapAction; serviceNamespace = serviceAttribute.Namespace; serviceDefaultIsEncoded = SoapReflector.ServiceDefaultIsEncoded(type); SoapReflectionImporter soapImporter = SoapReflector.CreateSoapImporter(serviceNamespace, serviceDefaultIsEncoded); XmlReflectionImporter xmlImporter = SoapReflector.CreateXmlImporter(serviceNamespace, serviceDefaultIsEncoded); SoapReflector.IncludeTypes(methodInfos, soapImporter); WebMethodReflector.IncludeTypes(methodInfos, xmlImporter); SoapReflectedMethod[] soapMethods = new SoapReflectedMethod[methodInfos.Length]; SoapExtensionType[] extensionTypes = WebServicesConfiguration.Current.SoapExtensionTypes; ArrayList highPri = new ArrayList(); ArrayList lowPri = new ArrayList(); for (int i = 0; i < extensionTypes.Length; i++) { SoapReflectedExtension extension = new SoapReflectedExtension(extensionTypes[i].Type, null, extensionTypes[i].Priority); if (extensionTypes[i].Group == SoapExtensionType.PriorityGroup.High) { highPri.Add(extension); } else { lowPri.Add(extension); } } HighPriExtensions = (SoapReflectedExtension[])highPri.ToArray(typeof(SoapReflectedExtension)); LowPriExtensions = (SoapReflectedExtension[])lowPri.ToArray(typeof(SoapReflectedExtension)); Array.Sort(HighPriExtensions); Array.Sort(LowPriExtensions); HighPriExtensionInitializers = SoapReflectedExtension.GetInitializers(type, HighPriExtensions); LowPriExtensionInitializers = SoapReflectedExtension.GetInitializers(type, LowPriExtensions); for (int i = 0; i < methodInfos.Length; i++) { LogicalMethodInfo methodInfo = methodInfos[i]; SoapReflectedMethod soapMethod = SoapReflector.ReflectMethod(methodInfo, false, xmlImporter, soapImporter, serviceAttribute.Namespace); mappings.Add(soapMethod.requestMappings); if (soapMethod.responseMappings != null) { mappings.Add(soapMethod.responseMappings); } mappings.Add(soapMethod.inHeaderMappings); if (soapMethod.outHeaderMappings != null) { mappings.Add(soapMethod.outHeaderMappings); } soapMethods[i] = soapMethod; } XmlSerializer[] serializers = XmlSerializer.FromMappings((XmlMapping[])mappings.ToArray(typeof(XmlMapping))); int count = 0; for (int i = 0; i < soapMethods.Length; i++) { SoapServerMethod serverMethod = new SoapServerMethod(); SoapReflectedMethod soapMethod = soapMethods[i]; serverMethod.parameterSerializer = serializers[count++]; if (soapMethod.responseMappings != null) { serverMethod.returnSerializer = serializers[count++]; } serverMethod.inHeaderSerializer = serializers[count++]; if (soapMethod.outHeaderMappings != null) { serverMethod.outHeaderSerializer = serializers[count++]; } serverMethod.methodInfo = soapMethod.methodInfo; serverMethod.action = soapMethod.action; serverMethod.extensions = soapMethod.extensions; serverMethod.extensionInitializers = SoapReflectedExtension.GetInitializers(serverMethod.methodInfo, soapMethod.extensions); serverMethod.oneWay = soapMethod.oneWay; serverMethod.rpc = soapMethod.rpc; serverMethod.use = soapMethod.use; serverMethod.paramStyle = soapMethod.paramStyle; ArrayList inHeaders = new ArrayList(); ArrayList outHeaders = new ArrayList(); for (int j = 0; j < soapMethod.headers.Length; j++) { SoapHeaderMapping mapping = new SoapHeaderMapping(); SoapReflectedHeader soapHeader = soapMethod.headers[j]; mapping.memberInfo = soapHeader.memberInfo; mapping.repeats = soapHeader.repeats; mapping.custom = soapHeader.custom; mapping.direction = soapHeader.direction; mapping.headerType = soapHeader.headerType; if (mapping.direction == SoapHeaderDirection.In) { inHeaders.Add(mapping); } else if (mapping.direction == SoapHeaderDirection.Out) { outHeaders.Add(mapping); } else { inHeaders.Add(mapping); outHeaders.Add(mapping); } } serverMethod.inHeaderMappings = (SoapHeaderMapping[])inHeaders.ToArray(typeof(SoapHeaderMapping)); if (serverMethod.outHeaderSerializer != null) { serverMethod.outHeaderMappings = (SoapHeaderMapping[])outHeaders.ToArray(typeof(SoapHeaderMapping)); } // check feasibility of routing on request element for soap 1.1 if (soap11 && !routingOnSoapAction && soapMethod.requestElementName.IsEmpty) { throw new SoapException(Res.GetString(Res.TheMethodDoesNotHaveARequestElementEither1, serverMethod.methodInfo.Name), new XmlQualifiedName(Soap.ClientCode, Soap.Namespace)); } // we can lookup methods by action or request element if (methods[soapMethod.action] == null) { methods[soapMethod.action] = serverMethod; } else { // duplicate soap actions not allowed in soap 1.1 if we're routing on soap action if (soap11 && routingOnSoapAction) { SoapServerMethod duplicateMethod = (SoapServerMethod)methods[soapMethod.action]; throw new SoapException(Res.GetString(Res.TheMethodsAndUseTheSameSoapActionWhenTheService3, serverMethod.methodInfo.Name, duplicateMethod.methodInfo.Name, soapMethod.action), new XmlQualifiedName(Soap.ClientCode, Soap.Namespace)); } duplicateMethods[soapMethod.action] = serverMethod; } if (methods[soapMethod.requestElementName] == null) { methods[soapMethod.requestElementName] = serverMethod; } else { // duplicate request elements not allowed in soap 1.1 if we're routing on request element if (soap11 && !routingOnSoapAction) { SoapServerMethod duplicateMethod = (SoapServerMethod)methods[soapMethod.requestElementName]; throw new SoapException(Res.GetString(Res.TheMethodsAndUseTheSameRequestElementXmlns4, serverMethod.methodInfo.Name, duplicateMethod.methodInfo.Name, soapMethod.requestElementName.Name, soapMethod.requestElementName.Namespace), new XmlQualifiedName(Soap.ClientCode, Soap.Namespace)); } duplicateMethods[soapMethod.requestElementName] = serverMethod; } } }
internal override bool Initialize() { // try to guess the request version so we can handle any exceptions that might come up GuessVersion(); message = new SoapServerMessage(this); onewayInitException = null; serverType = (SoapServerType)GetFromCache(typeof(SoapServerProtocol), Type); if (serverType == null) { lock (Type){ serverType = (SoapServerType)GetFromCache(typeof(SoapServerProtocol), Type); if (serverType == null) { serverType = new SoapServerType(Type, versionsSupported); AddToCache(typeof(SoapServerProtocol), Type, serverType); } } } // We delay throwing any exceptions out of the extension until we determine if the method is one-way or not. Exception extensionException = null; try { message.highPriConfigExtensions = SoapMessage.InitializeExtensions(serverType.HighPriExtensions, serverType.HighPriExtensionInitializers); // For one-way methods we rely on Request.InputStream guaranteeing that the entire request body has arrived message.SetStream(Request.InputStream); Debug.Assert(message.Stream.CanSeek, "Web services SOAP handler assumes a seekable stream."); message.InitExtensionStreamChain(message.highPriConfigExtensions); message.SetStage(SoapMessageStage.BeforeDeserialize); message.ContentType = Request.ContentType; message.ContentEncoding = Request.Headers[ContentType.ContentEncoding]; message.RunExtensions(message.highPriConfigExtensions); } catch (Exception e) { extensionException = e; } // set this here since we might throw before we init the other extensions message.allExtensions = message.highPriConfigExtensions; // maybe the extensions that just ran changed some of the request data so we can make a better version guess GuessVersion(); try { this.serverMethod = helper.RouteRequest(); // the RouteRequest impl should throw an exception if it can't route the request but just in case... if (this.serverMethod == null) { throw new SoapException(Res.GetString(Res.UnableToHandleRequest0), new XmlQualifiedName(Soap.ServerCode, Soap.Namespace)); } } catch (Exception) { if (helper.RequestNamespace != null) { SetHelper(SoapServerProtocolHelper.GetHelper(this, helper.RequestNamespace)); } // version mismatches override other errors CheckHelperVersion(); throw; } this.isOneWay = serverMethod.oneWay; if (extensionException == null) { try { SoapReflectedExtension[] otherReflectedExtensions = (SoapReflectedExtension[])CombineExtensionsHelper(serverMethod.extensions, serverType.LowPriExtensions, typeof(SoapReflectedExtension)); object[] otherInitializers = (object[])CombineExtensionsHelper(serverMethod.extensionInitializers, serverType.LowPriExtensionInitializers, typeof(object)); message.otherExtensions = SoapMessage.InitializeExtensions(otherReflectedExtensions, otherInitializers); message.allExtensions = (SoapExtension[])CombineExtensionsHelper(message.highPriConfigExtensions, message.otherExtensions, typeof(SoapExtension)); } catch (Exception e) { extensionException = e; } } if (extensionException != null) { if (isOneWay) { onewayInitException = extensionException; } else { throw new SoapException(Res.GetString(Res.WebConfigExtensionError), new XmlQualifiedName(Soap.ServerCode, Soap.Namespace), extensionException); } } return(true); }
public SoapServerType(Type type, WebServiceProtocols protocolsSupported) : base(type) { this.methods = new Hashtable(); this.duplicateMethods = new Hashtable(); this.protocolsSupported = protocolsSupported; bool flag = (protocolsSupported & WebServiceProtocols.HttpSoap) != WebServiceProtocols.Unknown; LogicalMethodInfo[] methods = WebMethodReflector.GetMethods(type); ArrayList list = new ArrayList(); WebServiceAttribute attribute = WebServiceReflector.GetAttribute(type); object soapServiceAttribute = SoapReflector.GetSoapServiceAttribute(type); this.routingOnSoapAction = SoapReflector.GetSoapServiceRoutingStyle(soapServiceAttribute) == SoapServiceRoutingStyle.SoapAction; this.serviceNamespace = attribute.Namespace; this.serviceDefaultIsEncoded = SoapReflector.ServiceDefaultIsEncoded(type); SoapReflectionImporter importer = SoapReflector.CreateSoapImporter(this.serviceNamespace, this.serviceDefaultIsEncoded); XmlReflectionImporter importer2 = SoapReflector.CreateXmlImporter(this.serviceNamespace, this.serviceDefaultIsEncoded); SoapReflector.IncludeTypes(methods, importer); WebMethodReflector.IncludeTypes(methods, importer2); SoapReflectedMethod[] methodArray = new SoapReflectedMethod[methods.Length]; SoapExtensionTypeElementCollection soapExtensionTypes = WebServicesSection.Current.SoapExtensionTypes; ArrayList list2 = new ArrayList(); ArrayList list3 = new ArrayList(); for (int i = 0; i < soapExtensionTypes.Count; i++) { SoapExtensionTypeElement element = soapExtensionTypes[i]; if (element != null) { SoapReflectedExtension extension = new SoapReflectedExtension(element.Type, null, element.Priority); if (element.Group == PriorityGroup.High) { list2.Add(extension); } else { list3.Add(extension); } } } this.HighPriExtensions = (SoapReflectedExtension[]) list2.ToArray(typeof(SoapReflectedExtension)); this.LowPriExtensions = (SoapReflectedExtension[]) list3.ToArray(typeof(SoapReflectedExtension)); Array.Sort<SoapReflectedExtension>(this.HighPriExtensions); Array.Sort<SoapReflectedExtension>(this.LowPriExtensions); this.HighPriExtensionInitializers = SoapReflectedExtension.GetInitializers(type, this.HighPriExtensions); this.LowPriExtensionInitializers = SoapReflectedExtension.GetInitializers(type, this.LowPriExtensions); for (int j = 0; j < methods.Length; j++) { LogicalMethodInfo methodInfo = methods[j]; SoapReflectedMethod method = SoapReflector.ReflectMethod(methodInfo, false, importer2, importer, attribute.Namespace); list.Add(method.requestMappings); if (method.responseMappings != null) { list.Add(method.responseMappings); } list.Add(method.inHeaderMappings); if (method.outHeaderMappings != null) { list.Add(method.outHeaderMappings); } methodArray[j] = method; } XmlMapping[] mappings = (XmlMapping[]) list.ToArray(typeof(XmlMapping)); TraceMethod caller = Tracing.On ? new TraceMethod(this, ".ctor", new object[] { type, protocolsSupported }) : null; if (Tracing.On) { Tracing.Enter(Tracing.TraceId("TraceCreateSerializer"), caller, new TraceMethod(typeof(XmlSerializer), "FromMappings", new object[] { mappings, base.Evidence })); } XmlSerializer[] serializerArray = null; if (AppDomain.CurrentDomain.IsHomogenous) { serializerArray = XmlSerializer.FromMappings(mappings); } else { serializerArray = XmlSerializer.FromMappings(mappings, base.Evidence); } if (Tracing.On) { Tracing.Exit(Tracing.TraceId("TraceCreateSerializer"), caller); } int num3 = 0; for (int k = 0; k < methodArray.Length; k++) { SoapServerMethod method3 = new SoapServerMethod(); SoapReflectedMethod method4 = methodArray[k]; method3.parameterSerializer = serializerArray[num3++]; if (method4.responseMappings != null) { method3.returnSerializer = serializerArray[num3++]; } method3.inHeaderSerializer = serializerArray[num3++]; if (method4.outHeaderMappings != null) { method3.outHeaderSerializer = serializerArray[num3++]; } method3.methodInfo = method4.methodInfo; method3.action = method4.action; method3.extensions = method4.extensions; method3.extensionInitializers = SoapReflectedExtension.GetInitializers(method3.methodInfo, method4.extensions); method3.oneWay = method4.oneWay; method3.rpc = method4.rpc; method3.use = method4.use; method3.paramStyle = method4.paramStyle; method3.wsiClaims = (method4.binding == null) ? WsiProfiles.None : method4.binding.ConformsTo; ArrayList list4 = new ArrayList(); ArrayList list5 = new ArrayList(); for (int m = 0; m < method4.headers.Length; m++) { SoapHeaderMapping mapping = new SoapHeaderMapping(); SoapReflectedHeader header = method4.headers[m]; mapping.memberInfo = header.memberInfo; mapping.repeats = header.repeats; mapping.custom = header.custom; mapping.direction = header.direction; mapping.headerType = header.headerType; if (mapping.direction == SoapHeaderDirection.In) { list4.Add(mapping); } else if (mapping.direction == SoapHeaderDirection.Out) { list5.Add(mapping); } else { list4.Add(mapping); list5.Add(mapping); } } method3.inHeaderMappings = (SoapHeaderMapping[]) list4.ToArray(typeof(SoapHeaderMapping)); if (method3.outHeaderSerializer != null) { method3.outHeaderMappings = (SoapHeaderMapping[]) list5.ToArray(typeof(SoapHeaderMapping)); } if ((flag && !this.routingOnSoapAction) && method4.requestElementName.IsEmpty) { throw new SoapException(System.Web.Services.Res.GetString("TheMethodDoesNotHaveARequestElementEither1", new object[] { method3.methodInfo.Name }), new XmlQualifiedName("Client", "http://schemas.xmlsoap.org/soap/envelope/")); } if (this.methods[method4.action] == null) { this.methods[method4.action] = method3; } else { if (flag && this.routingOnSoapAction) { SoapServerMethod method5 = (SoapServerMethod) this.methods[method4.action]; throw new SoapException(System.Web.Services.Res.GetString("TheMethodsAndUseTheSameSoapActionWhenTheService3", new object[] { method3.methodInfo.Name, method5.methodInfo.Name, method4.action }), new XmlQualifiedName("Client", "http://schemas.xmlsoap.org/soap/envelope/")); } this.duplicateMethods[method4.action] = method3; } if (this.methods[method4.requestElementName] == null) { this.methods[method4.requestElementName] = method3; } else { if (flag && !this.routingOnSoapAction) { SoapServerMethod method6 = (SoapServerMethod) this.methods[method4.requestElementName]; throw new SoapException(System.Web.Services.Res.GetString("TheMethodsAndUseTheSameRequestElementXmlns4", new object[] { method3.methodInfo.Name, method6.methodInfo.Name, method4.requestElementName.Name, method4.requestElementName.Namespace }), new XmlQualifiedName("Client", "http://schemas.xmlsoap.org/soap/envelope/")); } this.duplicateMethods[method4.requestElementName] = method3; } } }
internal override SoapServerMethod RouteRequest() { string action = ContentType.GetAction(base.ServerProtocol.Request.ContentType); SoapServerMethod method = null; bool flag = false; bool flag2 = false; TraceMethod caller = Tracing.On ? new TraceMethod(this, "RouteRequest", new object[0]) : null; if ((action != null) && (action.Length > 0)) { action = System.Web.HttpUtility.UrlDecode(action); if (Tracing.On) { Tracing.Enter("RouteRequest", caller, new TraceMethod(base.ServerType, "GetMethod", new object[] { action }), Tracing.Details(base.ServerProtocol.Request)); } method = base.ServerType.GetMethod(action); if (Tracing.On) { Tracing.Exit("RouteRequest", caller); } if ((method != null) && (base.ServerType.GetDuplicateMethod(action) != null)) { method = null; flag = true; } } XmlQualifiedName empty = XmlQualifiedName.Empty; if (method == null) { empty = base.GetRequestElement(); if (Tracing.On) { Tracing.Enter("RouteRequest", caller, new TraceMethod(base.ServerType, "GetMethod", new object[] { empty }), Tracing.Details(base.ServerProtocol.Request)); } method = base.ServerType.GetMethod(empty); if (Tracing.On) { Tracing.Exit("RouteRequest", caller); } if ((method != null) && (base.ServerType.GetDuplicateMethod(empty) != null)) { method = null; flag2 = true; } } if (method != null) { return(method); } if ((action == null) || (action.Length == 0)) { throw new SoapException(System.Web.Services.Res.GetString("UnableToHandleRequestActionRequired0"), Soap12FaultCodes.SenderFaultCode); } if (flag) { if (flag2) { throw new SoapException(System.Web.Services.Res.GetString("UnableToHandleRequest0"), Soap12FaultCodes.ReceiverFaultCode); } throw new SoapException(System.Web.Services.Res.GetString("TheRequestElementXmlnsWasNotRecognized2", new object[] { empty.Name, empty.Namespace }), Soap12FaultCodes.SenderFaultCode); } throw new SoapException(System.Web.Services.Res.GetString("UnableToHandleRequestActionNotRecognized1", new object[] { action }), Soap12FaultCodes.SenderFaultCode); }
public SoapServerType(Type type, WebServiceProtocols protocolsSupported) : base(type) { this.methods = new Hashtable(); this.duplicateMethods = new Hashtable(); this.protocolsSupported = protocolsSupported; bool flag = (protocolsSupported & WebServiceProtocols.HttpSoap) != WebServiceProtocols.Unknown; LogicalMethodInfo[] methods = WebMethodReflector.GetMethods(type); ArrayList list = new ArrayList(); WebServiceAttribute attribute = WebServiceReflector.GetAttribute(type); object soapServiceAttribute = SoapReflector.GetSoapServiceAttribute(type); this.routingOnSoapAction = SoapReflector.GetSoapServiceRoutingStyle(soapServiceAttribute) == SoapServiceRoutingStyle.SoapAction; this.serviceNamespace = attribute.Namespace; this.serviceDefaultIsEncoded = SoapReflector.ServiceDefaultIsEncoded(type); SoapReflectionImporter importer = SoapReflector.CreateSoapImporter(this.serviceNamespace, this.serviceDefaultIsEncoded); XmlReflectionImporter importer2 = SoapReflector.CreateXmlImporter(this.serviceNamespace, this.serviceDefaultIsEncoded); SoapReflector.IncludeTypes(methods, importer); WebMethodReflector.IncludeTypes(methods, importer2); SoapReflectedMethod[] methodArray = new SoapReflectedMethod[methods.Length]; SoapExtensionTypeElementCollection soapExtensionTypes = WebServicesSection.Current.SoapExtensionTypes; ArrayList list2 = new ArrayList(); ArrayList list3 = new ArrayList(); for (int i = 0; i < soapExtensionTypes.Count; i++) { SoapExtensionTypeElement element = soapExtensionTypes[i]; if (element != null) { SoapReflectedExtension extension = new SoapReflectedExtension(element.Type, null, element.Priority); if (element.Group == PriorityGroup.High) { list2.Add(extension); } else { list3.Add(extension); } } } this.HighPriExtensions = (SoapReflectedExtension[])list2.ToArray(typeof(SoapReflectedExtension)); this.LowPriExtensions = (SoapReflectedExtension[])list3.ToArray(typeof(SoapReflectedExtension)); Array.Sort <SoapReflectedExtension>(this.HighPriExtensions); Array.Sort <SoapReflectedExtension>(this.LowPriExtensions); this.HighPriExtensionInitializers = SoapReflectedExtension.GetInitializers(type, this.HighPriExtensions); this.LowPriExtensionInitializers = SoapReflectedExtension.GetInitializers(type, this.LowPriExtensions); for (int j = 0; j < methods.Length; j++) { LogicalMethodInfo methodInfo = methods[j]; SoapReflectedMethod method = SoapReflector.ReflectMethod(methodInfo, false, importer2, importer, attribute.Namespace); list.Add(method.requestMappings); if (method.responseMappings != null) { list.Add(method.responseMappings); } list.Add(method.inHeaderMappings); if (method.outHeaderMappings != null) { list.Add(method.outHeaderMappings); } methodArray[j] = method; } XmlMapping[] mappings = (XmlMapping[])list.ToArray(typeof(XmlMapping)); TraceMethod caller = Tracing.On ? new TraceMethod(this, ".ctor", new object[] { type, protocolsSupported }) : null; if (Tracing.On) { Tracing.Enter(Tracing.TraceId("TraceCreateSerializer"), caller, new TraceMethod(typeof(XmlSerializer), "FromMappings", new object[] { mappings, base.Evidence })); } XmlSerializer[] serializerArray = null; if (AppDomain.CurrentDomain.IsHomogenous) { serializerArray = XmlSerializer.FromMappings(mappings); } else { serializerArray = XmlSerializer.FromMappings(mappings, base.Evidence); } if (Tracing.On) { Tracing.Exit(Tracing.TraceId("TraceCreateSerializer"), caller); } int num3 = 0; for (int k = 0; k < methodArray.Length; k++) { SoapServerMethod method3 = new SoapServerMethod(); SoapReflectedMethod method4 = methodArray[k]; method3.parameterSerializer = serializerArray[num3++]; if (method4.responseMappings != null) { method3.returnSerializer = serializerArray[num3++]; } method3.inHeaderSerializer = serializerArray[num3++]; if (method4.outHeaderMappings != null) { method3.outHeaderSerializer = serializerArray[num3++]; } method3.methodInfo = method4.methodInfo; method3.action = method4.action; method3.extensions = method4.extensions; method3.extensionInitializers = SoapReflectedExtension.GetInitializers(method3.methodInfo, method4.extensions); method3.oneWay = method4.oneWay; method3.rpc = method4.rpc; method3.use = method4.use; method3.paramStyle = method4.paramStyle; method3.wsiClaims = (method4.binding == null) ? WsiProfiles.None : method4.binding.ConformsTo; ArrayList list4 = new ArrayList(); ArrayList list5 = new ArrayList(); for (int m = 0; m < method4.headers.Length; m++) { SoapHeaderMapping mapping = new SoapHeaderMapping(); SoapReflectedHeader header = method4.headers[m]; mapping.memberInfo = header.memberInfo; mapping.repeats = header.repeats; mapping.custom = header.custom; mapping.direction = header.direction; mapping.headerType = header.headerType; if (mapping.direction == SoapHeaderDirection.In) { list4.Add(mapping); } else if (mapping.direction == SoapHeaderDirection.Out) { list5.Add(mapping); } else { list4.Add(mapping); list5.Add(mapping); } } method3.inHeaderMappings = (SoapHeaderMapping[])list4.ToArray(typeof(SoapHeaderMapping)); if (method3.outHeaderSerializer != null) { method3.outHeaderMappings = (SoapHeaderMapping[])list5.ToArray(typeof(SoapHeaderMapping)); } if ((flag && !this.routingOnSoapAction) && method4.requestElementName.IsEmpty) { throw new SoapException(System.Web.Services.Res.GetString("TheMethodDoesNotHaveARequestElementEither1", new object[] { method3.methodInfo.Name }), new XmlQualifiedName("Client", "http://schemas.xmlsoap.org/soap/envelope/")); } if (this.methods[method4.action] == null) { this.methods[method4.action] = method3; } else { if (flag && this.routingOnSoapAction) { SoapServerMethod method5 = (SoapServerMethod)this.methods[method4.action]; throw new SoapException(System.Web.Services.Res.GetString("TheMethodsAndUseTheSameSoapActionWhenTheService3", new object[] { method3.methodInfo.Name, method5.methodInfo.Name, method4.action }), new XmlQualifiedName("Client", "http://schemas.xmlsoap.org/soap/envelope/")); } this.duplicateMethods[method4.action] = method3; } if (this.methods[method4.requestElementName] == null) { this.methods[method4.requestElementName] = method3; } else { if (flag && !this.routingOnSoapAction) { SoapServerMethod method6 = (SoapServerMethod)this.methods[method4.requestElementName]; throw new SoapException(System.Web.Services.Res.GetString("TheMethodsAndUseTheSameRequestElementXmlns4", new object[] { method3.methodInfo.Name, method6.methodInfo.Name, method4.requestElementName.Name, method4.requestElementName.Namespace }), new XmlQualifiedName("Client", "http://schemas.xmlsoap.org/soap/envelope/")); } this.duplicateMethods[method4.requestElementName] = method3; } } }