Beispiel #1
0
        /// <summary>
        /// Get EndPoint Address with participant validation
        /// </summary>
        /// <param name="recipientParticipant"></param>
        /// <param name="businessIdScheme"></param>
        /// <param name="smlDomain"></param>
        /// <param name="documentIdScheme"></param>
        /// <param name="documentIdValue"></param>
        /// <returns>EndPointAddress if participant exists and has SMP service capabilities</returns>
        public string GetEndPointAddress(string recipientParticipant, string businessIdScheme, string smlDomain, string documentIdScheme, string documentIdValue)
        {
            string endPointAddress = null;

            string smpUrl = BuildSmpUrl(recipientParticipant, businessIdScheme, smlDomain);

            ServiceGroup serviceGroupElements = _serviceGroupParser.GetServiceGroup(smpUrl);

            if (serviceGroupElements != null)
            {
                string smpSignedServiceUrl = BuildSmpSignedServiceUrl(recipientParticipant, businessIdScheme, smlDomain, documentIdScheme, documentIdValue);
                SignedServiceMetadata signedServiceElements = _signedServiceParser.GetSignedService(smpSignedServiceUrl);

                if (signedServiceElements != null)
                {
                    if (signedServiceElements.ServiceMetadata.ServiceInformation == null)
                    {
                        string href = signedServiceElements.ServiceMetadata.Redirect.href;
                        SignedServiceMetadata redirectServiceElements = _signedServiceParser.GetSignedService(href);

                        if (redirectServiceElements != null)
                        {
                            if (redirectServiceElements.ServiceMetadata.Redirect == null)
                            {
                                endPointAddress = redirectServiceElements.ServiceMetadata.ServiceInformation.ProcessList.Process[0].ServiceEndpointList.Endpoint.EndpointReference.Address;
                            }
                            else
                            {
                                throw  new Exception("WARNING: More than one Redirection was found in Metadata for Participant.");
                            }
                        }
                        else
                        {
                            throw new Exception("bden:DocumentTypeNotAccepted - The recipient does not accept documents of this type.");
                        }
                    }
                    else
                    {
                        endPointAddress = signedServiceElements.ServiceMetadata.ServiceInformation.ProcessList.Process[0].ServiceEndpointList.Endpoint.EndpointReference.Address;
                    }
                }
                else
                {
                    throw new Exception("bden:DocumentTypeNotAccepted - The recipient does not accept documents of this type.");
                }
            }
            else
            {
                throw new Exception("bden:ChannelFull - The channel is not accepting messages for this destination.");
            }
            return(endPointAddress);
        }
        /// <summary>
        /// Get SMP Service Group deserialization objects
        /// </summary>
        /// <param name="recipientParticipant"></param>
        /// <param name="businessIdScheme"></param>
        /// <param name="smlDomain"></param>
        /// <returns>serviceGroupElements type of ServiceGroup</returns>
        public ServiceGroup GetServiceGroupObjects(string recipientParticipant, string businessIdScheme, string smlDomain)
        {
            ServiceGroupParser _serviceGroupParser = new ServiceGroupParser();
            string             smpUrl = BuildSmpUrl(recipientParticipant, businessIdScheme, smlDomain);
            ServiceGroup       serviceGroupElements = _serviceGroupParser.GetServiceGroup(smpUrl);

            return(serviceGroupElements);
        }