/// <summary> /// Asynchronously calls the GetEndpoints service. /// </summary> public virtual IAsyncResult BeginGetEndpoints(GetEndpointsMessage message, AsyncCallback callback, object callbackData) { try { // check for bad data. if (message == null) throw new ArgumentNullException("message"); // set the request context. SetRequestContext(RequestEncoding.Xml); // create handler. ProcessRequestAsyncResult result = new ProcessRequestAsyncResult(this, callback, callbackData, 0); return result.BeginProcessRequest(SecureChannelContext.Current, message.GetEndpointsRequest); } catch (Exception e) { throw CreateSoapFault(message.GetEndpointsRequest, e); } }
/// <summary> /// The operation contract for the GetEndpoints service. /// </summary> public virtual GetEndpointsResponseMessage GetEndpoints(GetEndpointsMessage request) { GetEndpointsResponse response = null; try { // OnRequestReceived(message.GetEndpointsRequest); SetRequestContext(RequestEncoding.Xml); response = (GetEndpointsResponse)GetEndpoints(request.GetEndpointsRequest); // OnResponseSent(response); return new GetEndpointsResponseMessage(response); } catch (Exception e) { Exception fault = CreateSoapFault(request.GetEndpointsRequest, e); // OnResponseFaultSent(fault); throw fault; } }
/// <summary> /// The operation contract for the GetEndpoints service. /// </summary> public virtual GetEndpointsResponseMessage GetEndpoints(GetEndpointsMessage request) { try { SetRequestContext(RequestEncoding.Xml); GetEndpointsResponse response = (GetEndpointsResponse)GetEndpoints(request.GetEndpointsRequest); return new GetEndpointsResponseMessage(response); } catch (Exception e) { throw CreateSoapFault(request.GetEndpointsRequest, e); } }
/// <summary> /// Returns the endpoints supported by the server. /// </summary> public GetEndpointsResponseMessage GetEndpoints(GetEndpointsMessage request) { lock (m_lock) { // update the list of supported endpoints by looking in the service description associated with the host. InitializeApplicationDescription(); GetEndpointsResponseMessage response = new GetEndpointsResponseMessage(); response.ResponseHeader = CreateResponseHeader(request.RequestHeader); response.Endpoints = new ListOfEndpointDescription(); // only return endpoints which support the request transport profile. foreach (EndpointDescription endpoint in m_endpoints) { bool filtered = false; if (request.ProfileUris != null && request.ProfileUris.Count != 0) { filtered = true; foreach (string profileUri in request.ProfileUris) { if (profileUri == endpoint.TransportProfileUri) { filtered = false; break; } } } // return an empty list if none found. if (!filtered) { response.Endpoints.Add(endpoint); } } return response; } }