예제 #1
0
        private short NotifyImpl(string clientId, string msg)
        {
            if (Init())
            {
                SendResponseType result = _ws.Send(clientId.Trim(), msg);
                switch (result)
                {
                case SendResponseType.OK:
                    SetError(0);
                    break;

                case SendResponseType.SessionNotFound:
                    SetError(2);
                    break;

                case SendResponseType.SessionInvalid:
                    SetError(3);
                    break;

                case SendResponseType.SendFailed:
                    SetError(4);
                    break;

                default:
                    break;
                }
            }
            return(_errCode);
        }
예제 #2
0
        public SendResponseType Send(string clientId, string message)
        {
            SendResponseType result = SendResponseType.SessionNotFound;
            var Sockets             = clientsWS.Where(ws => GetClientKey((WSHandler)ws) == clientId);

            foreach (WSHandler socket in Sockets)
            {
                if (socket.WebSocketContext.IsClientConnected)
                {
                    socket.Send(message);
                    LogDebug($"Send - Message sent to client '{clientId}'");
                    result = SendResponseType.OK;
                }
                else
                {
                    LogError($"Send - Web Socket connection has been closed. Could not send message '{clientId}'");
                    result = SendResponseType.SessionInvalid;
                }
            }

            if (result == SendResponseType.SessionNotFound)
            {
                LogError(String.Format("Send - WebSocket Session Id: '{0}' was not found", clientId));
            }
            return(result);
        }
예제 #3
0
        public static ResponseReturnType Consult(this GlobalMedicalFileConsultationPortTypeClient client, CommonInputType common, RoutingType routing, BlobType detail)
        {
            SendRequestType request = new SendRequestType();

            request.CommonInput = common;
            request.Routing     = routing;
            request.Detail      = detail;
            //No xades required

            SendResponseType response = client.consultGlobalMedicalFile(request);

            if (response.Status.Code != "200")
            {
                throw new InvalidOperationException(String.Format("eHealth returned the following status: {0}, {1}", response.Status.Code, response.Status.Message[0].Value));
            }

            //No xades returned

            return(response.Return);
        }