public static MessageQueue CreateQueue(EndpointAddress address, bool isTransactional = true) { var name = address.GetQueueName(); var queue = MessageQueue.Create(name, isTransactional); SetQueuePermissions(queue); return queue; }
static MessagePayload CreateSubscriptionRequest(EndpointAddress subscriberAddress, EndpointAddress publisherAddress) { return new MessagePayload() .SetFromEndpointAddress(subscriberAddress) .SetToEndpointAddress(publisherAddress) .AsSubscriptionRequest(); }
public IssuedSecurityTokenParameters (string tokenType, EndpointAddress issuerAddress, Binding issuerBinding) { token_type = tokenType; issuer_address = issuerAddress; binding = issuerBinding; }
public ClientWebSocketTransportDuplexSessionChannel(HttpChannelFactory<IDuplexSessionChannel> channelFactory, ClientWebSocketFactory connectionFactory, EndpointAddress remoteAddresss, Uri via, ConnectionBufferPool bufferPool) : base(channelFactory, remoteAddresss, via, bufferPool) { Contract.Assert(channelFactory != null, "connection factory must be set"); _channelFactory = channelFactory; _connectionFactory = connectionFactory; }
public SenderAuthenticationSessionAttacher( AuthenticationSessionCache cache, AuthenticatedServerRegistry registry, EndpointAddress address) : base(cache, registry) { Contract.Requires(address != null); this.address = address; }
public DuplexClientRuntimeChannel (ServiceEndpoint endpoint, ChannelFactory factory, EndpointAddress remoteAddress, Uri via) : base (endpoint, factory, remoteAddress, via) { var ed = new EndpointDispatcher (remoteAddress, endpoint.Contract.Name, endpoint.Contract.Namespace); ed.InitializeServiceEndpoint (true, null, endpoint); Runtime.CallbackDispatchRuntime = ed.DispatchRuntime; }
public CallbackContextMessageProperty(EndpointAddress callbackAddress) { if (callbackAddress == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("callbackAddress"); } this.callbackAddress = callbackAddress; }
static void AdjustAddress(ref EndpointAddress reference, Uri via) { // if we don't have an identity and we have differing Uris, we should use the Via if (reference.Identity == null && reference.Uri != via) { reference = new EndpointAddress(via); } }
public DirectChannelConfiguration(EndpointAddress address, MessagingConfiguration messagingConfiguration) { Contract.Requires(messagingConfiguration != null); Contract.Requires(address != null); this.messagingConfiguration = messagingConfiguration; this.address = address; }
public void Send(EndpointAddress destination, ChannelMessage channelMessage) { var queueName = destination.QueueName; if (!namespaceManager.QueueExists(queueName)) throw new Exception(string.Format("Destination {0} does not exist.", destination)); var sendingClient = QueueClient.Create(queueName); var message = CreateBrokeredMessage(channelMessage); sendingClient.Send(message); }
public ServiceEndpoint(ContractDescription contract, Binding binding, EndpointAddress address) { if (contract == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("contract"); _contract = contract; _binding = binding; _address = address; }
MessageTransmitTraceRecord(Message message, string addressElementName, EndpointAddress address) : this(message, addressElementName) { if (address != null) { this.address = address.Uri; } }
internal void EnsureOutgoingIdentity(EndpointAddress serviceReference, ReadOnlyCollection<IAuthorizationPolicy> authorizationPolicies) { if (authorizationPolicies == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("authorizationPolicies"); } AuthorizationContext ac = AuthorizationContext.CreateDefaultAuthorizationContext(authorizationPolicies); EnsureIdentity(serviceReference, ac, SR.IdentityCheckFailedForOutgoingMessage); }
public PublisherConfiguration(EndpointAddress address, MessagingConfiguration messagingConfiguration) : base(messagingConfiguration) { schema = new PublisherChannelSchema { FromAddress = address, MessageFilterStrategy = new PassThroughMessageFilterStategy() }; }
public CallbackContextMessageProperty(EndpointAddress listenAddress, IDictionary<string, string> context) { if (listenAddress != null && listenAddress.Headers.FindHeader(ContextMessageHeader.ContextHeaderName, ContextMessageHeader.ContextHeaderNamespace) != null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(SR.GetString(SR.ListenAddressAlreadyContainsContext)); } this.listenAddress = listenAddress; this.context = context; }
public CreateEndpointSettings(Uri uri) : this() { Guard.Against.Null(uri, "The URI cannot be null"); Address = new EndpointAddress(uri); SetDefaultErrorAddress(); }
void FreeUpSlot(Guid messageId, EndpointAddress address, PersistenceUseType useType) { if (useType != cache.UseType || address != cache.Address) return; MessagePayload message; sentMessages.TryRemove(messageId, out message); SendMessages(); }
public CreateEndpointSettings(IEndpointAddress address) : this() { Guard.Against.Null(address, "The address cannot be null"); Address = new EndpointAddress(address.Uri); SetDefaultErrorAddress(); }
public WebSocketTransportDuplexSessionChannel(HttpChannelFactory<IDuplexSessionChannel> channelFactory, EndpointAddress remoteAddresss, Uri via) : base(channelFactory, channelFactory, EndpointAddress.AnonymousAddress, channelFactory.MessageVersion.Addressing.AnonymousUri, remoteAddresss, via) { Fx.Assert(channelFactory.WebSocketSettings != null, "channelFactory.WebSocketTransportSettings should not be null."); _webSocketSettings = channelFactory.WebSocketSettings; _transferMode = channelFactory.TransferMode; _maxBufferSize = channelFactory.MaxBufferSize; _transportFactorySettings = channelFactory; }
public ResolveCriteria(EndpointAddress address) { if (address == null) { throw FxTrace.Exception.ArgumentNull("address"); } this.endpointAddress = address; this.duration = ResolveCriteria.defaultDuration; }
public AnnouncementEndpoint(DiscoveryVersion discoveryVersion, Binding binding, EndpointAddress address) : base(GetAnnouncementContract(discoveryVersion)) { // Send replies async to maintain performance this.EndpointBehaviors.Add(new DispatcherSynchronizationBehavior { AsynchronousSendEnabled = true }); this.discoveryVersion = discoveryVersion; base.Address = address; base.Binding = binding; }
public MessageAddresser( EndpointAddress fromAddress, EndpointAddress toAddress) { Contract.Requires(fromAddress != null); Contract.Requires(toAddress != null); this.fromAddress = fromAddress; this.toAddress = toAddress; }
public void Send(EndpointAddress destination, ChannelMessage channelMessage) { channelMessage.BodyStream.Seek(0, 0); sentDestinations.Add(destination); if (destination.QueueName.EndsWith("error")) return; InnerMessageHandler?.Invoke(this, new MessageReceivedEventArgs { Message = channelMessage }); }
public CreateEndpointSettings(IEndpointAddress address, CreateEndpointSettings source) : this() { Guard.Against.Null(address, "The address cannot be null"); Guard.Against.Null(source, "The source settings cannot be null"); Address = new EndpointAddress(address.Uri); SetDefaultErrorAddress(); Serializer = source.Serializer; }
public static void SetPersistenceId( this MessagePayload payload, EndpointAddress address, PersistenceUseType useType) { Contract.Requires(address != null); Contract.Requires(address != EndpointAddress.Empty); payload.RemoveHeader(typeof(PersistenceHeader)); payload.AddHeader(new PersistenceHeader(new MessagePersistenceId(payload.Id, address, useType))); }
public IMessageInputter<MessagePayload> Build(RequestRecieveChannelSchema schema, EndpointAddress senderAddress) { Contract.Requires(schema != null); Contract.Requires(senderAddress != null); MessageProcessor startPoint = CreateStartPoint(); BuildChannel(startPoint, schema, CreateCache(schema, senderAddress)); SendChannelBuiltEvent(schema, senderAddress); return startPoint; }
public TcpDuplexSessionChannel (ChannelFactoryBase factory, TcpChannelInfo info, EndpointAddress address, Uri via) : base (factory, address, via) { is_service_side = false; this.info = info; // make sure to acquire TcpClient here. int explicitPort = Via.Port; client = new TcpClient (Via.Host, explicitPort <= 0 ? TcpTransportBindingElement.DefaultPort : explicitPort); counterpart_address = GetEndpointAddressFromTcpClient (client); }
public StreamedFramingRequestChannel(ChannelManagerBase factory, IConnectionOrientedTransportChannelFactorySettings settings, EndpointAddress remoteAddresss, Uri via, IConnectionInitiator connectionInitiator, ConnectionPool connectionPool) : base(factory, remoteAddresss, via, settings.ManualAddressing) { _settings = settings; _connectionInitiator = connectionInitiator; _connectionPool = connectionPool; _messageEncoder = settings.MessageEncoderFactory.Encoder; _upgrade = settings.Upgrade; }
public IMessageInputter<object> Build(ReplySendChannelSchema schema, EndpointAddress senderAddress) { SendMessageCache cache = CreateCache(schema, senderAddress); RegisterCacheWithAcknowledgementHandler(cache); IMessageProcessor<object, object> startPoint = CreateStartPoint(); BuildPipeline(startPoint, schema, senderAddress, cache); SendChannelBuiltEvent(schema, senderAddress); return startPoint; }
protected override string GetPoolKey(EndpointAddress address, Uri via) { int port = via.Port; if (port == -1) { port = TcpUri.DefaultPort; } string normalizedHost = via.DnsSafeHost.ToUpperInvariant(); return string.Format(CultureInfo.InvariantCulture, @"[{0}, {1}]", normalizedHost, port); }
public static void XmlSFAttributeDocLitDualNsTest() { BasicHttpBinding binding = null; EndpointAddress endpointAddress = null; ChannelFactory <ICalculatorDocLit> factory1 = null; ChannelFactory <IHelloWorldDocLit> factory2 = null; ICalculatorDocLit serviceProxy1 = null; IHelloWorldDocLit serviceProxy2 = null; // *** SETUP *** \\ binding = new BasicHttpBinding(); endpointAddress = new EndpointAddress(Endpoints.BasicHttpDocLitDualNs_Address); factory1 = new ChannelFactory <ICalculatorDocLit>(binding, endpointAddress); serviceProxy1 = factory1.CreateChannel(); factory2 = new ChannelFactory <IHelloWorldDocLit>(binding, endpointAddress); serviceProxy2 = factory2.CreateChannel(); // *** EXECUTE Variation *** \\ try { var dateTime = DateTime.Now; string testStr = "test string"; var intParams = new IntParams() { P1 = 5, P2 = 10 }; var floatParams = new FloatParams() { P1 = 5.0f, P2 = 10.0f }; var byteParams = new ByteParams() { P1 = 5, P2 = 10 }; Assert.Equal(3, serviceProxy1.Sum2(1, 2)); Assert.Equal(intParams.P1 + intParams.P2, serviceProxy1.Sum(intParams)); Assert.Equal(string.Format("{0}{1}", intParams.P1, intParams.P2), serviceProxy1.Concatenate(intParams)); Assert.Equal((float)(floatParams.P1 / floatParams.P2), serviceProxy1.Divide(floatParams)); Assert.Equal((new byte[] { byteParams.P1, byteParams.P2 }), serviceProxy1.CreateSet(byteParams)); Assert.Equal(dateTime, serviceProxy1.ReturnInputDateTime(dateTime)); Guid guid = Guid.NewGuid(); serviceProxy1.AddIntParams(guid, intParams); IntParams outputIntParams = serviceProxy1.GetAndRemoveIntParams(guid); Assert.NotNull(outputIntParams); Assert.Equal(intParams.P1, outputIntParams.P1); Assert.Equal(intParams.P2, outputIntParams.P2); Guid guid2 = Guid.NewGuid(); serviceProxy2.AddString(guid2, testStr); Assert.Equal(testStr, serviceProxy2.GetAndRemoveString(guid2)); } catch (Exception ex) { Assert.True(false, ex.Message); } finally { // *** ENSURE CLEANUP *** \\ ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)serviceProxy1); ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)serviceProxy2); } }
public HeaderClientBase(H header, string endpointName, EndpointAddress remoteAddress) : base(endpointName, remoteAddress) { Header = header; }
static void Main(string[] args) { EndpointAddress address; X509Certificate2 serverCertificate; bool stagingMode = true; if (stagingMode) //staging mode { address = new EndpointAddress( new Uri("https://se-face-webservice.redsara.es/facturasspp2"), EndpointIdentity.CreateDnsIdentity("SELLO ENTIDAD SGAD PRUEBAS")); serverCertificate = new X509Certificate2(@"C:\temp\SELLO-ENTIDAD-SGAD-PRUEBAS.cer"); } else //production mode { address = new EndpointAddress( new Uri("https://webservice.face.gob.es/facturasspp2"), EndpointIdentity.CreateDnsIdentity("SELLO DE ENTIDAD SGAD")); serverCertificate = new X509Certificate2(@"C:\temp\SELLO-DE-ENTIDAD-SGAD.cer"); } //Our certificate, must be var clientCertificate = new X509Certificate2(@"C:\temp\myawensomecertificate.pfx", "myawensomepass"); //Custombinding for interop with FACE java web service CustomBinding customBinding = new CustomBinding(); //security var sec = SecurityBindingElement.CreateMutualCertificateDuplexBindingElement( MessageSecurityVersion.WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10); sec.AllowSerializedSigningTokenOnReply = true; sec.MessageProtectionOrder = MessageProtectionOrder.SignBeforeEncrypt; sec.SecurityHeaderLayout = SecurityHeaderLayout.LaxTimestampLast; sec.IncludeTimestamp = false; //message var textBindingElement = new TextMessageEncodingBindingElement(MessageVersion.Soap11, Encoding.UTF8); //transport var httpsTransport = new HttpsTransportBindingElement(); httpsTransport.RequireClientCertificate = true; //Bind in order (Security layer, message layer, transport layer) customBinding.Elements.Add(sec); customBinding.Elements.Add(textBindingElement); customBinding.Elements.Add(httpsTransport); ChannelFactory <facturasspp2.FacturaSSPPWebServiceProxyPort> factory = new ChannelFactory <facturasspp2.FacturaSSPPWebServiceProxyPort>(customBinding, address); factory.Credentials.ClientCertificate.Certificate = clientCertificate; factory.Credentials.ServiceCertificate.DefaultCertificate = serverCertificate; factory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None; var service = factory.CreateChannel(); try { var c = service.consultarEstados(); } catch (Exception e) { Console.WriteLine(e.Message); } }
public FamilyClient(Binding binding, EndpointAddress address) : base(binding, address) { }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); BasicHttpBinding b = new BasicHttpBinding(); b.SendTimeout = new TimeSpan(0, 0, 10); b.ReceiveTimeout = new TimeSpan(0, 0, 10); EndpointAddress e = new EndpointAddress(@"http://services.romvault.com/RVService.svc"); RVServiceClient s = new RVServiceClient(b, e); if (string.IsNullOrEmpty(UISettings.Username) || string.IsNullOrEmpty(UISettings.EMail)) { using (FrmRegistration fReg = new FrmRegistration()) { fReg.ShowDialog(); } } Settings.rvSettings = new Settings(); Settings.rvSettings = Settings.SetDefaults(); ReportError.Username = UISettings.Username; ReportError.EMail = UISettings.EMail; ReportError.OptOut = UISettings.OptOut; ReportError.ErrorForm += ShowErrorForm; ReportError.Dialog += ShowDialog; try { if (!UISettings.OptOut) { s.SendUserAsync(UISettings.Username, UISettings.EMail, VNow).Wait(); s.StartUpV2Async(Version.Major, Version.Minor, Version.Build).Wait(); } ReportError.vMajor = Version.Major; ReportError.vMinor = Version.Minor; ReportError.vBuild = Version.Build; var taskUpdateCheck = s.UpdateCheckAsync(Version.Major, Version.Minor, Version.Build); taskUpdateCheck.Wait(); bool v = taskUpdateCheck.Result; if (v) { Task <string> taskGetUpdateLink = s.GetUpdateLinkAsync(); taskGetUpdateLink.Wait(); string url = taskGetUpdateLink.Result; MessageBox.Show("There is a new release download now from " + url); //System.Diagnostics.Process.Start(url); //s.Close(); //return; } } catch { } #if !DEBUG Application.ThreadException += ReportError.UnhandledExceptionHandler; #endif FrmSplashScreen progress = new FrmSplashScreen(); progress.ShowDialog(); progress.Dispose(); Application.Run(new FrmMain()); ReportError.Close(); }
public static RecoverParticipantRecordSchema Instance(string transactionId, Guid enlistmentId, EndpointAddress participantService, ProtocolVersion protocolVersion) { ProtocolVersionHelper.AssertProtocolVersion(protocolVersion, typeof(RecoverParticipantRecordSchema), "Instance"); switch (protocolVersion) { case ProtocolVersion.Version10: return(new RecoverParticipantRecordSchema10(transactionId, enlistmentId, participantService)); case ProtocolVersion.Version11: return(new RecoverParticipantRecordSchema11(transactionId, enlistmentId, participantService)); } return(null); }
private void AddServerCertMappingOrSetRemoteCertificateValidationCallback(ServiceModelHttpMessageHandler messageHandler, EndpointAddress to) { Fx.Assert(messageHandler != null, "httpMessageHandler should not be null."); if (_sslCertificateValidator != null) { if (!messageHandler.SupportsCertificateValidationCallback) { throw ExceptionHelper.PlatformNotSupported("Server certificate validation not supported yet"); } messageHandler.ServerCertificateValidationCallback = _remoteCertificateValidationCallback; } else { if (to.Identity is X509CertificateEndpointIdentity) { HttpTransportSecurityHelpers.SetServerCertificateValidationCallback(messageHandler); } } }
/// <summary> /// Constructor - uses input endpoint, loads bindings from given configuration name. /// </summary> public StudyLocatorServiceClient(string endpointConfigurationName, EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { }
public MockChannelBase(ChannelManagerBase manager, MessageEncoderFactory encoderFactory, EndpointAddress address) : base(manager) { _address = address; _manager = manager; _encoder = encoderFactory.CreateSessionEncoder(); OpenAsyncResult = new MockAsyncResult(); CloseAsyncResult = new MockAsyncResult(); GetEndpointPropertyOverride = DefaultGetEndpointProperty; // CommunicationObject overrides DefaultCloseTimeoutOverride = DefaultDefaultCloseTimeout; DefaultOpenTimeoutOverride = DefaultDefaultOpenTimeout; OnAbortOverride = DefaultOnAbort; OnOpenOverride = DefaultOnOpen; OnCloseOverride = DefaultOnClose; OnBeginOpenOverride = DefaultOnBeginOpen; OnEndOpenOverride = DefaultOnEndOpen; OnBeginCloseOverride = DefaultOnBeginClose; OnEndCloseOverride = DefaultOnEndClose; // All the virtuals OnOpeningOverride = DefaultOnOpening; OnOpenedOverride = DefaultOnOpened; OnClosingOverride = DefaultOnClosing; OnClosedOverride = DefaultOnClosed; OnFaultedOverride = DefaultOnFaulted; }
/// <summary> /// Initializes a new instance of the <see cref="WcfLogReceiverOneWayClient"/> class. /// </summary> /// <param name="endpointConfigurationName">Name of the endpoint configuration.</param> /// <param name="remoteAddress">The remote address.</param> public WcfILogReceiverClient(string endpointConfigurationName, EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { }
/// <summary> /// svcutil generated code /// </summary> /// <param name="endpointConfigurationName">svcutil generated code</param> /// <param name="remoteAddress">svcutil generated code</param> public GenericNotesServiceClient(string endpointConfigurationName, EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { }
public HttpsClientRequestChannel(HttpsChannelFactory <IRequestChannel> factory, EndpointAddress to, Uri via, bool manualAddressing) : base(factory, to, via, manualAddressing) { _factory = factory; }
protected override IRequestChannel OnCreateChannel(EndpointAddress address, Uri via) { return(new OioWsTrustChannel(this, _innerFactory.CreateChannel(address, via))); }
public override int GetHashCode() { return(EndpointAddress.UriGetHashCode(ListenUri, true /* includeHost */)); }
/// <summary> /// Constructor - uses input endpoint and binding. /// </summary> public StudyLocatorServiceClient(Binding binding, EndpointAddress remoteAddress) : base(binding, remoteAddress) { }
public WxPayClient(System.ServiceModel.Channels.Binding binding, EndpointAddress edpAddr) : base(binding, edpAddr) { }
public WsdlImporter GetImporterFromServiceEndpoint(EndpointAddress metadataAddress) { var metadataSet = GetMetaDataDocs(metadataAddress); return(CreateImporterFromMetadata(metadataSet)); }
//Create the channel factory based on the Service Contracts selected by the user private void InitializeClient(Uri baseUri, Binding binding) { Log.Trace("Binding == " + binding.Name); Log.Trace("Initializing Clients ..."); string uriString = baseUri.ToString(); Log.Trace("Client Connecting to base Uri == " + baseUri); EndpointAddress epa; foreach (ServiceContract serviceContract in Parameters.ServiceContracts) { string addressString = serviceContract.ToString(); switch (serviceContract) { case ServiceContract.IAsyncOneWay: epa = new EndpointAddress(uriString + addressString); asyncOneWayChannelFactory = new ChannelFactory <IAsyncOneWay>(binding, epa); break; case ServiceContract.IAsyncSessionOneWay: epa = new EndpointAddress(uriString + addressString); asyncSessionOneWayChannelFactory = new ChannelFactory <IAsyncSessionOneWay>(binding, epa); break; case ServiceContract.IAsyncTwoWay: epa = new EndpointAddress(uriString + addressString); asyncTwoWayChannelFactory = new ChannelFactory <IAsyncTwoWay>(binding, epa); break; case ServiceContract.IAsyncSessionTwoWay: epa = new EndpointAddress(uriString + addressString); asyncSessionTwoWayChannelFactory = new ChannelFactory <IAsyncSessionTwoWay>(binding, epa); break; case ServiceContract.ISyncOneWay: epa = new EndpointAddress(uriString + addressString); syncOneWayChannelFactory = new ChannelFactory <ISyncOneWay>(binding, epa); break; case ServiceContract.ISyncSessionOneWay: epa = new EndpointAddress(uriString + addressString); syncSessionOneWayChannelFactory = new ChannelFactory <ISyncSessionOneWay>(binding, epa); break; case ServiceContract.ISyncTwoWay: epa = new EndpointAddress(uriString + addressString); syncTwoWayChannelFactory = new ChannelFactory <ISyncTwoWay>(binding, epa); break; case ServiceContract.ISyncSessionTwoWay: epa = new EndpointAddress(uriString + addressString); syncSessionTwoWayChannelFactory = new ChannelFactory <ISyncSessionTwoWay>(binding, epa); break; case ServiceContract.IDuplexContract: epa = new EndpointAddress(uriString + addressString); duplexChannelFactory = new DuplexChannelFactory <IDuplexContract>(cb, binding, epa); break; case ServiceContract.IDuplexSessionContract: epa = new EndpointAddress(uriString + addressString); duplexSessionChannelFactory = new DuplexChannelFactory <IDuplexSessionContract>(cb, binding, epa); break; default: Log.Trace(serviceContract + " type is not supported"); break; } } }
public void PingClient(object sender, ElapsedEventArgs e) { _PingClientTimer.Stop(); try { using (var context = new CentralDBEntities()) { //var result2 = stationEntity.Select(x => x.IsActive == true && !x.Identifier.Contains("Webclient") && !x.Identifier.Contains("Mobile")).ToArray(); var fromStation = context.Station.Where(it => it.IsActive == true && !it.Identifier.Contains("Webclient") && !it.Identifier.Contains("Mobile")); var result = fromStation.Select(Mapper.Map <AMS.Broker.Contracts.DTO.Station>).ToArray(); if (result.Count() > 0) { foreach (var actstation in result) { string strIp = actstation.LocationDescription; if (strIp != "") { try { //string _strUrl = "http://" + strIp + ":4532/soap/LoginStatusService"; string _strUrl = "http://" + strIp + ":6532/soap/ControllerCallBackCommService"; EndpointAddress ar = new EndpointAddress(_strUrl); AMS.Broker.WatchDogService.LoginStatusServiceRef.LoginStatusClient _serVice = new AMS.Broker.WatchDogService.LoginStatusServiceRef.LoginStatusClient("WSHttpBinding_ILoginStatus", ar.ToString()); //WSHttpBinding_ILoginStatus _serVice.Endpoint.Binding.OpenTimeout = TimeSpan.FromSeconds(3); _serVice.Endpoint.Binding.SendTimeout = TimeSpan.FromSeconds(3); int nRetVal = _serVice.CheckStatus(); _serVice.Close(); if (nRetVal < 1) { actstation.IsActive = false; context.SaveChanges(); ClearMemory(); } if (nRetVal == 1) { actstation.IsActive = true; context.SaveChanges(); ClearMemory(); } } catch (Exception ex) { var station = context.Station.FirstOrDefault(x => x.LocationDescription == strIp); station.IsActive = false; context.SaveChanges(); ClearMemory(); } } } } } _PingClientTimer.Start(); } catch (Exception ex) { _logger.Info("GatewayService PingClient() Exception" + ex.Message); } //get active station //ping active station //update station status if not ping }
public GeoClient(Binding binding, EndpointAddress address) : base(binding, address) { }
internal async Task <MessageRpc> ProcessMessageAsync(MessageRpc rpc) { if (rpc.Operation.IsOneWay) { await rpc.RequestContext.ReplyAsync(null); rpc.OperationContext.RequestContext = null; } else { if (!rpc.Channel.IsReplyChannel && ((object)rpc.RequestID == null) && (rpc.Operation.Action != MessageHeaders.WildcardAction)) { CommunicationException error = new CommunicationException(SR.SFxOneWayMessageToTwoWayMethod0); throw TraceUtility.ThrowHelperError(error, rpc.Request); } if (!_manualAddressing) { EndpointAddress replyTo = rpc.ReplyToInfo.ReplyTo; if (replyTo != null && replyTo.IsNone && rpc.Channel.IsReplyChannel) { CommunicationException error = new CommunicationException(SR.SFxRequestReplyNone); throw TraceUtility.ThrowHelperError(error, rpc.Request); } if (_isOnServer) { EndpointAddress remoteAddress = rpc.Channel.RemoteAddress; if ((remoteAddress != null) && !remoteAddress.IsAnonymous) { MessageHeaders headers = rpc.Request.Headers; Uri remoteUri = remoteAddress.Uri; if ((replyTo != null) && !replyTo.IsAnonymous && (remoteUri != replyTo.Uri)) { string text = SR.Format(SR.SFxRequestHasInvalidReplyToOnServer, replyTo.Uri, remoteUri); Exception error = new InvalidOperationException(text); throw TraceUtility.ThrowHelperError(error, rpc.Request); } EndpointAddress faultTo = headers.FaultTo; if ((faultTo != null) && !faultTo.IsAnonymous && (remoteUri != faultTo.Uri)) { string text = SR.Format(SR.SFxRequestHasInvalidFaultToOnServer, faultTo.Uri, remoteUri); Exception error = new InvalidOperationException(text); throw TraceUtility.ThrowHelperError(error, rpc.Request); } if (rpc.RequestVersion.Addressing == AddressingVersion.WSAddressingAugust2004) { EndpointAddress from = headers.From; if ((from != null) && !from.IsAnonymous && (remoteUri != from.Uri)) { string text = SR.Format(SR.SFxRequestHasInvalidFromOnServer, from.Uri, remoteUri); Exception error = new InvalidOperationException(text); throw TraceUtility.ThrowHelperError(error, rpc.Request); } } } } } } if (_concurrency.IsConcurrent(rpc)) { rpc.Channel.IncrementActivity(); rpc.SuccessfullyIncrementedActivity = true; } // TODO: Make authenticationBehavior Async if (_authenticationBehavior != null) { _authenticationBehavior.Authenticate(ref rpc); } // TODO: Make authorizationBehavior Async if (_authorizationBehavior != null) { _authorizationBehavior.Authorize(ref rpc); } await InstanceBehavior.EnsureInstanceContextAsync(rpc); TransferChannelFromPendingList(rpc); await AcquireDynamicInstanceContextAsync(rpc); AfterReceiveRequest(ref rpc); await _concurrency.LockInstanceAsync(rpc); rpc.SuccessfullyLockedInstance = true; try { // TaskHelpers has an extension method which enables awaitting a sync context to run continuation on it. await _thread.GetSyncContext(rpc); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } throw DiagnosticUtility.ExceptionUtility.ThrowHelperFatal(e.Message, e); } // This needs to happen after LockInstance--LockInstance guarantees // in-order delivery, so we can't receive the next message until we // have acquired the lock. // // This also needs to happen after BindThread based on the assumption // that running on UI thread should guarantee in-order delivery if // the SynchronizationContext is single threaded. if (_concurrency.IsConcurrent(rpc)) { rpc.EnsureReceive(); if (!rpc._processCallReturned) { // To allow transport receive loop to get next request, the call to dispatch the current message needs to return. // If all previous await's have completed synchronously, execution needs to be forced to continue on another thread. // This code causes this method to continue on another thread and any calling receive pump (such as NetTcp) will // use this thread to request the next message. It might be better to switch that so this thread continues on this // thread and the caller has to run on a new thread. await Task.Yield(); } } InstanceBehavior.EnsureServiceInstance(rpc); try { SetActivityIdOnThread(rpc); rpc = await rpc.Operation.InvokeAsync(rpc); } catch { // This catch clause forces ClearCallContext to run prior to stackwalks exiting this frame. throw; } try { // Switch back to thread pool if we're using a non-default Sync Context. This only switches threads if needed. await TaskHelpers.EnsureDefaultTaskScheduler(); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } throw DiagnosticUtility.ExceptionUtility.ThrowHelperFatal(e.Message, e); } try { _error.ProvideMessageFault(rpc); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } _error.HandleError(e); } PrepareReply(rpc); if (rpc.CanSendReply) { rpc.ReplyTimeoutHelper = new TimeoutHelper(rpc.Channel.OperationTimeout); } if (rpc.CanSendReply) { //if (rpc.Reply != null) //{ // TraceUtility.MessageFlowAtMessageSent(rpc.Reply, rpc.EventTraceActivity); //} rpc = await ReplyAsync(rpc); } // Logic for knowing when to close stuff: // // ASSUMPTIONS: // Closing a stream over a message also closes the message. // Closing a message over a stream does not close the stream. // (OperationStreamProvider.ReleaseStream is no-op) // // This is a table of what should be disposed in what cases. // The rows represent the type of parameter to the method and // whether we are disposing parameters or not. The columns // are for the inputs vs. the outputs. The cells contain the // values that need to be Disposed. M^P means that exactly // one of the message and parameter needs to be disposed, // since they refer to the same object. // // Request Reply // Message | M or P | M or P // Dispose Stream | P | M and P // Params | M and P | M and P // | | // Message | none | none // NoDispose Stream | none | M // Params | M | M // // By choosing to dispose the parameter in both of the "M or P" // cases, the logic needed to generate this table is: // // CloseRequestMessage = IsParams // CloseRequestParams = rpc.Operation.DisposeParameters // CloseReplyMessage = rpc.Operation.SerializeReply // CloseReplyParams = rpc.Operation.DisposeParameters // // IsParams can be calculated based on whether the request // message was consumed after deserializing but before calling // the user. This is stored as rpc.DidDeserializeRequestBody. // Fx.Assert( !object.ReferenceEquals(rpc.ErrorProcessor, _processMessageCleanupError), "ProcessMessageCleanup run twice on the same MessageRpc!"); rpc.ErrorProcessor = _processMessageCleanupError; bool replyWasSent = false; if (rpc.CanSendReply) { replyWasSent = rpc.SuccessfullySendReply; } try { try { if (rpc.DidDeserializeRequestBody) { rpc.Request.Close(); } } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } _error.HandleError(e); } rpc.DisposeParameters(false); //Dispose all input/output/return parameters if (rpc.FaultInfo.IsConsideredUnhandled) { if (!replyWasSent) { rpc.AbortRequestContext(); rpc.AbortChannel(); } else { rpc.CloseRequestContext(); rpc.CloseChannel(); } rpc.AbortInstanceContext(); } else { if (rpc.RequestContextThrewOnReply) { rpc.AbortRequestContext(); } else { rpc.CloseRequestContext(); } } if ((rpc.Reply != null) && (rpc.Reply != rpc.ReturnParameter)) { try { rpc.Reply.Close(); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } _error.HandleError(e); } } if ((rpc.FaultInfo.Fault != null) && (rpc.FaultInfo.Fault.State != MessageState.Closed)) { // maybe ProvideFault gave a Message, but then BeforeSendReply replaced it // in that case, we need to close the one from ProvideFault try { rpc.FaultInfo.Fault.Close(); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } _error.HandleError(e); } } try { rpc.OperationContext.FireOperationCompleted(); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } throw DiagnosticUtility.ExceptionUtility.ThrowHelperCallback(e); } InstanceBehavior.AfterReply(ref rpc, _error); if (rpc.SuccessfullyLockedInstance) { try { _concurrency.UnlockInstance(ref rpc); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } Fx.Assert("Exceptions should be caught by callee"); rpc.InstanceContext.FaultInternal(); _error.HandleError(e); } } if (_terminate != null) { try { _terminate.AfterReply(ref rpc); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } _error.HandleError(e); } } if (rpc.SuccessfullyIncrementedActivity) { try { rpc.Channel.DecrementActivity(); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } _error.HandleError(e); } } } finally { // TODO: Add the code for the other half of InstanceContextServiceThrottle being acquired if (rpc.MessageRpcOwnsInstanceContextThrottle && rpc.channelHandler.InstanceContextServiceThrottle != null) { rpc.channelHandler.InstanceContextServiceThrottle.DeactivateInstanceContext(); } //if (rpc.Activity != null && DiagnosticUtility.ShouldUseActivity) //{ // rpc.Activity.Stop(); //} } _error.HandleError(rpc); if (!_concurrency.IsConcurrent(rpc)) { rpc.EnsureReceive(); } return(rpc); }
private static ServiceEndpoint CreateServiceEndpoint(Type contractType, Binding binding, EndpointAddress address) { var endpoint = new ServiceEndpoint( ContractDescription.GetContract(contractType), binding, address); endpoint.Behaviors.Add(new ListenUriEndpointBehavior()); return(endpoint); }
//Sending messages after creation of proxy per client private void SendMessages(object uriObject) { Uri baseUri = (Uri)uriObject; string uriString = baseUri.ToString(); EndpointAddress epa; foreach (ServiceContract serviceContract in Parameters.ServiceContracts) { switch (serviceContract) { case ServiceContract.IAsyncOneWay: epa = new EndpointAddress(uriString + serviceContract.ToString()); IAsyncOneWay asyncOneWay = asyncOneWayChannelFactory.CreateChannel(epa); for (int i = 0; i < Parameters.MessagesPerClient; i++) { IAsyncResult res = asyncOneWay.BeginOneWayMethod ("AsyncOneWay Sending Message to Server == " + i, null, asyncOneWay); asyncOneWay.EndOneWayMethod(res); } ((IChannel)asyncOneWay).Close(); break; case ServiceContract.IAsyncSessionOneWay: epa = new EndpointAddress(uriString + serviceContract.ToString()); IAsyncSessionOneWay asyncSessionOneWay = asyncSessionOneWayChannelFactory.CreateChannel(epa); for (int i = 0; i < Parameters.MessagesPerClient; i++) { IAsyncResult res = asyncSessionOneWay.BeginSessionOneWayMethod ("AsyncSessionOneWay Sending Message to Server == " + i, null, asyncSessionOneWay); asyncSessionOneWay.EndSessionOneWayMethod(res); } ((IChannel)asyncSessionOneWay).Close(); break; case ServiceContract.IAsyncTwoWay: epa = new EndpointAddress(uriString + serviceContract.ToString()); IAsyncTwoWay asyncTwoWay = asyncTwoWayChannelFactory.CreateChannel(epa); for (int i = 0; i < Parameters.MessagesPerClient; i++) { IAsyncResult res = asyncTwoWay.BeginTwoWayMethod ("AsyncTwoWay Sending Message to Server == " + i, null, asyncTwoWay); string msg = asyncTwoWay.EndTwoWayMethod(res); Log.Trace("AsyncTwoWay received message == " + msg); } ((IChannel)asyncTwoWay).Close(); break; case ServiceContract.IAsyncSessionTwoWay: epa = new EndpointAddress(uriString + serviceContract.ToString()); IAsyncSessionTwoWay asyncSessionTwoWay = asyncSessionTwoWayChannelFactory.CreateChannel(epa); for (int i = 0; i < Parameters.MessagesPerClient; i++) { IAsyncResult res = asyncSessionTwoWay.BeginSessionTwoWayMethod ("AsyncSessionTwoWay Sending Message to Server == " + i, null, asyncSessionTwoWay); string msg = asyncSessionTwoWay.EndSessionTwoWayMethod(res); Log.Trace("AsyncSessionTwoWay received message == " + msg); } ((IChannel)asyncSessionTwoWay).Close(); break; case ServiceContract.ISyncOneWay: epa = new EndpointAddress(uriString + serviceContract.ToString()); ISyncOneWay syncOneWay = syncOneWayChannelFactory.CreateChannel(epa); for (int i = 0; i < Parameters.MessagesPerClient; i++) { syncOneWay.OneWay("SyncOneWay Sending Message to Server == " + i); } ((IChannel)syncOneWay).Close(); break; case ServiceContract.ISyncSessionOneWay: epa = new EndpointAddress(uriString + serviceContract.ToString()); ISyncSessionOneWay syncSessionOneWay = syncSessionOneWayChannelFactory.CreateChannel(epa); for (int i = 0; i < Parameters.MessagesPerClient; i++) { syncSessionOneWay.OneWay("SyncSessionOneWay Sending Message to Server == " + i); } ((IChannel)syncSessionOneWay).Close(); break; case ServiceContract.ISyncTwoWay: epa = new EndpointAddress(uriString + serviceContract.ToString()); ISyncTwoWay syncTwoWay = syncTwoWayChannelFactory.CreateChannel(epa); for (int i = 0; i < Parameters.MessagesPerClient; i++) { string msg = syncTwoWay.TwoWay("SyncTwoWay Sending Message to Server == " + i); Log.Trace("SyncTwoWay received message == " + msg); } ((IChannel)syncTwoWay).Close(); break; case ServiceContract.ISyncSessionTwoWay: epa = new EndpointAddress(uriString + serviceContract.ToString()); ISyncSessionTwoWay syncSessionTwoWay = syncSessionTwoWayChannelFactory.CreateChannel(epa); for (int i = 0; i < Parameters.MessagesPerClient; i++) { string msg = syncSessionTwoWay.TwoWay("SyncSessionTwoWay Sending Message to Server == " + i); Log.Trace("SyncSessionTwoWay received message == " + msg); } ((IChannel)syncSessionTwoWay).Close(); break; case ServiceContract.IDuplexContract: epa = new EndpointAddress(uriString + serviceContract.ToString()); IDuplexContract duplex = duplexChannelFactory.CreateChannel(ic, epa); for (int i = 0; i < Parameters.MessagesPerClient; i++) { duplex.DuplexOneWay("DuplexOneWay Sending Message to Server == " + i); Thread.Sleep(1000); } ((IChannel)duplex).Close(); break; case ServiceContract.IDuplexSessionContract: epa = new EndpointAddress(uriString + serviceContract.ToString()); IDuplexSessionContract duplexSession = duplexSessionChannelFactory.CreateChannel(ic, epa); for (int i = 0; i < Parameters.MessagesPerClient; i++) { duplexSession.DuplexOneWay("DuplexSessionOneWay Sending Message to Server == " + i); Thread.Sleep(1000); } ((IChannel)duplexSession).Close(); break; default: Log.Trace(serviceContract + " type is not supported"); break; } } }
public CreationEndpoint(Binding binding, EndpointAddress address) : base(typeof(IWorkflowCreation), binding, address) { }
public ServicePDNProxy(Binding binding, EndpointAddress remoteAddress) : base(binding, remoteAddress) { }
public DMSCallProxy(NetTcpBinding binding, EndpointAddress address) : base(binding, address) { factory = this.CreateChannel(); }
public HeaderClientBase(H header, Binding binding, EndpointAddress remoteAddress) : base(binding, remoteAddress) { Header = header; }
public ClientServiceClient(Binding binding, EndpointAddress remoteAddress) : base(binding, remoteAddress) { }
/// <summary> /// Initializes a new instance of the <see cref="WcfLogReceiverOneWayClient"/> class. /// </summary> /// <param name="binding">The binding.</param> /// <param name="remoteAddress">The remote address.</param> public WcfILogReceiverClient(Binding binding, EndpointAddress remoteAddress) : base(binding, remoteAddress) { }
/// <summary> /// svcutil generated code /// </summary> /// <param name="binding">svcutil generated code</param> /// <param name="remoteAddress">svcutil generated code</param> public GenericNotesServiceClient(Binding binding, EndpointAddress remoteAddress) : base(binding, remoteAddress) { }