/// <summary> /// Retrieve a list of Transport Responses. /// </summary> /// <param name="retrieveRequest">The parameters for the retrieve operation.</param> /// <param name="endpointUrl">The endpoint URL for the TRR service.</param> /// <returns>A list of available responses.</returns> public TransportResponseListType Retrieve(retrieve retrieveRequest, Uri endpointUrl) { Validation.ValidateArgumentRequired("retrieveRequest", retrieveRequest); Validation.ValidateArgumentRequired("endpointUrl", endpointUrl); Validation.ValidateArgumentRequired("retrieveRequest.organisation", retrieveRequest.organisation); if (trrClient is Nehta.SMD2010.TRR.TransportResponseRetrievalClient) { Nehta.SMD2010.TRR.TransportResponseRetrievalClient client = (Nehta.SMD2010.TRR.TransportResponseRetrievalClient)trrClient; client.Endpoint.Address = new EndpointAddress(endpointUrl); } retrieveRequest request = new retrieveRequest(); request.retrieve = retrieveRequest; retrieveResponse1 response = trrClient.retrieve(request); if (response != null && response.retrieveResponse != null) { return(response.retrieveResponse.list); } else { throw new ApplicationException(Properties.Resources.UnexpectedServiceResponse); } }
/// <summary> /// Initializes an instance of the TransportResponseRetrievalClient. /// </summary> /// <param name="configurationName">Endpoint configuration name for the SMR endpoint.</param> /// <param name="tlsCert">The client certificate to be used to establish the TLS connection.</param> private void InitializeClient(string configurationName, X509Certificate2 tlsCert) { this.trrMessages = new SoapInspector.SoapMessages(); Nehta.SMD2010.TRR.TransportResponseRetrievalClient client = null; if (!string.IsNullOrEmpty(configurationName)) { client = new Nehta.SMD2010.TRR.TransportResponseRetrievalClient(configurationName); } else { EndpointAddress address = new EndpointAddress("http://ns.electronichealth.net.au"); CustomBinding tlsBinding = GetBinding(); client = new Nehta.SMD2010.TRR.TransportResponseRetrievalClient(tlsBinding, address); } if (client != null) { SoapInspector.InspectEndpoint(client.Endpoint, trrMessages); client.ClientCredentials.ClientCertificate.Certificate = tlsCert; trrClient = client; } }