Exemplo n.º 1
0
        private static void SoapClientProxy()
        {
            //init web service proxy
            PatientServiceProxy serviceProxy = new PatientServiceProxy();

            //init UsernameToken, password is the reverted string of username, the same logic in AuthenticateToken
            //  of ServiceUsernameTokenManager class.
            UsernameToken token = new UsernameToken("pas-appt-ws-user", "pas-appt-ws-user-pwd", PasswordOption.SendPlainText);

            // Set the token onto the proxy
            serviceProxy.SetClientCredential(token);

            // Set the ClientPolicy onto the proxy
            serviceProxy.SetPolicy("ClientPolicy");

            //invoke the HelloMyFriend web service method
            try
            {
                var res = serviceProxy.searchHKPMIPatientByCaseNo(new WebProxy.searchHKPMIPatientByCaseNo
                {
                    caseNo       = "HN03191100Y",
                    hospitalCode = "HV"
                });

                var resStr = XmlHelper.XmlSerializeToString(res);
                Console.WriteLine(resStr);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemplo n.º 2
0
        public void Initialize(string restUri, string userName, string password, string pathospcode)
        {
            this.Url = restUri;
            this.userName = userName;
            this.password = password;
            this.pathospcode = pathospcode;

            patientServiceProxy = new PatientServiceProxy(Url);
        }