protected static void VerifyStartBody(XmlDictionaryReader reader, EnvelopeVersion version) { if (!reader.IsStartElement(XD.MessageDictionary.Body, version.DictionaryNamespace)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new CommunicationException(System.ServiceModel.SR.GetString("MessageBodyMissing"))); } }
public FaultCode(string name, string ns, FaultCode subCode) { if (name == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("name")); } if (name.Length == 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("name")); } if (!string.IsNullOrEmpty(ns)) { NamingHelper.CheckUriParameter(ns, "ns"); } this.name = name; this.ns = ns; this.subCode = subCode; if (ns == "http://www.w3.org/2003/05/soap-envelope") { this.version = EnvelopeVersion.Soap12; } else if (ns == "http://schemas.xmlsoap.org/soap/envelope/") { this.version = EnvelopeVersion.Soap11; } else if (ns == "http://schemas.microsoft.com/ws/2005/05/envelope/none") { this.version = EnvelopeVersion.None; } else { this.version = null; } }
protected override void OnWriteDetail(XmlDictionaryWriter writer, EnvelopeVersion version) { if (version == EnvelopeVersion.Soap12) { this.OnWriteStartDetail(writer, version); this.OnWriteDetailContents(writer); writer.WriteEndElement(); } }
public XmlReaderBodyWriter(XmlDictionaryReader reader, EnvelopeVersion version) : base(false) { this.reader = reader; if (reader.MoveToContent() != XmlNodeType.Element) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.ServiceModel.SR.GetString("InvalidReaderPositionOnCreateMessage"), "reader")); } this.isFault = Message.IsFaultStartElement(reader, version); }
/// <summary> /// Trasforma il messaggio da inviare al servizio PIS target in modo compatibile con il binding utilizzato /// Il messaggio in ingresso arriva da un basic http binding (soap 1.1) il metodo lascia il messaggio in soap 1.1 o lo modific ain modo compatibile a /// soap1.2 con wshttp /// </summary> /// <param name="value">Messaggio da trasformare</param> /// <returns>il messaggio da restituire</returns> private Message TransformInputMessage(Message value, System.ServiceModel.EnvelopeVersion vers) { Message toSend; if (vers == System.ServiceModel.EnvelopeVersion.Soap11) { toSend = value; } else { //Trasforma il messaggio da inviare al servizion target in modo compatibile con SOAP 1.2 e wsa 1.0 toSend = Message.CreateMessage(MessageVersion.Soap12WSAddressing10, value.Headers.Action, value.GetReaderAtBodyContents()); } return(toSend); }
public static MessageVersion CreateVersion (EnvelopeVersion envelope_version, AddressingVersion addressing_version) { if (envelope_version == EnvelopeVersion.None && addressing_version == AddressingVersion.None) return None; if (envelope_version == EnvelopeVersion.Soap11 && addressing_version == AddressingVersion.None) return Soap11; if (envelope_version == EnvelopeVersion.Soap12 && addressing_version == AddressingVersion.WSAddressing10) return Soap12WSAddressing10; if (envelope_version == EnvelopeVersion.Soap12 && addressing_version == AddressingVersion.None) return Soap12; if (envelope_version == EnvelopeVersion.Soap11 && addressing_version == AddressingVersion.WSAddressing10) return Soap11WSAddressing10; if (envelope_version == EnvelopeVersion.Soap11 && addressing_version == AddressingVersion.WSAddressingAugust2004) return Soap11WSAddressingAugust2004; if (envelope_version == EnvelopeVersion.Soap12 && addressing_version == AddressingVersion.WSAddressingAugust2004) return Soap12WSAddressingAugust2004; throw new ArgumentException (string.Format ("EnvelopeVersion {0} cannot be used with AddressingVersion {1}", envelope_version, addressing_version)); }
public FaultCode(string name, string ns, FaultCode subCode) { if (name == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException(nameof(name))); } if (name.Length == 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(name))); } if (!string.IsNullOrEmpty(ns)) { NamingHelper.CheckUriParameter(ns, "ns"); } Name = name; _ns = ns; SubCode = subCode; if (ns == Message12Strings.Namespace) { _version = EnvelopeVersion.Soap12; } else if (ns == Message11Strings.Namespace) { _version = EnvelopeVersion.Soap11; } else if (ns == MessageStrings.Namespace) { _version = EnvelopeVersion.None; } else { _version = null; } }
public FaultCode(string name, string ns, FaultCode subCode) { if (name == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("name")); if (name.Length == 0) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("name")); if (!string.IsNullOrEmpty(ns)) NamingHelper.CheckUriParameter(ns, "ns"); _name = name; _ns = ns; _subCode = subCode; if (ns == Message12Strings.Namespace) _version = EnvelopeVersion.Soap12; else if (ns == Message11Strings.Namespace) _version = EnvelopeVersion.Soap11; else if (ns == MessageStrings.Namespace) _version = EnvelopeVersion.None; else _version = null; }
public static MessageVersion CreateVersion (EnvelopeVersion envelope_version, AddressingVersion addressing_version) { return new MessageVersion (envelope_version, addressing_version); }
public static MessageVersion CreateVersion (EnvelopeVersion envelope_version) { return CreateVersion (envelope_version, AddressingVersion.WSAddressing10); }
MessageVersion (EnvelopeVersion envelope, AddressingVersion addressing) { this.envelope = envelope; this.addressing = addressing; }
public static void MessageVersion_Verify_AddressingVersions_And_EnvelopeVersions(MessageVersion messageVersion, EnvelopeVersion envelopeVersion, AddressingVersion addressingVersion) { Assert.Equal<EnvelopeVersion>(envelopeVersion, messageVersion.Envelope); Assert.Equal<AddressingVersion>(addressingVersion, messageVersion.Addressing); }
public MustUnderstandSoapException(Collection <MessageHeaderInfo> notUnderstoodHeaders, EnvelopeVersion envelopeVersion) { _notUnderstoodHeaders = notUnderstoodHeaders; _envelopeVersion = envelopeVersion; }
public FaultBodyWriter(MessageFault fault, EnvelopeVersion version) : base(true) { this.fault = fault; this.version = version; }
internal static string GetEncoding(EnvelopeVersion version) { if (version == EnvelopeVersion.Soap11) { return "http://schemas.xmlsoap.org/soap/encoding/"; } if (version != EnvelopeVersion.Soap12) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("version", System.ServiceModel.SR.GetString("EnvelopeVersionNotSupported", new object[] { version })); } return "http://www.w3.org/2003/05/soap-encoding"; }
internal MessageBindingExporter(WsdlExporter exporter, WsdlEndpointConversionContext endpointContext) { this.endpointContext = endpointContext; this.exportedMessages = (MessageExportContext)exporter.State[typeof(MessageExportContext)]; this.soapVersion = SoapHelper.GetSoapVersion(endpointContext.WsdlBinding); this.exporter = exporter; }
protected override void OnWriteDetail(XmlDictionaryWriter writer, EnvelopeVersion version) { if (version == EnvelopeVersion.Soap12) // Soap11 wants the detail in the header { OnWriteStartDetail(writer, version); OnWriteDetailContents(writer); writer.WriteEndElement(); } }
public MustUnderstandSoapException(Collection<MessageHeaderInfo> notUnderstoodHeaders, EnvelopeVersion envelopeVersion) { _notUnderstoodHeaders = notUnderstoodHeaders; _envelopeVersion = envelopeVersion; }
protected static bool HasHeaderElement(XmlDictionaryReader reader, EnvelopeVersion envelopeVersion) { return reader.IsStartElement(XD.MessageDictionary.Header, envelopeVersion.DictionaryNamespace); }
internal static string GetEncoding(EnvelopeVersion version) { if (version == EnvelopeVersion.Soap11) { return soap11Encoding; } else if (version == EnvelopeVersion.Soap12) { return soap12Encoding; } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("version", SR.Format(SR.EnvelopeVersionNotSupported, version)); } }
/// <summary> /// Raises the Error Event and converts the given exception to a FaultException if required. If the original /// exception was a FaultException or PreserveOriginalException flag is set to true then the conversion to /// FaultException is not done. /// </summary> /// <param name="ex">The original exception.</param> /// <param name="trustNamespace">Trust Namespace of the current trust version.</param> /// <param name="action">The Trust action that caused the exception.</param> /// <param name="requestEnvelopeVersion">Version of the request envolope.</param> protected virtual bool HandleException(Exception ex, string trustNamespace, string action, EnvelopeVersion requestEnvelopeVersion) { if (System.Runtime.Fx.IsFatal(ex)) { return false; } if (DiagnosticUtility.ShouldTrace(TraceEventType.Warning)) { TraceUtility.TraceString( TraceEventType.Warning, "RequestFailed: TrustNamespace={0}, Action={1}, Exception={2}", trustNamespace, action, ex); } // raise the exception events. if (_requestFailed != null) { _requestFailed(this, new WSTrustRequestProcessingErrorEventArgs(action, ex)); } bool preserveOriginalException = false; ServiceDebugBehavior debugBehavior = OperationContext.Current.Host.Description.Behaviors.Find<ServiceDebugBehavior>(); if (debugBehavior != null) { preserveOriginalException = debugBehavior.IncludeExceptionDetailInFaults; } if (String.IsNullOrEmpty(trustNamespace) || String.IsNullOrEmpty(action) || preserveOriginalException || ex is FaultException) { // Just throw the original exception. return false; } else { FaultException faultException = OperationContext.Current.Host.Credentials.ExceptionMapper.FromException(ex, (requestEnvelopeVersion == EnvelopeVersion.Soap11) ? soap11Namespace : soap12Namespace, trustNamespace); if (faultException != null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(faultException); } // The exception is not one of the recognized exceptions. Just throw the original exception. return false; } }