public void Run(string[] args)
        {
            // Relaxes code vocabulary code checks.
            DefaultCodeResolutionConfigurator.ConfigureCodeResolversWithTrivialDefault();

            // a bit of a hack here - we need to force the MR2009 assembly to load into memory
            Assembly.Load("message-builder-release-r02_04_02");

            MessageValidator.Validate(HelloWorldApp.ReadResourceFile("Resources.PRPA_EX101104CA_validation.xml"), HelloWorldApp.MBSpecificationVersion);

            Console.WriteLine("\nDone validation. Press any key to exit.");
            Console.ReadLine();
        }
Beispiel #2
0
        protected string SubmitRequest(IInteraction msg,
                                       CredentialsProvider credentials,
                                       ServiceType serviceType)
        {
            string xmlRequest = this.ConvertMessageObjectToXML(msg);

            xmlRequest = Beautify(xmlRequest);

            Console.WriteLine("\nRequest Message (in XML):\n");
            Console.WriteLine(xmlRequest);

            // Use Message Builder validator to validate the message
            MessageValidator.Validate(xmlRequest, MBSpecificationVersion);

            string xmlResponse = "<null/>";

            switch (serviceType)
            {
            case ServiceType.SIMULATED:
                if (responseExampleResourceFileName != null)
                {
                    Console.WriteLine("Deserializing example XML response from resource bundle: {0}\n", responseExampleResourceFileName);
                    xmlResponse = HelloWorldApp.ReadResourceFile(responseExampleResourceFileName);
                    return(xmlResponse);
                }
                else
                {
                    Console.WriteLine("No example XML response is specified");
                    Environment.Exit(1);
                }
                break;

            case ServiceType.SOAP:
                xmlResponse = this.SubmitSoapServiceRequest(xmlRequest, credentials);
                break;

            case ServiceType.REST:
                xmlResponse = this.SubmitRestServiceRequest(xmlRequest, credentials);
                break;

            default:
                Console.WriteLine("No service type specified in command-line");
                Environment.Exit(1);
                break;
            }

            return(xmlResponse);
        }
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                Console.WriteLine("Program Main()");
                DomainChoice  domainChosen = DomainChoiceFor(args[0]);
                HelloWorldApp app          = null;
                switch (domainChosen)
                {
                case DomainChoice.CR:
                    app = new FindCandidatesQueryApp();
                    break;

                case DomainChoice.IMM:
                    app = new ImmunizationQueryApp();
                    break;

                case DomainChoice.LAB:
                    app = new LabResultsQueryApp();
                    break;

                case DomainChoice.DRUG:
                    app = new DrugPrescriptionQueryApp();
                    break;

                case DomainChoice.VAL:
                    new MessageValidator().Run(args);
                    break;
                }
                if (app != null)
                {
                    app.Run(args);
                }
            }
            Console.WriteLine("Done");
        }