Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Services / Web / System / Web / Services / Protocols / SoapMessage.cs / 1305376 / SoapMessage.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.Services.Protocols {
using System.Web.Services;
using System.Xml.Serialization;
using System;
using System.Reflection;
using System.Collections;
using System.IO;
using System.ComponentModel;
using System.Security.Permissions;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Web.Services.Diagnostics;
///
///
/// [To be supplied.]
///
[PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
public abstract class SoapMessage {
SoapMessageStage stage;
SoapHeaderCollection headers = new SoapHeaderCollection();
Stream stream;
SoapExtensionStream extensionStream;
string contentType;
string contentEncoding;
object[] parameterValues;
SoapException exception;
internal SoapMessage() { }
internal void SetParameterValues(object[] parameterValues) {
this.parameterValues = parameterValues;
}
internal object[] GetParameterValues() {
return parameterValues;
}
///
///
/// [To be supplied.]
///
public abstract bool OneWay {
get;
}
///
///
/// [To be supplied.]
///
public object GetInParameterValue(int index) {
EnsureInStage();
EnsureNoException();
if (index < 0 || index >= parameterValues.Length) throw new IndexOutOfRangeException(Res.GetString(Res.indexMustBeBetweenAnd0Inclusive, parameterValues.Length));
return parameterValues[index];
}
///
///
/// [To be supplied.]
///
public object GetOutParameterValue(int index) {
EnsureOutStage();
EnsureNoException();
if (!MethodInfo.IsVoid) {
if (index == int.MaxValue)
throw new IndexOutOfRangeException(Res.GetString(Res.indexMustBeBetweenAnd0Inclusive, parameterValues.Length));
index++;
}
if (index < 0 || index >= parameterValues.Length) throw new IndexOutOfRangeException(Res.GetString(Res.indexMustBeBetweenAnd0Inclusive, parameterValues.Length));
return parameterValues[index];
}
///
///
/// [To be supplied.]
///
public object GetReturnValue() {
EnsureOutStage();
EnsureNoException();
if (MethodInfo.IsVoid) throw new InvalidOperationException(Res.GetString(Res.WebNoReturnValue));
return parameterValues[0];
}
///
///
/// [To be supplied.]
///
protected abstract void EnsureOutStage();
///
///
/// [To be supplied.]
///
protected abstract void EnsureInStage();
void EnsureNoException() {
if (exception != null) throw new InvalidOperationException(Res.GetString(Res.WebCannotAccessValue), exception);
}
///
///
/// [To be supplied.]
///
public SoapException Exception {
get { return exception; }
set { exception = value; }
}
///
///
/// [To be supplied.]
///
public abstract LogicalMethodInfo MethodInfo {
get;
}
/*
internal abstract SoapReflectedExtension[] Extensions {
get;
}
internal abstract object[] ExtensionInitializers {
get;
}
*/
///
///
/// [To be supplied.]
///
protected void EnsureStage(SoapMessageStage stage) {
if ((this.stage & stage) == 0) throw new InvalidOperationException(Res.GetString(Res.WebCannotAccessValueStage, this.stage.ToString()));
}
///
///
/// [To be supplied.]
///
public SoapHeaderCollection Headers {
get { return headers; }
}
internal void SetStream(Stream stream) {
if (extensionStream != null) {
extensionStream.SetInnerStream(stream);
extensionStream.SetStreamReady();
// The extension stream should now be referenced by either this.stream
// or an extension that has chained it to another stream.
extensionStream = null;
}
else
this.stream = stream;
}
internal void SetExtensionStream(SoapExtensionStream extensionStream) {
this.extensionStream = extensionStream;
this.stream = extensionStream;
}
///
///
/// [To be supplied.]
///
public Stream Stream {
get { return stream; }
}
///
///
/// [To be supplied.]
///
public string ContentType {
get { EnsureStage(SoapMessageStage.BeforeSerialize | SoapMessageStage.BeforeDeserialize); return contentType; }
set { EnsureStage(SoapMessageStage.BeforeSerialize | SoapMessageStage.BeforeDeserialize); contentType = value; }
}
///
public string ContentEncoding {
get { EnsureStage(SoapMessageStage.BeforeSerialize | SoapMessageStage.BeforeDeserialize); return contentEncoding; }
set { EnsureStage(SoapMessageStage.BeforeSerialize | SoapMessageStage.BeforeDeserialize); contentEncoding = value; }
}
///
///
/// [To be supplied.]
///
public SoapMessageStage Stage {
get { return stage; }
}
internal void SetStage(SoapMessageStage stage) {
this.stage = stage;
}
///
///
/// [To be supplied.]
///
public abstract string Url {
get;
}
///
///
/// [To be supplied.]
///
public abstract string Action {
get;
}
///
[ComVisible(false)]
[DefaultValue(SoapProtocolVersion.Default)]
public virtual SoapProtocolVersion SoapVersion {
get { return SoapProtocolVersion.Default; }
}
internal static SoapExtension[] InitializeExtensions(SoapReflectedExtension[] reflectedExtensions, object[] extensionInitializers) {
if (reflectedExtensions == null)
return null;
SoapExtension[] extensions = new SoapExtension[reflectedExtensions.Length];
for (int i = 0; i < extensions.Length; i++) {
extensions[i] = reflectedExtensions[i].CreateInstance(extensionInitializers[i]);
}
return extensions;
}
internal void InitExtensionStreamChain(SoapExtension[] extensions) {
if (extensions == null)
return;
for (int i = 0; i < extensions.Length; i++) {
stream = extensions[i].ChainStream(stream);
}
}
internal void RunExtensions(SoapExtension[] extensions, bool throwOnException) {
if (extensions == null)
return;
TraceMethod caller = Tracing.On ? new TraceMethod(this, "RunExtensions", extensions, throwOnException) : null;
// Higher priority extensions (earlier in the list) run earlier for deserialization stages,
// and later for serialization stages
if ((stage & (SoapMessageStage.BeforeDeserialize | SoapMessageStage.AfterDeserialize)) != 0) {
for (int i = 0; i < extensions.Length; i++) {
if (Tracing.On) Tracing.Enter("SoapExtension", caller, new TraceMethod(extensions[i], "ProcessMessage", stage));
extensions[i].ProcessMessage(this);
if (Tracing.On) Tracing.Exit("SoapExtension", caller);
if (Exception != null) {
if (throwOnException)
throw Exception;
if (Tracing.On) Tracing.ExceptionIgnore(TraceEventType.Warning, caller, Exception);
}
}
}
else {
for (int i = extensions.Length - 1; i >= 0; i--) {
if (Tracing.On) Tracing.Enter("SoapExtension", caller, new TraceMethod(extensions[i], "ProcessMessage", stage));
extensions[i].ProcessMessage(this);
if (Tracing.On) Tracing.Exit("SoapExtension", caller);
if (Exception != null) {
if (throwOnException)
throw Exception;
if (Tracing.On) Tracing.ExceptionIgnore(TraceEventType.Warning, caller, Exception);
}
}
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.Services.Protocols {
using System.Web.Services;
using System.Xml.Serialization;
using System;
using System.Reflection;
using System.Collections;
using System.IO;
using System.ComponentModel;
using System.Security.Permissions;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Web.Services.Diagnostics;
///
///
/// [To be supplied.]
///
[PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
public abstract class SoapMessage {
SoapMessageStage stage;
SoapHeaderCollection headers = new SoapHeaderCollection();
Stream stream;
SoapExtensionStream extensionStream;
string contentType;
string contentEncoding;
object[] parameterValues;
SoapException exception;
internal SoapMessage() { }
internal void SetParameterValues(object[] parameterValues) {
this.parameterValues = parameterValues;
}
internal object[] GetParameterValues() {
return parameterValues;
}
///
///
/// [To be supplied.]
///
public abstract bool OneWay {
get;
}
///
///
/// [To be supplied.]
///
public object GetInParameterValue(int index) {
EnsureInStage();
EnsureNoException();
if (index < 0 || index >= parameterValues.Length) throw new IndexOutOfRangeException(Res.GetString(Res.indexMustBeBetweenAnd0Inclusive, parameterValues.Length));
return parameterValues[index];
}
///
///
/// [To be supplied.]
///
public object GetOutParameterValue(int index) {
EnsureOutStage();
EnsureNoException();
if (!MethodInfo.IsVoid) {
if (index == int.MaxValue)
throw new IndexOutOfRangeException(Res.GetString(Res.indexMustBeBetweenAnd0Inclusive, parameterValues.Length));
index++;
}
if (index < 0 || index >= parameterValues.Length) throw new IndexOutOfRangeException(Res.GetString(Res.indexMustBeBetweenAnd0Inclusive, parameterValues.Length));
return parameterValues[index];
}
///
///
/// [To be supplied.]
///
public object GetReturnValue() {
EnsureOutStage();
EnsureNoException();
if (MethodInfo.IsVoid) throw new InvalidOperationException(Res.GetString(Res.WebNoReturnValue));
return parameterValues[0];
}
///
///
/// [To be supplied.]
///
protected abstract void EnsureOutStage();
///
///
/// [To be supplied.]
///
protected abstract void EnsureInStage();
void EnsureNoException() {
if (exception != null) throw new InvalidOperationException(Res.GetString(Res.WebCannotAccessValue), exception);
}
///
///
/// [To be supplied.]
///
public SoapException Exception {
get { return exception; }
set { exception = value; }
}
///
///
/// [To be supplied.]
///
public abstract LogicalMethodInfo MethodInfo {
get;
}
/*
internal abstract SoapReflectedExtension[] Extensions {
get;
}
internal abstract object[] ExtensionInitializers {
get;
}
*/
///
///
/// [To be supplied.]
///
protected void EnsureStage(SoapMessageStage stage) {
if ((this.stage & stage) == 0) throw new InvalidOperationException(Res.GetString(Res.WebCannotAccessValueStage, this.stage.ToString()));
}
///
///
/// [To be supplied.]
///
public SoapHeaderCollection Headers {
get { return headers; }
}
internal void SetStream(Stream stream) {
if (extensionStream != null) {
extensionStream.SetInnerStream(stream);
extensionStream.SetStreamReady();
// The extension stream should now be referenced by either this.stream
// or an extension that has chained it to another stream.
extensionStream = null;
}
else
this.stream = stream;
}
internal void SetExtensionStream(SoapExtensionStream extensionStream) {
this.extensionStream = extensionStream;
this.stream = extensionStream;
}
///
///
/// [To be supplied.]
///
public Stream Stream {
get { return stream; }
}
///
///
/// [To be supplied.]
///
public string ContentType {
get { EnsureStage(SoapMessageStage.BeforeSerialize | SoapMessageStage.BeforeDeserialize); return contentType; }
set { EnsureStage(SoapMessageStage.BeforeSerialize | SoapMessageStage.BeforeDeserialize); contentType = value; }
}
///
public string ContentEncoding {
get { EnsureStage(SoapMessageStage.BeforeSerialize | SoapMessageStage.BeforeDeserialize); return contentEncoding; }
set { EnsureStage(SoapMessageStage.BeforeSerialize | SoapMessageStage.BeforeDeserialize); contentEncoding = value; }
}
///
///
/// [To be supplied.]
///
public SoapMessageStage Stage {
get { return stage; }
}
internal void SetStage(SoapMessageStage stage) {
this.stage = stage;
}
///
///
/// [To be supplied.]
///
public abstract string Url {
get;
}
///
///
/// [To be supplied.]
///
public abstract string Action {
get;
}
///
[ComVisible(false)]
[DefaultValue(SoapProtocolVersion.Default)]
public virtual SoapProtocolVersion SoapVersion {
get { return SoapProtocolVersion.Default; }
}
internal static SoapExtension[] InitializeExtensions(SoapReflectedExtension[] reflectedExtensions, object[] extensionInitializers) {
if (reflectedExtensions == null)
return null;
SoapExtension[] extensions = new SoapExtension[reflectedExtensions.Length];
for (int i = 0; i < extensions.Length; i++) {
extensions[i] = reflectedExtensions[i].CreateInstance(extensionInitializers[i]);
}
return extensions;
}
internal void InitExtensionStreamChain(SoapExtension[] extensions) {
if (extensions == null)
return;
for (int i = 0; i < extensions.Length; i++) {
stream = extensions[i].ChainStream(stream);
}
}
internal void RunExtensions(SoapExtension[] extensions, bool throwOnException) {
if (extensions == null)
return;
TraceMethod caller = Tracing.On ? new TraceMethod(this, "RunExtensions", extensions, throwOnException) : null;
// Higher priority extensions (earlier in the list) run earlier for deserialization stages,
// and later for serialization stages
if ((stage & (SoapMessageStage.BeforeDeserialize | SoapMessageStage.AfterDeserialize)) != 0) {
for (int i = 0; i < extensions.Length; i++) {
if (Tracing.On) Tracing.Enter("SoapExtension", caller, new TraceMethod(extensions[i], "ProcessMessage", stage));
extensions[i].ProcessMessage(this);
if (Tracing.On) Tracing.Exit("SoapExtension", caller);
if (Exception != null) {
if (throwOnException)
throw Exception;
if (Tracing.On) Tracing.ExceptionIgnore(TraceEventType.Warning, caller, Exception);
}
}
}
else {
for (int i = extensions.Length - 1; i >= 0; i--) {
if (Tracing.On) Tracing.Enter("SoapExtension", caller, new TraceMethod(extensions[i], "ProcessMessage", stage));
extensions[i].ProcessMessage(this);
if (Tracing.On) Tracing.Exit("SoapExtension", caller);
if (Exception != null) {
if (throwOnException)
throw Exception;
if (Tracing.On) Tracing.ExceptionIgnore(TraceEventType.Warning, caller, Exception);
}
}
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- EditingCommands.cs
- XMLSyntaxException.cs
- HttpHeaderCollection.cs
- ToolboxComponentsCreatedEventArgs.cs
- UIElement3DAutomationPeer.cs
- ImageListImage.cs
- CodeDirectionExpression.cs
- WebServicesSection.cs
- InternalBufferManager.cs
- BaseUriHelper.cs
- FontDifferentiator.cs
- HttpResponseInternalBase.cs
- SerializationSectionGroup.cs
- HttpResponse.cs
- TypeResolvingOptions.cs
- ServicePointManager.cs
- StringPropertyBuilder.cs
- RegexWorker.cs
- XmlSchemaChoice.cs
- ExecutionEngineException.cs
- Dictionary.cs
- PlaceHolder.cs
- DrawingBrush.cs
- VirtualPathUtility.cs
- WorkflowRuntime.cs
- TimeIntervalCollection.cs
- DataControlPagerLinkButton.cs
- StickyNoteHelper.cs
- SimpleWebHandlerParser.cs
- OuterGlowBitmapEffect.cs
- XhtmlBasicListAdapter.cs
- CodeGenerator.cs
- StateDesigner.Layouts.cs
- DataSourceCache.cs
- ADMembershipProvider.cs
- WebPartTracker.cs
- RichTextBox.cs
- UnhandledExceptionEventArgs.cs
- TransportSecurityProtocol.cs
- WebFaultException.cs
- DocumentSchemaValidator.cs
- ServerValidateEventArgs.cs
- StylusPointDescription.cs
- ColumnWidthChangedEvent.cs
- BitmapEffectGroup.cs
- ThreadLocal.cs
- IBuiltInEvidence.cs
- CodeTypeOfExpression.cs
- DrawListViewSubItemEventArgs.cs
- ValuePattern.cs
- CompilerState.cs
- FunctionImportElement.cs
- AssociationType.cs
- FunctionImportMapping.ReturnTypeRenameMapping.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- StyleXamlParser.cs
- OracleConnection.cs
- URLIdentityPermission.cs
- CompilerLocalReference.cs
- DataGridAutomationPeer.cs
- RegexBoyerMoore.cs
- RectangleGeometry.cs
- ConstructorArgumentAttribute.cs
- XmlSchemaCompilationSettings.cs
- CodeAttributeArgumentCollection.cs
- ExpressionDumper.cs
- AttachedAnnotationChangedEventArgs.cs
- EnumerableCollectionView.cs
- CookieHandler.cs
- UpdateExpressionVisitor.cs
- JsonByteArrayDataContract.cs
- SqlMethodAttribute.cs
- FlowLayoutPanel.cs
- UInt16Storage.cs
- PanelStyle.cs
- ActivityExecutorSurrogate.cs
- ObjectTypeMapping.cs
- DashStyle.cs
- MethodBody.cs
- TagPrefixCollection.cs
- SystemEvents.cs
- FrameworkRichTextComposition.cs
- Partitioner.cs
- DataListItem.cs
- CLSCompliantAttribute.cs
- StreamSecurityUpgradeAcceptorAsyncResult.cs
- BinaryReader.cs
- XmlIgnoreAttribute.cs
- FixUp.cs
- SmiGettersStream.cs
- SpeechSeg.cs
- ClientBuildManager.cs
- SettingsPropertyWrongTypeException.cs
- IconBitmapDecoder.cs
- SqlDataSourceEnumerator.cs
- AdapterUtil.cs
- AttributeCollection.cs
- CodeTypeOfExpression.cs
- ContextActivityUtils.cs
- MessageQueue.cs