public manageProviderOrganisationResult ManageProviderOrganisation(manageProviderOrganisation manageProviderOrganisation)
        {
            manageProviderOrganisationResponse response = null;

            try
            {
                var sig = new SignatureContainerType();

                var timestamp = new TimestampType()
                {
                    created          = DateTime.Now,
                    expires          = DateTime.Now.AddDays(30),
                    expiresSpecified = true
                };

                response = providerSearchForProviderOrganisationClient.manageProviderOrganisation(ref _product,
                                                                                                  ref sig, timestamp, _user, manageProviderOrganisation);
            }
            catch (Exception ex)
            {
                // Catch generic FaultException and call helper to throw a more specific fault
                // (FaultException<ServiceMessagesType>
                FaultHelper.ProcessAndThrowFault <ServiceMessagesType>(ex);
            }


            if (response != null && response.manageProviderOrganisationResult != null)
            {
                return(response.manageProviderOrganisationResult);
            }
            else
            {
                throw new ApplicationException(Properties.Resources.UnexpectedServiceResponse);
            }
        }
예제 #2
0
        public void Sample()
        {
            // ------------------------------------------------------------------------------
            // Set up
            // ------------------------------------------------------------------------------

            // Obtain the certificate by serial number
            X509Certificate2 tlsCert = X509CertificateUtil.GetCertificate(
                "Serial Number",
                X509FindType.FindBySerialNumber,
                StoreName.My,
                StoreLocation.CurrentUser,
                true
                );

            // The same certificate is used for signing the request.
            // This certificate will be different to TLS cert for some operations.
            X509Certificate2 signingCert = tlsCert;

            // Set up client product information (PCIN)
            // Values below should be provided by Medicare
            ProductType product = new ProductType()
            {
                platform       = "Your system platform (Eg. Windows XP SP3)", // Can be any value
                productName    = "Product Name",                              // Provided by Medicare
                productVersion = "Product Version",                           // Provided by Medicare
                vendor         = new QualifiedId()
                {
                    id        = "Vendor Id",       // Provided by Medicare
                    qualifier = "Vendor Qualifier" // Provided by Medicare
                }
            };

            // Set up user identifier details
            QualifiedId user = new QualifiedId()
            {
                id        = "User Id", // User ID internal to your system
                qualifier = "http://<anything>/id/<anything>/userid/1.0"
                                       // Eg: http://ns.yourcompany.com.au/id/yoursoftware/userid/1.0
            };

            // Set up user identifier details
            QualifiedId hpio = new QualifiedId()
            {
                id        = "HPIO", // HPIO internal to your system
                qualifier = "http://<anything>/id/<anything>/hpio/1.0"
                                    // Eg: http://ns.yourcompany.com.au/id/yoursoftware/userid/1.0
            };

            // ------------------------------------------------------------------------------
            // Client instantiation and invocation
            // ------------------------------------------------------------------------------

            // Create the request
            var directoryEntry = new manageProviderOrganisation()
            {
                hpioNumber = "http://<anything>/id/<anything>/hpio/1.0/HPIO",
                endpointLocatorServiceRecord = new[]
                {
                    new EndpointLocatorServiceRecord()
                    {
                        serviceIdentity = "<yourserviceidentity>",
                        serviceAddress  = "<yourserviceaddress>",
                    },
                }
            };

            // Instantiate the client
            using (var client = new ProviderManageProviderOrganisationClient(new Uri("https://HIServiceEndpoint"), product, user, hpio, signingCert, tlsCert))
            {
                // Submit the request
                try
                {
                    manageProviderOrganisationResult response = client.ManageProviderOrganisation(directoryEntry);
                }
                catch (Exception ex)
                {
                    // If an error is encountered, client.LastSoapResponse often provides a more
                    // detailed description of the error.
                    string soapResponse = client.SoapMessages.SoapResponse;
                }
            }
        }