Example #1
0
        private ICompiledExpressionRoot GetCompiledExpressionRoot()
        {
            if (this.rootInstance != null && this.rootInstance.Activity != null)
            {
                ICompiledExpressionRoot compiledExpressionRoot;
                Activity rootActivity = this.rootInstance.Activity;

                if (QualifiedId.TryGetElementFromRoot(rootActivity, this.compiledRootActivityQualifiedId, out Activity compiledRootActivity) &&
                    QualifiedId.TryGetElementFromRoot(rootActivity, this.expressionActivityQualifiedId, out Activity expressionActivity))
                {
                    if (CompiledExpressionInvoker.TryGetCompiledExpressionRoot(expressionActivity, compiledRootActivity, out compiledExpressionRoot))
                    {
                        //
                        // Revalidate to make sure we didn't hit an ID shift
                        if (compiledExpressionRoot.CanExecuteExpression(this.expressionText, true /* this is always a reference */, this.locationReferences, out this.expressionId))
                        {
                            return(compiledExpressionRoot);
                        }
                    }
                }
                //
                // We were valid when this location was generated so an ID shift occurred (likely due to a dynamic update)
                // Need to search all of the ICERs for one that can execute this expression.
                if (FindCompiledExpressionRoot(rootActivity, out compiledExpressionRoot))
                {
                    return(compiledExpressionRoot);
                }
            }
            throw FxTrace.Exception.AsError(new InvalidOperationException(SR.UnableToLocateCompiledLocationContext(this.expressionText)));
        }
Example #2
0
            public void Throw(string detail)
            {
                QualifiedId id = null;

                if (this.currentIdSpace != null && this.currentIdSpace.Count > 0)
                {
                    int[] idSegments = new int[this.currentIdSpace.Count];
                    for (int i = idSegments.Length - 1; i >= 0; i--)
                    {
                        idSegments[i] = this.currentIdSpace.Pop();
                    }
                    id = new QualifiedId(idSegments);
                }

                string errorMessage;

                if (id == null)
                {
                    errorMessage = SR.InvalidRootMergeMap(this.MapIndex, detail);
                }
                else
                {
                    errorMessage = SR.InvalidMergeMap(this.MapIndex, id, detail);
                }

                throw FxTrace.Exception.Argument("maps", errorMessage);
            }
Example #3
0
        public static AstExpr ExprFor(this IAstFactory factory, ISourcePosition position, QualifiedId qualifiedId,
            ISymbolView<Symbol> scope)
        {
            var currentScope = scope;
            for (var i = 0; i < qualifiedId.Count; i++)
            {
                // Lookup name part
                Symbol sym;
                if (!currentScope.TryGet(qualifiedId[i], out sym))
                {
                    return new AstUnresolved(position, qualifiedId[i]);
                }

                var expr = factory.ExprFor(position, sym);

                // last part of qualified ID does not need to be a namespace, so we're done here
                if (i == qualifiedId.Count - 1)
                    return expr;

                var nsUsage = expr as AstNamespaceUsage;
                if (nsUsage == null)
                {
                    factory.ReportMessage(Message.Error(
                        string.Format(Resources.Parser_NamespaceExpected, qualifiedId[i], sym),
                        position, MessageClasses.NamespaceExcepted));
                    return factory.IndirectCall(position, factory.Null(position));
                }

                currentScope = nsUsage.Namespace;
            }

            throw new InvalidOperationException("Failed to resolve qualified Id (program control should never reach this point)");
        }
Example #4
0
        // Deserialization of string encoding format.
        static WorkflowSymbol ParseStringRepresentation(string symbolString, byte[] checksum)
        {
            string[] s          = symbolString.Split(';');
            int      numSymbols = s.Length - 1;

            ActivitySymbol[] symbols = new ActivitySymbol[numSymbols];
            for (int i = 0; i < numSymbols; ++i)
            {
                string[] symbolSegments = s[i + 1].Split(',');
                Fx.Assert(symbolSegments.Length == 5, "Invalid activity symbol");
                symbols[i] = new ActivitySymbol
                {
                    QualifiedId = QualifiedId.Parse(symbolSegments[0]).AsByteArray(),
                    StartLine   = int.Parse(symbolSegments[1], CultureInfo.InvariantCulture),
                    StartColumn = int.Parse(symbolSegments[2], CultureInfo.InvariantCulture),
                    EndLine     = int.Parse(symbolSegments[3], CultureInfo.InvariantCulture),
                    EndColumn   = int.Parse(symbolSegments[4], CultureInfo.InvariantCulture)
                };
            }

            return(new WorkflowSymbol
            {
                FileName = s[0],
                Symbols = symbols,
                checksum = checksum
            });
        }
Example #5
0
        public void LoadActivityTree(Activity rootActivity, System.Activities.ActivityInstance rootInstance, List <System.Activities.ActivityInstance> secondaryRootInstances, ActivityExecutor executor)
        {
            this.instanceMapping = new Dictionary <Activity, InstanceList>(this.rawDeserializedLists.Length);
            for (int i = 0; i < this.rawDeserializedLists.Length; i++)
            {
                Activity     activity;
                InstanceList list = this.rawDeserializedLists[i];
                if (!QualifiedId.TryGetElementFromRoot(rootActivity, list.ActivityId, out activity))
                {
                    throw FxTrace.Exception.AsError(new InvalidOperationException(System.Activities.SR.ActivityInstanceFixupFailed));
                }
                this.instanceMapping.Add(activity, list);
                list.Load(activity, this);
            }
            this.rawDeserializedLists = null;
            Func <System.Activities.ActivityInstance, ActivityExecutor, bool> callback = new Func <System.Activities.ActivityInstance, ActivityExecutor, bool>(this.OnActivityInstanceLoaded);

            rootInstance.FixupInstance(null, this, executor);
            ActivityUtilities.ProcessActivityInstanceTree(rootInstance, executor, callback);
            if (secondaryRootInstances != null)
            {
                foreach (System.Activities.ActivityInstance instance in secondaryRootInstances)
                {
                    instance.FixupInstance(null, this, executor);
                    ActivityUtilities.ProcessActivityInstanceTree(instance, executor, callback);
                }
            }
        }
Example #6
0
 public retrieveSearchForProviderIndividualRequest(nehta.mcaR50.ProviderBatchSearchForProviderIndividual.retrieveSearchForProviderIndividual retrieveSearchForProviderIndividual, ProductType product, TimestampType timestamp, SignatureContainerType signature, QualifiedId user, QualifiedId hpio)
 {
     this.retrieveSearchForProviderIndividual = retrieveSearchForProviderIndividual;
     this.product   = product;
     this.timestamp = timestamp;
     this.signature = signature;
     this.user      = user;
     this.hpio      = hpio;
 }
Example #7
0
 internal DeclarationScope([NotNull] LocalNamespace ns, QualifiedId pathPrefix, [NotNull] SymbolStore store)
 {
     if (ns == null) throw new ArgumentNullException("ns");
     if (store == null)
         throw new ArgumentNullException("store");
         
     _namespace = ns;
     _pathPrefix = pathPrefix;
     _store = store;
 }
Example #8
0
 private protected ToDoItem(Api api, ToDoItemModel model)
 {
     _api = api;
     Type = model.Type.ToApiRepresentedEnum <ToDoType>()
            .Expect(() => new BadApiStateException($"ToDoItem.Type was an unexpected value: {model.Type}"));
     ContextId = model.ContextType.ToLowerInvariant() switch {
         "course" => new QualifiedId(model.CourseId.Expect(), ContextType.Course),
         "group" => new QualifiedId(model.GroupId.Expect(), ContextType.Group),
         _ => throw new BadApiStateException($"ToDoItemModel.ContextType was an unexpected value: {model.ContextType}")
     };
     IgnoreUrl          = model.IgnoreUrl;
     PermanentIgnoreUrl = model.PermanentIgnoreUrl;
 }
Example #9
0
        public void LoadActivityTree(
            Activity rootActivity,
            ActivityInstance?rootInstance,
            List <ActivityInstance> secondaryRootInstances,
            ActivityExecutor executor)
        {
            Fx.Assert(this.rawDeserializedLists != null, "We should always have deserialized some lists.");
            if (this.rawDeserializedLists == null)
            {
                throw new NullReferenceException("We should always have deserialized some lists.");
            }

            this.instanceMapping = new Dictionary <Activity, InstanceList>(this.rawDeserializedLists?.Length ?? 0);

            for (var i = 0; i < this.rawDeserializedLists.Length; i++)
            {
                var list = this.rawDeserializedLists[i];
                if (!QualifiedId.TryGetElementFromRoot(rootActivity, list.ActivityId, out var activity))
                {
                    throw FxTrace.Exception.AsError(new InvalidOperationException(SR.ActivityInstanceFixupFailed));
                }

                this.instanceMapping.Add(activity, list);
                list.Load(activity, this);
            }

            // We need to null this out once we've recreated the dictionary to avoid having out of
            // sync data
            this.rawDeserializedLists = null;

            // then walk our instance list, fixup parent references, and perform basic validation
            var processInstanceCallback = new Func <ActivityInstance, ActivityExecutor, bool>(OnActivityInstanceLoaded);

            rootInstance.FixupInstance(null, this, executor);
            ActivityUtilities.ProcessActivityInstanceTree(rootInstance, executor, processInstanceCallback);

            if (secondaryRootInstances != null)
            {
                foreach (var instance in secondaryRootInstances)
                {
                    instance.FixupInstance(null, this, executor);
                    ActivityUtilities.ProcessActivityInstanceTree(instance, executor, processInstanceCallback);
                }
            }
        }
Example #10
0
        // For most of the time, we need source location for object that appear on XAML.
        // During debugging, however, we must not transform the internal activity to their origin to make sure it stop when the internal activity is about the execute
        // Therefore, in debugger scenario, translateInternalActivityToOrigin will be set to false.
        internal static Dictionary <object, SourceLocation> GetSourceLocations(Activity rootActivity, WorkflowSymbol symbol, bool translateInternalActivityToOrigin)
        {
            Activity workflowRoot = rootActivity.RootActivity ?? rootActivity;

            if (!workflowRoot.IsMetadataFullyCached)
            {
                IList <ValidationError> validationErrors = null;
                ActivityUtilities.CacheRootMetadata(workflowRoot, new ActivityLocationReferenceEnvironment(), ProcessActivityTreeOptions.ValidationOptions, null, ref validationErrors);
            }

            Dictionary <object, SourceLocation> newMapping = new Dictionary <object, SourceLocation>();

            // Make sure the qid we are using to TryGetElementFromRoot
            // are shifted appropriately such that the first digit that QID is
            // the same as the last digit of the rootActivity.QualifiedId.

            int[] rootIdArray = rootActivity.QualifiedId.AsIDArray();
            int   idOffset    = rootIdArray[rootIdArray.Length - 1] - 1;

            foreach (ActivitySymbol actSym in symbol.Symbols)
            {
                QualifiedId qid = new QualifiedId(actSym.QualifiedId);
                if (idOffset != 0)
                {
                    int[] idArray = qid.AsIDArray();
                    idArray[0] += idOffset;
                    qid         = new QualifiedId(idArray);
                }
                Activity activity;
                if (QualifiedId.TryGetElementFromRoot(rootActivity, qid, out activity))
                {
                    object origin = activity;
                    if (translateInternalActivityToOrigin && activity.Origin != null)
                    {
                        origin = activity.Origin;
                    }

                    newMapping.Add(origin,
                                   new SourceLocation(symbol.FileName, symbol.GetChecksum(), actSym.StartLine, actSym.StartColumn, actSym.EndLine, actSym.EndColumn));
                }
            }
            return(newMapping);
        }
        /// <summary>
        /// Initializes an instance of the ConsumerSearchIHIBatchSyncClient.
        /// </summary>
        /// <param name="endpointUrl">Web service endpoint for Medicare's consumer IHI batch search service.</param>
        /// <param name="endpointConfigurationName">Endpoint configuration name for the ConsumerSearchIHIBatchSync endpoint.</param>
        /// <param name="product">PCIN (generated by Medicare) and platform name values.</param>
        /// <param name="user">Identifier for the application that is calling the service.</param>
        /// <param name="signingCert">Certificate to sign the soap message with.</param>
        /// <param name="tlsCert">Certificate for establishing TLS connection to the HI service.</param>
        /// <param name="hpio">Identifer for the organisation</param>
        private void InitializeClient(string endpointUrl, string endpointConfigurationName, X509Certificate2 signingCert, X509Certificate2 tlsCert, ProductType product, QualifiedId user, QualifiedId hpio)
        {
            Utility.SetUpMapping();

            Validation.ValidateArgumentRequired("product", product);
            Validation.ValidateArgumentRequired("user", user);
            Validation.ValidateArgumentRequired("signingCert", signingCert);
            Validation.ValidateArgumentRequired("tlsCert", tlsCert);

            this.product = product;
            this.user    = user;
            this.hpio    = hpio;

            SoapMessages = new HIEndpointProcessor.SoapMessages();

            ConsumerSearchIHIBatchSyncPortTypeClient client = null;

            if (!string.IsNullOrEmpty(endpointUrl))
            {
                EndpointAddress address    = new EndpointAddress(endpointUrl);
                CustomBinding   tlsBinding = GetBinding();

                client = new ConsumerSearchIHIBatchSyncPortTypeClient(tlsBinding, address);
            }
            else if (!string.IsNullOrEmpty(endpointConfigurationName))
            {
                client = new ConsumerSearchIHIBatchSyncPortTypeClient(endpointConfigurationName);
            }

            if (client != null)
            {
                HIEndpointProcessor.ProcessEndpoint(client.Endpoint, signingCert, SoapMessages);

                if (tlsCert != null)
                {
                    client.ClientCredentials.ClientCertificate.Certificate = tlsCert;
                }

                ihiBatchClient = client;
            }
        }
        private void InitializeClient(string endpointUrl, string endpointConfigurationName, X509Certificate2 signingCert,
                                      X509Certificate2 tlsCert, ProductType clientProduct, QualifiedId clientUser)
        {
            Validation.ValidateArgumentRequired("product", clientProduct);
            Validation.ValidateArgumentRequired("user", clientUser);
            Validation.ValidateArgumentRequired("signingCert", signingCert);
            Validation.ValidateArgumentRequired("tlsCert", tlsCert);

            this.product = clientProduct;
            this.user    = clientUser;

            SoapMessages = new HIEndpointProcessor.SoapMessages();

            ProviderManageProviderDirectoryEntryPortTypeClient client = null;

            if (!string.IsNullOrEmpty(endpointUrl))
            {
                var address    = new EndpointAddress(endpointUrl);
                var tlsBinding = GetBinding();

                client = new ProviderManageProviderDirectoryEntryPortTypeClient(tlsBinding, address);
            }
            else if (!string.IsNullOrEmpty(endpointConfigurationName))
            {
                client = new ProviderManageProviderDirectoryEntryPortTypeClient(endpointConfigurationName);
            }

            if (client != null)
            {
                HIEndpointProcessor.ProcessEndpoint(client.Endpoint, signingCert, SoapMessages);

                if (tlsCert != null)
                {
                    client.ClientCredentials.ClientCertificate.Certificate = tlsCert;
                }

                providerDirectoryEntryClient = client;
            }
        }
Example #13
0
        public void LoadActivityTree(Activity rootActivity, ActivityInstance rootInstance, List <ActivityInstance> secondaryRootInstances, ActivityExecutor executor)
        {
            Fx.Assert(_rawDeserializedLists != null, "We should always have deserialized some lists.");

            _instanceMapping = new Dictionary <Activity, InstanceList>(_rawDeserializedLists.Length);

            for (int i = 0; i < _rawDeserializedLists.Length; i++)
            {
                InstanceList list = _rawDeserializedLists[i];
                Activity     activity;
                if (!QualifiedId.TryGetElementFromRoot(rootActivity, list.ActivityId, out activity))
                {
                    throw Microsoft.CoreWf.Internals.FxTrace.Exception.AsError(new InvalidOperationException(SR.ActivityInstanceFixupFailed));
                }
                _instanceMapping.Add(activity, list);
                list.Load(activity, this);
            }

            // We need to null this out once we've recreated the dictionary to avoid
            // having out of sync data
            _rawDeserializedLists = null;

            // then walk our instance list, fixup parent references, and perform basic validation
            Func <ActivityInstance, ActivityExecutor, bool> processInstanceCallback = new Func <ActivityInstance, ActivityExecutor, bool>(OnActivityInstanceLoaded);

            rootInstance.FixupInstance(null, this, executor);
            ActivityUtilities.ProcessActivityInstanceTree(rootInstance, executor, processInstanceCallback);

            if (secondaryRootInstances != null)
            {
                foreach (ActivityInstance instance in secondaryRootInstances)
                {
                    instance.FixupInstance(null, this, executor);
                    ActivityUtilities.ProcessActivityInstanceTree(instance, executor, processInstanceCallback);
                }
            }
        }
Example #14
0
 public NamespaceImport(QualifiedId namespaceId, [NotNull] ISourcePosition position)
 {
     if (position == null) 
         throw new ArgumentNullException("position");
     _namespaceId = namespaceId;
     _position = position;
 }
        /// <summary>
        /// Initializes an instance of the ConsumerCreateVerifiedIhi.
        /// </summary>
        /// <param name="endpointConfigurationName">Endpoint configuration name for the Create Verified Ihi endpoint.</param>
        /// <param name="product">PCIN (generated by Medicare) and platform name values.</param>
        /// <param name="user">Identifier for the application that is calling the service.</param>
        /// <param name="signingCert">Certificate to sign the soap message with.</param>
        /// <param name="tlsCert">Certificate for establishing TLS connection to the HI service.</param>
        public ConsumerCreateVerifiedIHIClient(string endpointConfigurationName, ProductType product, QualifiedId user, QualifiedId hpio, X509Certificate2 signingCert, X509Certificate2 tlsCert)
        {
            Validation.ValidateArgumentRequired("endpointConfigurationName", endpointConfigurationName);

            InitializeClient(null, endpointConfigurationName, signingCert, tlsCert, product, user, hpio);
        }
        // For most of the time, we need source location for object that appear on XAML.
        // During debugging, however, we must not transform the internal activity to their origin to make sure it stop when the internal activity is about the execute
        // Therefore, in debugger scenario, translateInternalActivityToOrigin will be set to false.
        internal static Dictionary<object, SourceLocation> GetSourceLocations(Activity rootActivity, WorkflowSymbol symbol, bool translateInternalActivityToOrigin)
        {
            Activity workflowRoot = rootActivity.RootActivity ?? rootActivity;
            if (!workflowRoot.IsMetadataFullyCached)
            {
                IList<ValidationError> validationErrors = null;
                ActivityUtilities.CacheRootMetadata(workflowRoot, new ActivityLocationReferenceEnvironment(), ProcessActivityTreeOptions.ValidationOptions, null, ref validationErrors);
            }

            Dictionary<object, SourceLocation> newMapping = new Dictionary<object, SourceLocation>();

            // Make sure the qid we are using to TryGetElementFromRoot
            // are shifted appropriately such that the first digit that QID is
            // the same as the last digit of the rootActivity.QualifiedId.

            int[] rootIdArray = rootActivity.QualifiedId.AsIDArray();
            int idOffset = rootIdArray[rootIdArray.Length - 1] - 1;

            foreach (ActivitySymbol actSym in symbol.Symbols)
            {
                QualifiedId qid = new QualifiedId(actSym.QualifiedId);
                if (idOffset != 0)
                {
                    int[] idArray = qid.AsIDArray();
                    idArray[0] += idOffset;
                    qid = new QualifiedId(idArray);
                }
                Activity activity;
                if (QualifiedId.TryGetElementFromRoot(rootActivity, qid, out activity))
                {
                    object origin = activity;
                    if (translateInternalActivityToOrigin && activity.Origin != null)
                    {
                        origin = activity.Origin;
                    }

                    newMapping.Add(origin,
                        new SourceLocation(symbol.FileName, symbol.GetChecksum(), actSym.StartLine, actSym.StartColumn, actSym.EndLine, actSym.EndColumn));
                }
            }
            return newMapping;
        }
Example #17
0
 public nehta.mcaR50.ProviderBatchSearchForProviderIndividual.retrieveSearchForProviderIndividualResponse retrieveSearchForProviderIndividual(nehta.mcaR50.ProviderBatchSearchForProviderIndividual.retrieveSearchForProviderIndividual retrieveSearchForProviderIndividual1, ref ProductType product, TimestampType timestamp, ref SignatureContainerType signature, QualifiedId user, QualifiedId hpio)
 {
     nehta.mcaR50.ProviderBatchSearchForProviderIndividual.retrieveSearchForProviderIndividualRequest inValue = new nehta.mcaR50.ProviderBatchSearchForProviderIndividual.retrieveSearchForProviderIndividualRequest();
     inValue.retrieveSearchForProviderIndividual = retrieveSearchForProviderIndividual1;
     inValue.product   = product;
     inValue.timestamp = timestamp;
     inValue.signature = signature;
     inValue.user      = user;
     inValue.hpio      = hpio;
     nehta.mcaR50.ProviderBatchSearchForProviderIndividual.retrieveSearchForProviderIndividualResponse1 retVal = ((nehta.mcaR50.ProviderBatchSearchForProviderIndividual.SearchForProviderIndividualBatchAsyncPortType)(this)).retrieveSearchForProviderIndividual(inValue);
     product   = retVal.product;
     signature = retVal.signature;
     return(retVal.retrieveSearchForProviderIndividualResponse);
 }
        /// <summary>
        /// Initializes an instance of the ConsumerCreateVerifiedIhi.
        /// </summary>
        /// <param name="endpointUri">Web service endpoint for Medicare's consumer Create Verified Ihi service.</param>
        /// <param name="product">PCIN (generated by Medicare) and platform name values.</param>
        /// <param name="user">Identifier for the application that is calling the service.</param>
        /// <param name="signingCert">Certificate to sign the soap message with.</param>
        /// <param name="tlsCert">Certificate for establishing TLS connection to the HI service.</param>
        public ConsumerCreateVerifiedIHIClient(Uri endpointUri, ProductType product, QualifiedId user, QualifiedId hpio, X509Certificate2 signingCert, X509Certificate2 tlsCert)
        {
            Validation.ValidateArgumentRequired("endpointUri", endpointUri);

            InitializeClient(endpointUri.ToString(), null, signingCert, tlsCert, product, user, hpio);
        }
Example #19
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 ID 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
            // ------------------------------------------------------------------------------

            // Instantiate the client
            ProviderReadReferenceDataClient client = new ProviderReadReferenceDataClient(
                new Uri("https://HIServiceEndpoint"),
                product,
                user,
                hpio,
                signingCert,
                tlsCert);

            try
            {
                // Invokes the read operation
                readReferenceDataResponse readReferenceDataResponse =
                    client.ReadReferenceData(new string[]
                {
                    "providerTypeCode",
                    "providerSpecialty",
                    "providerSpecialisation",
                    "organisationTypeCode",
                    "organisationService",
                    "organisationServiceUnit",
                });
            }
            catch (FaultException fex)
            {
                string       returnError = "";
                MessageFault fault       = fex.CreateMessageFault();
                if (fault.HasDetail)
                {
                    ServiceMessagesType error = fault.GetDetail <ServiceMessagesType>();
                    // Look at error details in here
                    if (error.serviceMessage.Length > 0)
                    {
                        returnError = error.serviceMessage[0].code + ": " + error.serviceMessage[0].reason;
                    }
                }

                // If an error is encountered, client.LastSoapResponse often provides a more
                // detailed description of the error.
                string soapResponse = client.SoapMessages.SoapResponse;
            }
            catch (Exception ex)
            {
                // If an error is encountered, client.LastSoapResponse often provides a more
                // detailed description of the error.
                string soapResponse = client.SoapMessages.SoapResponse;
            }
        }
        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
            };

            // ------------------------------------------------------------------------------
            // Call the read interface
            // ------------------------------------------------------------------------------

            // Read the existing values from HI
            ProviderDirectoryOrganisationEntryRecord providerDetails = null;

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

            // Instantiate the client
            var client = new ProviderManageProviderDirectoryEntryClient(
                new Uri("https://HIServiceEndpoint"),
                product,
                user,
                signingCert,
                tlsCert);

            // Create the request
            var directoryEntry = new manageProviderDirectoryEntry();

            // Set the items to the published based on the IDs used from the 'read' operation
            var organisationEntryRecord = new ProviderDirectoryOrganisationEntryRecord();

            organisationEntryRecord.externalIdentifier          = (providerDetails != null ? providerDetails.externalIdentifier : 0);
            organisationEntryRecord.externalIdentifierSpecified = (providerDetails != null ? true : false);
            organisationEntryRecord.displayPrivateDetails       = (providerDetails != null ? providerDetails.displayPrivateDetails : false);;
            organisationEntryRecord.priorityNumber = (providerDetails != null ? providerDetails.priorityNumber : 1);
            organisationEntryRecord.display        = true;
            organisationEntryRecord.electronicCommunicationExternalId = (providerDetails != null ? providerDetails.electronicCommunicationExternalId : null);
            organisationEntryRecord.organisationServiceExternalId     = (providerDetails != null ? providerDetails.organisationServiceExternalId : null);

            organisationEntryRecord.nameExternalId    = providerDetails.nameExternalId;
            organisationEntryRecord.addressExternalId = providerDetails.addressExternalId;
            organisationEntryRecord.endpointLocatorServiceExternalId = providerDetails.endpointLocatorServiceExternalId;

            directoryEntry.organisationEntry = new[] { organisationEntryRecord };


            // Submit the request
            try
            {
                manageProviderDirectoryEntryResponse response = client.ManageProviderDirectoryEntry(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;
            }
        }
Example #21
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;
                }
            }
        }
 private static void AddBlockingActivity(ref Collection <ActivityBlockingUpdate> updateErrors, DynamicUpdateMap.UpdatedActivity updatedActivity, QualifiedId originalId, string reason, string activityInstanceId)
 {
     if (updatedActivity.NewActivity != null)
     {
         ActivityBlockingUpdate.AddBlockingActivity(ref updateErrors, updatedActivity.NewActivity, originalId.ToString(), reason, activityInstanceId);
     }
     else
     {
         string updatedId = updatedActivity.MapEntry.IsRemoval ? null : updatedActivity.NewId.ToString();
         ActivityBlockingUpdate.AddBlockingActivity(ref updateErrors, updatedId, originalId.ToString(), reason, activityInstanceId);
     }
 }
Example #23
0
 public NamespaceDeclarationScope([NotNull] ISourcePosition position, QualifiedId namespacePath)
 {
     if (position == null) throw new ArgumentNullException("position");
     _position = position;
     _namespacePath = namespacePath;
 }
        /// <summary>
        /// Initializes an instance of the provider search client.
        /// </summary>
        /// <param name="endpointUri">Web service endpoint for Medicare's provider search service.</param>
        /// <param name="product">PCIN (generated by Medicare) and platform name values.</param>
        /// <param name="user">Identifier for the application that is calling the service.</param>
        /// <param name="hpio">Identifier for the organisation</param>
        /// <param name="signingCert">Certificate to sign the soap message with.</param>
        /// <param name="tlsCert">Certificate for establishing TLS connection to the service.</param>
        public ProviderSearchHIProviderDirectoryForIndividualClient(Uri endpointUri, ProductType product, QualifiedId user, QualifiedId hpio, X509Certificate2 signingCert, X509Certificate2 tlsCert)
        {
            Validation.ValidateArgumentRequired("endpointUri", endpointUri);

            InitializeClient(endpointUri.ToString(), null, signingCert, tlsCert, product, user, hpio);
        }
        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
            // ------------------------------------------------------------------------------

            // Instantiate the client
            ProviderSearchHIProviderDirectoryForOrganisationClient client = new ProviderSearchHIProviderDirectoryForOrganisationClient(
                new Uri("https://HIServiceEndpoint"),
                product,
                user,
                hpio,
                signingCert,
                tlsCert);

            // Set up the request
            searchHIProviderDirectoryForOrganisation request = new searchHIProviderDirectoryForOrganisation();

            request.hpioNumber = HIQualifiers.HPIOQualifier + "8003624166667003";

            try
            {
                // Invokes an identifier search
                searchHIProviderDirectoryForOrganisationResponse response = client.IdentifierSearch(request);
            }
            catch (Exception ex)
            {
                // If an error is encountered, client.LastSoapResponse often provides a more
                // detailed description of the error.
                string soapResponse = client.SoapMessages.SoapResponse;
            }
        }
        /// <summary>
        /// Initializes an instance of the ProviderReadReferenceDataClient.
        /// </summary>
        /// <param name="endpointUri">Web service endpoint for Medicare's ProviderReadReferenceData Service.</param>
        /// <param name="product">PCIN (generated by Medicare) and platform name values.</param>
        /// <param name="user">Identifier for the application that is calling the service.</param>
        /// <param name="signingCert">Certificate to sign the soap message with.</param>
        /// <param name="tlsCert">Certificate for establishing TLS connection to the HI service.</param>
        public ProviderReadReferenceDataClient(Uri endpointUri, ProductType product, QualifiedId user, QualifiedId hpio, X509Certificate2 signingCert, X509Certificate2 tlsCert)
        {
            Validation.ValidateArgumentRequired("endpointUri", endpointUri);

            InitializeClient(endpointUri.ToString(), null, signingCert, tlsCert, product, user, hpio);
        }
        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        = "OMO", // The OMO of the certificate
                qualifier = "http://<anything>/id/<anything>/userid/1.0"
                                   // Eg: http://ns.medicareaustralia.gov.au/id/hi/distinguishedname/1.0
            };


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

            // Instantiate the client
            var client = new ProviderReadProviderOrganisationClient(
                new Uri("https://HIServiceEndpoint"),
                product,
                user,
                signingCert,
                tlsCert
                );

            // Create the request
            var directoryEntry = new readProviderOrganisation
            {
                hpioNumber     = "http://ns.electronichealth.net.au/id/hi/hpio/1.0/" + "HPIO Number Here",
                linkSearchType = "link Search Type Here"
            };

            // Submit the request
            try
            {
                var response = client.ReadProviderOrganisation(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;
            }
        }
        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
            // ------------------------------------------------------------------------------

            // Instantiate the client
            ConsumerSearchIHIClient client = new ConsumerSearchIHIClient(
                new Uri("https://HIServiceEndpoint"),
                product,
                user,
                hpio,
                signingCert,
                tlsCert);

            // Set up the request
            searchIHI request = new searchIHI();

            request.ihiNumber   = "http://ns.electronichealth.net.au/id/hi/ihi/1.0/8003601240022579";
            request.dateOfBirth = DateTime.Parse("12 Dec 2002");
            request.givenName   = "Jessica";
            request.familyName  = "Wood";
            request.sex         = SexType.F;

            try
            {
                // Invokes a basic search
                searchIHIResponse ihiResponse = client.BasicSearch(request);
            }
            catch (Exception ex)
            {
                // If an error is encountered, client.LastSoapResponse often provides a more
                // detailed description of the error.
                string soapResponse = client.SoapMessages.SoapResponse;
            }
        }
        // targetDefinition argument is optional.
        private IList <InstanceListNeedingUpdate> GetInstanceListsNeedingUpdate(DynamicUpdateMap updateMap, Activity targetDefinition, List <ActivityInstance> secondaryRootInstances, ref Collection <ActivityBlockingUpdate> updateErrors)
        {
            IList <InstanceListNeedingUpdate> instanceListsToUpdate = new List <InstanceListNeedingUpdate>();

            if (this.rawDeserializedLists == null)
            {
                // This instance doesn't have any active instances (it is complete).
                return(instanceListsToUpdate);
            }

            IdSpace rootIdSpace = null;

            if (targetDefinition != null)
            {
                rootIdSpace = targetDefinition.MemberOf;
            }

            for (int i = 0; i < this.rawDeserializedLists.Length; i++)
            {
                InstanceList list           = this.rawDeserializedLists[i];
                QualifiedId  oldQualifiedId = new QualifiedId(list.ActivityId);

                if (updateMap.IsImplementationAsRoot)
                {
                    int[] oldIdArray = oldQualifiedId.AsIDArray();
                    if (oldIdArray.Length == 1 && oldIdArray[0] != 1)
                    {
                        throw FxTrace.Exception.AsError(new InstanceUpdateException(SR.InvalidImplementationAsWorkflowRootForRuntimeState));
                    }
                }

                string error;
                InstanceListNeedingUpdate        update;
                DynamicUpdateMap.UpdatedActivity updatedActivity = updateMap.GetUpdatedActivity(oldQualifiedId, rootIdSpace);

                if (CanCompensationOrConfirmationHandlerReferenceAddedSymbols(list, updateMap, rootIdSpace, secondaryRootInstances, ref updateErrors))
                {
                    update = null;
                }
                else if (updatedActivity.MapEntry == null)
                {
                    if (updatedActivity.IdChanged)
                    {
                        // this newQualifiedId is the new id for those InstanceLists whose IDs shifted by their parents' ID change
                        update = new InstanceListNeedingUpdate
                        {
                            InstanceList = list,
                            NewId        = updatedActivity.NewId
                        };
                    }
                    else
                    {
                        // nothing changed, no map, no mapEntry
                        update = new InstanceListNeedingUpdate
                        {
                            InstanceList = list,
                            NewId        = null,
                        };
                    }
                }
                else if (updatedActivity.MapEntry.IsParentRemovedOrBlocked)
                {
                    update = null;
                }
                else if (IsRemovalOrRTUpdateBlockedOrBlockedByUser(updatedActivity, oldQualifiedId, out error))
                {
                    string instanceId = null;
                    for (int j = 0; j < list.Count; j++)
                    {
                        ActivityInstance activityInstance = list[j] as ActivityInstance;
                        if (activityInstance != null)
                        {
                            instanceId = activityInstance.Id;
                            break;
                        }
                    }
                    AddBlockingActivity(ref updateErrors, updatedActivity, oldQualifiedId, error, instanceId);

                    update = null;
                }
                else if (IsInvalidEnvironmentUpdate(list, updatedActivity, ref updateErrors))
                {
                    update = null;
                }
                else
                {
                    // no validation error for this InstanceList
                    // add it to the list of InstanceLists to be updated
                    update = new InstanceListNeedingUpdate
                    {
                        InstanceList = list,
                        NewId        = updatedActivity.NewId,
                        UpdateMap    = updatedActivity.Map,
                        MapEntry     = updatedActivity.MapEntry,
                        NewActivity  = updatedActivity.NewActivity
                    };
                }

                if (update != null)
                {
                    update.OriginalId = list.ActivityId;
                    instanceListsToUpdate.Add(update);
                }
            }

            return(instanceListsToUpdate);
        }
        /// <summary>
        /// Initializes an instance of the ProviderReadReferenceDataClient.
        /// </summary>
        /// <param name="endpointConfigurationName">Endpoint configuration name for the ProviderReadReferenceData endpoint.</param>
        /// <param name="product">PCIN (generated by Medicare) and platform name values.</param>
        /// <param name="user">Identifier for the application that is calling the service.</param>
        /// <param name="signingCert">Certificate to sign the soap message with.</param>
        /// <param name="tlsCert">Certificate for establishing TLS connection to the HI service.</param>
        public ProviderReadReferenceDataClient(string endpointConfigurationName, ProductType product, QualifiedId user, QualifiedId hpio, X509Certificate2 signingCert, X509Certificate2 tlsCert)
        {
            Validation.ValidateArgumentRequired("endpointConfigurationName", endpointConfigurationName);

            InitializeClient(null, endpointConfigurationName, signingCert, tlsCert, product, user, hpio);
        }
        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
            // ------------------------------------------------------------------------------

            // Instantiate the client
            ConsumerCreateVerifiedIHIClient client = new ConsumerCreateVerifiedIHIClient(
                new Uri("https://HIServiceEndpoint"),
                product,
                user,
                hpio,
                signingCert,
                tlsCert);

            // Set up the request
            createVerifiedIHI request = new createVerifiedIHI();

            request.dateOfBirth = DateTime.Parse("01 Dec 2014");
            request.dateOfBirthAccuracyIndicator = DateAccuracyIndicatorType.AAA;
            request.familyName = "Wood";
            request.givenName  = new [] { "Jessica" };
            request.sex        = SexType.F;
            request.usage      = IndividualNameUsageType.L;
            request.address    = new AddressType();
            request.address.australianStreetAddress = new AustralianStreetAddressType();
            request.address.australianStreetAddress.streetNumber        = "10";
            request.address.australianStreetAddress.streetName          = "Browning Street";
            request.address.australianStreetAddress.streetType          = StreetType.ST;
            request.address.australianStreetAddress.streetTypeSpecified = true;
            request.address.australianStreetAddress.suburb   = "West End";
            request.address.australianStreetAddress.postcode = "4101";
            request.address.australianStreetAddress.state    = StateType.QLD;
            request.address.purpose     = AddressPurposeType.R;
            request.address.preferred   = TrueFalseType.T;
            request.privacyNotification = true;

            try
            {
                // Invokes a basic search
                createVerifiedIHIResponse ihiResponse = client.CreateVerifiedIhi(request);
            }
            catch (FaultException fex)
            {
                string       returnError = "";
                MessageFault fault       = fex.CreateMessageFault();
                if (fault.HasDetail)
                {
                    ServiceMessagesType error = fault.GetDetail <ServiceMessagesType>();
                    // Look at error details in here
                    if (error.serviceMessage.Length > 0)
                    {
                        returnError = error.serviceMessage[0].code + ": " + error.serviceMessage[0].reason;
                    }
                }

                // If an error is encountered, client.LastSoapResponse often provides a more
                // detailed description of the error.
                string soapResponse = client.SoapMessages.SoapResponse;
            }
            catch (Exception ex)
            {
                // If an error is encountered, client.LastSoapResponse often provides a more
                // detailed description of the error.
                string soapResponse = client.SoapMessages.SoapResponse;
            }
        }
        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
            // ------------------------------------------------------------------------------

            // Instantiate the client
            ConsumerSearchIHIBatchSyncClient client = new ConsumerSearchIHIBatchSyncClient(
                new Uri("https://HIServiceEndpoint"),
                product,
                user,
                hpio,
                signingCert,
                tlsCert);

            // Create a list of search requests
            var searches = new List <CommonSearchIHIRequestType>();

            // Add a basic search
            searches.AddBasicSearch(Guid.NewGuid().ToString(), new CommonSearchIHI()
            {
                ihiNumber   = HIQualifiers.IHIQualifier + "8003601240022579",
                dateOfBirth = DateTime.Parse("12 Dec 2002"),
                givenName   = "Jessica",
                familyName  = "Wood",
                sex         = CommonSexType.F
            });

            // Add a basic Medicare search
            searches.AddBasicMedicareSearch(Guid.NewGuid().ToString(), new CommonSearchIHI()
            {
                medicareCardNumber = "2950141861",
                medicareIRN        = "1",
                dateOfBirth        = DateTime.Parse("12 Dec 2002"),
                givenName          = "Jessica",
                familyName         = "Wood",
                sex = CommonSexType.F
            });

            // Add a basic DVA search
            searches.AddBasicDvaSearch(Guid.NewGuid().ToString(), new CommonSearchIHI()
            {
                dvaFileNumber = "N 908030C",
                dateOfBirth   = DateTime.Parse("12 Dec 1970"),
                givenName     = "Luke",
                familyName    = "Lawson",
                sex           = CommonSexType.M
            });

            // Add an Australian street address search
            searches.AddAustralianStreetAddressSearch(Guid.NewGuid().ToString(), new CommonSearchIHI()
            {
                dateOfBirth             = DateTime.Parse("12 Dec 2002"),
                givenName               = "Jessica",
                familyName              = "Wood",
                sex                     = CommonSexType.F,
                australianStreetAddress = new CommonAustralianStreetAddressType()
                {
                    streetNumber        = "21",
                    streetName          = "Ross",
                    streetType          = CommonStreetType.RD,
                    streetTypeSpecified = true,
                    suburb   = "Queanbeyan",
                    state    = CommonStateType.NSW,
                    postcode = "2620"
                }
            });

            try
            {
                // Invokes the batch search
                searchIHIBatchResponse ihiResponse = client.SearchIHIBatchSync(searches);
            }
            catch (FaultException fex)
            {
                string       returnError = "";
                MessageFault fault       = fex.CreateMessageFault();
                if (fault.HasDetail)
                {
                    ServiceMessagesType error = fault.GetDetail <ServiceMessagesType>();
                    // Look at error details in here
                    if (error.serviceMessage.Length > 0)
                    {
                        returnError = error.serviceMessage[0].code + ": " + error.serviceMessage[0].reason;
                    }
                }

                // If an error is encountered, client.LastSoapResponse often provides a more
                // detailed description of the error.
                string soapResponse = client.SoapMessages.SoapResponse;
            }
            catch (Exception ex)
            {
                // If an error is encountered, client.LastSoapResponse often provides a more
                // detailed description of the error.
                string soapResponse = client.SoapMessages.SoapResponse;
            }
        }
Example #33
0
        /// <summary>
        /// Initializes an instance of the provider search client.
        /// </summary>
        /// <param name="endpointUri">Web service endpoint for Medicare's provider search service.</param>
        /// <param name="product">PCIN (generated by Medicare) and platform name values.</param>
        /// <param name="user">Identifier for the application that is calling the service.</param>
        /// <param name="hpio">Identifier for the organisation</param>
        /// <param name="signingCert">Certificate to sign the soap message with.</param>
        /// <param name="tlsCert">Certificate for establishing TLS connection to the service.</param>
        public ProviderBatchAsyncSearchForProviderOrganisationClient(Uri endpointUri, ProductType product, QualifiedId user, QualifiedId hpio, X509Certificate2 signingCert, X509Certificate2 tlsCert)
        {
            Validation.ValidateArgumentRequired("endpointUri", endpointUri);

            InitializeClient(endpointUri.ToString(), null, signingCert, tlsCert, product, user, hpio);
        }
        /// <summary>
        /// Initializes an instance of the provider search client.
        /// </summary>
        /// <param name="endpointConfigurationName">Endpoint configuration name for the provider search endpoint.</param>
        /// <param name="product">PCIN (generated by Medicare) and platform name values.</param>
        /// <param name="user">Identifier for the application that is calling the service.</param>
        /// <param name="hpio">Identifier for the organisation</param>
        /// <param name="signingCert">Certificate to sign the soap message with.</param>
        /// <param name="tlsCert">Certificate for establishing TLS connection to the service.</param>
        public ProviderSearchHIProviderDirectoryForIndividualClient(string endpointConfigurationName, ProductType product, QualifiedId user, QualifiedId hpio, X509Certificate2 signingCert, X509Certificate2 tlsCert)
        {
            Validation.ValidateArgumentRequired("endpointConfigurationName", endpointConfigurationName);

            InitializeClient(null, endpointConfigurationName, signingCert, tlsCert, product, user, hpio);
        }
Example #35
0
        /// <summary>
        /// Initializes an instance of the provider search client.
        /// </summary>
        /// <param name="endpointConfigurationName">Endpoint configuration name for the provider search endpoint.</param>
        /// <param name="product">PCIN (generated by Medicare) and platform name values.</param>
        /// <param name="user">Identifier for the application that is calling the service.</param>
        /// <param name="hpio">Identifier for the organisation</param>
        /// <param name="signingCert">Certificate to sign the soap message with.</param>
        /// <param name="tlsCert">Certificate for establishing TLS connection to the service.</param>
        public ProviderBatchAsyncSearchForProviderOrganisationClient(string endpointConfigurationName, ProductType product, QualifiedId user, QualifiedId hpio, X509Certificate2 signingCert, X509Certificate2 tlsCert)
        {
            Validation.ValidateArgumentRequired("endpointConfigurationName", endpointConfigurationName);

            InitializeClient(null, endpointConfigurationName, signingCert, tlsCert, product, user, hpio);
        }