//구성정보 없이 코드로 Endpoint 구성후 호출 private void CallServiceWithoutConfig() { try { // 1. 클라이언트 상에 서비스 endpoint 정의하기 System.ServiceModel.Description.ServiceEndpoint httpEndpoint = new System.ServiceModel.Description.ServiceEndpoint( System.ServiceModel.Description.ContractDescription.GetContract( typeof(IEchoService)),new System.ServiceModel.WSHttpBinding(), new System.ServiceModel.EndpointAddress("http://xdn-dcpark/Server_Console/EchoService")); System.ServiceModel.Description.ServiceEndpoint tcpEndpoint= new System.ServiceModel.Description.ServiceEndpoint( System.ServiceModel.Description.ContractDescription.GetContract( typeof(IEchoService)), new System.ServiceModel.NetTcpBinding(), new System.ServiceModel.EndpointAddress("net.tcp://xdn-dcpark:20000/Server_Console/EchoService")); System.ServiceModel.Description.ServiceEndpoint namedPipeEndpoint= new System.ServiceModel.Description.ServiceEndpoint( System.ServiceModel.Description.ContractDescription.GetContract( typeof(IEchoService)), new System.ServiceModel.NetNamedPipeBinding(), new System.ServiceModel.EndpointAddress("net.pipe://xdn-dcpark/Server_Console/EchoService")); IEchoService svc = null; // 2. Endpoint 에 기반한 Channel Factory 생성 using (System.ServiceModel.ChannelFactory<IEchoService> httpFactory = new System.ServiceModel.ChannelFactory<IEchoService>(httpEndpoint)) { // 3. Endpoint에 대한 Chennel proxy 생성 svc = httpFactory.CreateChannel(); // 4. 서비스 오퍼레이션 호출 this.txtStatus.Text += String.Format("Invoking HTTP endpoint(ONLY CODE): {0}\r\n", svc.Echo("Duck Chang Park")); } // 2. Endpoint 에 기반한 Channel Factory 생성 using (System.ServiceModel.ChannelFactory<IEchoService> tcpFactory = new System.ServiceModel.ChannelFactory<IEchoService>(tcpEndpoint)) { // 3. Endpoint에 대한 Chennel proxy 생성 svc = tcpFactory.CreateChannel(); // 4. 서비스 오퍼레이션 호출 this.txtStatus.Text += String.Format("Invoking TCP endpoint(ONLY CODE): {0}\r\n", svc.Echo("Duck Chang Park")); } // 2. Endpoint 에 기반한 Channel Factory 생성 using (System.ServiceModel.ChannelFactory<IEchoService> namedPipeFactory = new System.ServiceModel.ChannelFactory<IEchoService>(namedPipeEndpoint)) { // 3. Endpoint에 대한 Chennel proxy 생성 svc = namedPipeFactory.CreateChannel(); // 4. 서비스 오퍼레이션 호출 this.txtStatus.Text += String.Format("Invoking NAMED PIPE endpoint(ONLY CODE): {0}\r\n", svc.Echo("Duck Chang Park")); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { this.txtStatus.Text += String.Format("--------------------------------------\r\n"); } }
void System.ServiceModel.Description.IEndpointBehavior.Validate(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint) { }
/// <summary> /// Implement this partial method to configure the service endpoint. /// </summary> /// <param name="serviceEndpoint">The endpoint to configure</param> /// <param name="clientCredentials">The client credentials</param> static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials);
void System.ServiceModel.Description.IEndpointBehavior.ApplyClientBehavior(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime) { }
void System.ServiceModel.Description.IEndpointBehavior.ApplyDispatchBehavior(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher) { }
void System.ServiceModel.Description.IEndpointBehavior.AddBindingParameters(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Channels.BindingParameterCollection parameters) { }
public void Validate(System.ServiceModel.Description.ServiceEndpoint endpoint) { }
public void ApplyDispatchBehavior(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher) { }
public void ApplyClientBehavior(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime) { clientRuntime.ClientMessageInspectors.Add(this.inspector); }
public void AddBindingParameters(System.ServiceModel.Description.ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) { }