Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Services / Web / System / Web / Services / Description / SoapHttpTransportImporter.cs / 1305376 / SoapHttpTransportImporter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Services.Description { using System.CodeDom; using System.Web.Services.Protocols; internal class SoapHttpTransportImporter : SoapTransportImporter { public override bool IsSupportedTransport(string transport) { return transport == SoapBinding.HttpTransport; } public override void ImportClass() { // grab this here so it gets marked "handled" for both client and server SoapAddressBinding soapAddress = ImportContext.Port == null ? null : (SoapAddressBinding)ImportContext.Port.Extensions.Find(typeof(SoapAddressBinding)); if (ImportContext.Style == ServiceDescriptionImportStyle.Client) { ImportContext.CodeTypeDeclaration.BaseTypes.Add(typeof(SoapHttpClientProtocol).FullName); CodeConstructor ctor = WebCodeGenerator.AddConstructor(ImportContext.CodeTypeDeclaration, new string[0], new string[0], null, CodeFlags.IsPublic); ctor.Comments.Add(new CodeCommentStatement(Res.GetString(Res.CodeRemarks), true)); bool soap11 = true; if (ImportContext is Soap12ProtocolImporter) { soap11 = false; // add version code CodeTypeReferenceExpression versionEnumTypeReference = new CodeTypeReferenceExpression(typeof(SoapProtocolVersion)); CodeFieldReferenceExpression versionEnumFieldReference = new CodeFieldReferenceExpression(versionEnumTypeReference, Enum.Format(typeof(SoapProtocolVersion), SoapProtocolVersion.Soap12, "G")); CodePropertyReferenceExpression versionPropertyReference = new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "SoapVersion"); CodeAssignStatement assignVersionStatement = new CodeAssignStatement(versionPropertyReference, versionEnumFieldReference); ctor.Statements.Add(assignVersionStatement); } ServiceDescription serviceDescription = ImportContext.Binding.ServiceDescription; string url = (soapAddress != null) ? soapAddress.Location : null; string urlKey = serviceDescription.AppSettingUrlKey; string baseUrl = serviceDescription.AppSettingBaseUrl; ProtocolImporterUtil.GenerateConstructorStatements(ctor, url, urlKey, baseUrl, soap11 && !ImportContext.IsEncodedBinding); } else if (ImportContext.Style == ServiceDescriptionImportStyle.Server) { ImportContext.CodeTypeDeclaration.BaseTypes.Add(typeof(WebService).FullName); } } } } // 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
- XPathMultyIterator.cs
- ACE.cs
- HebrewNumber.cs
- NodeInfo.cs
- DBCommandBuilder.cs
- CalendarSelectionChangedEventArgs.cs
- FamilyTypeface.cs
- ListBase.cs
- ISessionStateStore.cs
- InvokeBase.cs
- PropertyPushdownHelper.cs
- ClockGroup.cs
- GlyphShapingProperties.cs
- EnlistmentTraceIdentifier.cs
- DocumentViewerAutomationPeer.cs
- InputBinding.cs
- CodeSnippetExpression.cs
- RectangleHotSpot.cs
- FormViewRow.cs
- XPathNodeIterator.cs
- TypeNameConverter.cs
- IIS7UserPrincipal.cs
- PropertyRecord.cs
- GlyphRunDrawing.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- RequestCacheValidator.cs
- SmtpReplyReader.cs
- SparseMemoryStream.cs
- RemoteCryptoSignHashRequest.cs
- MatrixCamera.cs
- ChannelBinding.cs
- WorkflowNamespace.cs
- PropertyValidationContext.cs
- WithStatement.cs
- NativeMethods.cs
- BoundPropertyEntry.cs
- HttpWriter.cs
- DesignSurfaceServiceContainer.cs
- VectorAnimationUsingKeyFrames.cs
- MobileCapabilities.cs
- KnownBoxes.cs
- RadioButtonStandardAdapter.cs
- ControlPropertyNameConverter.cs
- CopyOnWriteList.cs
- DbProviderFactory.cs
- ContractTypeNameElement.cs
- MenuTracker.cs
- WindowsSysHeader.cs
- BufferBuilder.cs
- ModuleElement.cs
- FileAuthorizationModule.cs
- WebPartDisplayMode.cs
- WrapPanel.cs
- coordinatorfactory.cs
- TableProviderWrapper.cs
- BindingContext.cs
- SafeThemeHandle.cs
- RawStylusActions.cs
- DynamicDiscoSearcher.cs
- DispatchWrapper.cs
- Int16Converter.cs
- XpsSerializationManagerAsync.cs
- TrustManagerMoreInformation.cs
- TextBounds.cs
- SessionStateSection.cs
- ListControlDataBindingHandler.cs
- GCHandleCookieTable.cs
- ProxySimple.cs
- DatePickerDateValidationErrorEventArgs.cs
- X509ThumbprintKeyIdentifierClause.cs
- Thread.cs
- Transform.cs
- PeerNearMe.cs
- SqlUDTStorage.cs
- PackWebRequest.cs
- Camera.cs
- OciLobLocator.cs
- ViewStateModeByIdAttribute.cs
- SqlSupersetValidator.cs
- HybridDictionary.cs
- ControlValuePropertyAttribute.cs
- BreakSafeBase.cs
- EmbeddedMailObject.cs
- LinkedResourceCollection.cs
- CoTaskMemUnicodeSafeHandle.cs
- Object.cs
- RedirectionProxy.cs
- ToolStripRenderEventArgs.cs
- DiscreteKeyFrames.cs
- Mouse.cs
- UnhandledExceptionEventArgs.cs
- FixedPosition.cs
- UDPClient.cs
- _DigestClient.cs
- OleDbParameterCollection.cs
- _OverlappedAsyncResult.cs
- PlainXmlSerializer.cs
- EventLogSession.cs
- NotifyInputEventArgs.cs
- EventWaitHandleSecurity.cs