void PreProcess(Message message) { //If the user does not have manual addressing enabled then clear these out if (!this.manualAddressing) { MessageHeaders headers = message.Headers; string addressingNamespace = RoutingUtilities.GetAddressingNamespace(headers.MessageVersion.Addressing); //Go through in reverse to reduce shifting after RemoveAt(i) for (int i = headers.Count - 1; i >= 0; --i) { MessageHeaderInfo header = headers[i]; if (string.Equals(header.Namespace, addressingNamespace, StringComparison.Ordinal)) { if (!addressingHeadersToFlow.Contains(header.Name)) { headers.RemoveAt(i); } } } } }
void FilterHeaders(MessageHeaders headers, HashSet <string> understoodHeadersSet) { string addressingNamespace = RoutingUtilities.GetAddressingNamespace(headers.MessageVersion.Addressing); //Go in reverse to reduce shifting after RemoveAt(i) for (int i = headers.Count - 1; i >= 0; --i) { MessageHeaderInfo header = headers[i]; bool removeHeader = false; if (string.Equals(header.Namespace, addressingNamespace, StringComparison.Ordinal) && (addressingHeadersToFlow.Contains(header.Name) || this.manualAddressing)) { continue; } if (understoodHeadersSet.Contains(MessageHeaderKey(header))) { // This header was understood at this endpoint, do _not_ flow it removeHeader = true; } else if (ActorIsNextDestination(header, headers.MessageVersion)) { //This was a header targeted at the SOAP Intermediary ("actor/next", which is us) //It can explicitly tell us to relay this header when we don't understand it. if (!header.Relay) { removeHeader = true; } } if (removeHeader) { headers.RemoveAt(i); } } }