/// <summary>
        /// self transfer has completed.
        /// </summary>
        /// <param name="asyncResult">Async result.</param>
        private void SelfTransferCompleted(IAsyncResult asyncResult)
        {
            Exception exceptionCaught      = null;
            bool      exceptionEncountered = true;

            try
            {
                m_callbackCall.EndTransfer(asyncResult);
                //Self Transfer has completed. successfully.
                exceptionEncountered = false;
            }
            catch (RealTimeException rte)
            {
                Helper.Logger.Info("Exception = {0}", EventLogger.ToString(rte));
                exceptionCaught = rte;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = null;
                    if (exceptionCaught != null)
                    {
                        operationFault = FaultHelper.CreateClientOperationFault(exceptionCaught.Message, exceptionCaught.InnerException);
                    }
                    else
                    {
                        operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    }

                    this.CompleteEstablishOperationWithException(new FaultException <OperationFault>(operationFault));
                }
            }
        }
        /// <summary>
        /// Overridden process method.
        /// </summary>
        public override void Process()
        {
            bool      exceptionEncountered = true;
            Exception exceptionCaught      = null;

            try
            {
                m_imFlow.BeginSendInstantMessage(m_textBody, this.InstantMessagingSendMessageCompleted, null /*state*/);
                exceptionEncountered = false;
            }
            catch (InvalidOperationException ioe)
            {
                Helper.Logger.Info("Exception = {0}", EventLogger.ToString(ioe));
                exceptionCaught = ioe;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = null;
                    if (exceptionCaught != null)
                    {
                        operationFault = FaultHelper.CreateClientOperationFault(exceptionCaught.Message, exceptionCaught.InnerException);
                    }
                    else
                    {
                        operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    }

                    this.CompleteSendMessageOperationWithException(new FaultException <OperationFault>(operationFault));
                }
            }
        }
        /// <summary>
        /// Establishes back to back call due to incoming self transfer.
        /// </summary>
        /// <param name="b2bCall">Pre populated b2b call. Cannot be null.</param>
        internal void EstablishBackToBackCall(BackToBackCall b2bCall)
        {
            Debug.Assert(null != b2bCall, "B2B call is null");
            Exception exceptionCaught      = null;
            bool      exceptionEncountered = true;

            try
            {
                b2bCall.BeginEstablish(this.BackToBackCallEstablishCompleted, b2bCall /*state*/);
                exceptionEncountered = false;
            }
            catch (InvalidOperationException ioe)
            {
                Helper.Logger.Info("Exception = {0}", EventLogger.ToString(ioe));
                exceptionCaught = ioe;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = null;
                    if (exceptionCaught != null)
                    {
                        operationFault = FaultHelper.CreateClientOperationFault(exceptionCaught.Message, exceptionCaught.InnerException);
                    }
                    else
                    {
                        operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    }
                    this.CompleteEstablishOperationWithException(new FaultException <OperationFault>(operationFault));
                }
            }
        }
        /// <summary>
        /// Terminate Im call.
        /// </summary>
        private void TerminateInstantMessagingCall()
        {
            bool exceptionEncountered = true;

            try
            {
                InstantMessagingCall imCall    = null;
                WebImCall            webImCall = m_webConversation.WebImCall;
                if (webImCall != null)
                {
                    imCall = webImCall.ImCall;
                }
                if (imCall != null)
                {
                    imCall.BeginTerminate(this.InstantMessagingCallTerminated, imCall);
                }
                else
                {
                    //Go to next step of terminating av call.
                    this.TerminateAudioVideoCall();
                }

                exceptionEncountered = false;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    this.CompleteTerminateConversationOperationWithException(new FaultException <OperationFault>(operationFault));
                }
            }
        }
        /// <summary>
        /// Terminate conversation.
        /// </summary>
        private void TerminateConversation()
        {
            bool exceptionEncountered = true;

            try
            {
                Conversation conversation = m_webConversation.Conversation;
                if (conversation != null)
                {
                    conversation.BeginTerminate(this.ConversationTerminated, conversation);
                }
                else
                {
                    this.TerminationWorkCompleted();
                }

                exceptionEncountered = false;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    this.CompleteTerminateConversationOperationWithException(new FaultException <OperationFault>(operationFault));
                }
            }
        }
        /// <summary>
        /// Terminate b2b call.
        /// </summary>
        private void TerminateBackToBackCall()
        {
            bool exceptionEncountered = true;

            try
            {
                BackToBackCall b2bCall = m_webConversation.BackToBackCall;
                if (b2bCall != null)
                {
                    b2bCall.BeginTerminate(this.BackToBackCallTerminated, b2bCall);
                }
                else
                {
                    //Go to next step of terminating conversation.
                    this.TerminateConversation();
                }

                exceptionEncountered = false;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    this.CompleteTerminateConversationOperationWithException(new FaultException <OperationFault>(operationFault));
                }
            }
        }
        /// <summary>
        /// B2B call terminate completed callback method.
        /// </summary>
        /// <param name="asyncResult">Async result.</param>
        private void BackToBackCallTerminated(IAsyncResult asyncResult)
        {
            Exception exceptionCaught      = null;
            bool      exceptionEncountered = true;

            try
            {
                BackToBackCall b2bCall = asyncResult.AsyncState as BackToBackCall;
                b2bCall.EndTerminate(asyncResult);

                //Now try to terminate conversation.
                this.TerminateConversation();

                exceptionEncountered = false;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = null;
                    if (exceptionCaught != null)
                    {
                        operationFault = FaultHelper.CreateClientOperationFault(exceptionCaught.Message, exceptionCaught.InnerException);
                    }
                    else
                    {
                        operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    }
                    this.CompleteTerminateConversationOperationWithException(new FaultException <OperationFault>(operationFault));
                }
            }
        }
    public static void Main()
    {
        try
        {
            // Read the 'StockQuote.wsdl' file as input.
            ServiceDescription myServiceDescription = ServiceDescription.
                                                      Read("StockQuote_cs.wsdl");
            // Remove the operation fault with the name 'ErrorString'.
            PortTypeCollection myPortTypeCollection = myServiceDescription.
                                                      PortTypes;
            PortType            myPortType            = myPortTypeCollection[0];
            OperationCollection myOperationCollection = myPortType.Operations;
            Operation           myOperation           = myOperationCollection[0];

// <Snippet1>
            OperationFaultCollection myOperationFaultCollection =
                myOperation.Faults;
            OperationFault myOperationFault =
                myOperationFaultCollection["ErrorString"];
            if (myOperationFault != null)
            {
                myOperationFaultCollection.Remove(myOperationFault);
            }
// </Snippet1>

            // Remove the fault binding with the name 'ErrorString'.
            BindingCollection myBindingCollection = myServiceDescription.
                                                    Bindings;
            Binding myBinding = myBindingCollection[0];
            OperationBindingCollection myOperationBindingCollection =
                myBinding.Operations;
            OperationBinding myOperationBinding =
                myOperationBindingCollection[0];
            FaultBindingCollection myFaultBindingCollection =
                myOperationBinding.Faults;
            if (myFaultBindingCollection.Contains(
                    myFaultBindingCollection["ErrorString"]))
            {
                myFaultBindingCollection.Remove(
                    myFaultBindingCollection["ErrorString"]);
            }

            myServiceDescription.Write("OperationFaultCollection_out.wsdl");
            Console.WriteLine("WSDL file with name 'OperationFaultCollection_out.wsdl'" +
                              " created Successfully");
        }
        catch (Exception e)
        {
            Console.WriteLine("Exception caught!!!");
            Console.WriteLine("Source : " + e.Source);
            Console.WriteLine("Message : " + e.Message);
        }
    }
예제 #9
0
        /// <summary>
        /// Method to create generic operation fault.
        /// </summary>
        /// <param name="message">Fault message.</param>
        /// <param name="innerException">Inner exception, if any.</param>
        /// <param name="faultSource">Fault source.</param>
        /// <returns>Operation fault.</returns>
        private static OperationFault CreateOperationFault(string message, Exception innerException, FaultSource faultSource)
        {
            Debug.Assert(!String.IsNullOrEmpty(message), "Provide a valid message string");

            OperationFault operationFault = new OperationFault();

            operationFault.Message = message;
            if (innerException != null)
            {
                operationFault.InnerExceptionMessage = innerException.Message;
            }
            operationFault.Source = faultSource;
            return(operationFault);
        }
예제 #10
0
        private void ExportFault(FaultDescription fault)
        {
            Message message = new Message {
                Name = this.GetFaultMessageName(fault.Name)
            };
            XmlQualifiedName elementName = this.ExportFaultElement(fault);

            this.contractContext.WsdlPortType.ServiceDescription.Messages.Add(message);
            AddMessagePart(message, "detail", elementName, null);
            OperationFault operationFault = this.contractContext.GetOperationFault(fault);

            WsdlExporter.WSAddressingHelper.AddActionAttribute(fault.Action, operationFault, this.exporter.PolicyVersion);
            operationFault.Message = new XmlQualifiedName(message.Name, message.ServiceDescription.TargetNamespace);
        }
        private void ExportFault(FaultDescription fault, System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.OperationReflector operationReflector)
        {
            Message message = new Message {
                Name = base.GetFaultMessageName(fault.Name)
            };
            XmlQualifiedName elementName = this.ExportFaultElement(fault, operationReflector);

            base.contractContext.WsdlPortType.ServiceDescription.Messages.Add(message);
            MessageContractExporter.AddMessagePart(message, "detail", elementName, null);
            OperationFault operationFault = base.contractContext.GetOperationFault(fault);

            WsdlExporter.WSAddressingHelper.AddActionAttribute(fault.Action, operationFault, base.exporter.PolicyVersion);
            operationFault.Message = new XmlQualifiedName(message.Name, message.ServiceDescription.TargetNamespace);
        }
        /// <summary>
        /// B2B call establish completed callback method.
        /// </summary>
        /// <param name="asyncResult">Async result.</param>
        private void BackToBackCallEstablishCompleted(IAsyncResult asyncResult)
        {
            var b2bCall = asyncResult.AsyncState as BackToBackCall;

            Debug.Assert(null != b2bCall, "Async state is null");

            Exception exceptionCaught      = null;
            bool      exceptionEncountered = true;

            try
            {
                b2bCall.EndEstablish(asyncResult);
                //If the call establishment is successful, stamp the b2b call in the web conversation.
                this.WebConversation.BackToBackCall = b2bCall;
                exceptionEncountered = false;
            }
            catch (RealTimeException rte)
            {
                Helper.Logger.Info("Exception = {0}", EventLogger.ToString(rte));
                exceptionCaught = rte;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = null;
                    if (exceptionCaught != null)
                    {
                        operationFault = FaultHelper.CreateClientOperationFault(exceptionCaught.Message, exceptionCaught.InnerException);
                    }
                    else
                    {
                        operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    }
                    this.CompleteEstablishOperationWithException(new FaultException <OperationFault>(operationFault));
                }
                else
                {
                    AudioVideoCallContext avCallContext = b2bCall.Call1.ApplicationContext as AudioVideoCallContext;
                    Debug.Assert(null != avCallContext, "Av call context is null");
                    Debug.Assert(null != avCallContext.WebAvcall, "Av call in av call context is null");
                    EstablishAudioVideoCallResponse response = new EstablishAudioVideoCallResponse(m_establishAvCallRequest, avCallContext.WebAvcall);
                    this.CompleteEstablishOperationSuccessfully(response);
                }
            }
        }
        /// <summary>
        /// Establishes av call directly to the destination.
        /// </summary>
        private void EstablishAvCallDirectly()
        {
            bool      exceptionEncountered = true;
            Exception exceptionCaught      = null;

            try
            {
                CallEstablishOptions establishOptions = new CallEstablishOptions();
                //Add custom MIME parts based on conversation context.
                if (m_cutomMimePart != null)
                {
                    establishOptions.CustomMimeParts.Add(m_cutomMimePart);
                }
                //Construct the destination uri, if needed.
                m_avCall.BeginEstablish(m_destinationUri, establishOptions, this.AudioVideoCallEstablishCompleted, null /*state*/);
                exceptionEncountered = false;
            }
            catch (ArgumentException ae)
            {
                Helper.Logger.Error("Exception = {0}", EventLogger.ToString(ae));
                exceptionCaught = ae;
            }
            catch (InvalidOperationException ioe)
            {
                Helper.Logger.Info("Exception = {0}", EventLogger.ToString(ioe));
                exceptionCaught = ioe;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = null;
                    if (exceptionCaught != null)
                    {
                        operationFault = FaultHelper.CreateClientOperationFault(exceptionCaught.Message, exceptionCaught.InnerException);
                    }
                    else
                    {
                        operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    }

                    this.CompleteEstablishOperationWithException(new FaultException <OperationFault>(operationFault));
                }
            }
        }
        /// <summary>
        /// Overridden process method.
        /// </summary>
        public override void Process()
        {
            bool exceptionEncountered = true;

            try
            {
                //First terminate all calls and then terminate the conversation.
                this.TerminateInstantMessagingCall();
                exceptionEncountered = false;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    this.CompleteTerminateConversationOperationWithException(new FaultException <OperationFault>(operationFault));
                }
            }
        }
        /// <summary>
        /// Overridden process method.
        /// </summary>
        public override void Process()
        {
            bool exceptionEncountered = true;

            try
            {
                this.EstablishClickToCall();

                exceptionEncountered = false;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    this.CompleteEstablishOperationWithException(new FaultException <OperationFault>(operationFault));
                }
            }
        }
        /// <summary>
        /// Overridden process method.
        /// </summary>
        public override void Process()
        {
            bool exceptionEncountered = true;

            try
            {
                //If callback number is not specified then establish audio call directly to the destination.
                this.EstablishAvCallDirectly();
                exceptionEncountered = false;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    this.CompleteEstablishOperationWithException(new FaultException <OperationFault>(operationFault));
                }
            }
        }
        static void ImportFaultSoapAction(WsdlContractConversionContext contractContext, FaultDescription fault, FaultBinding wsdlFaultBinding)
        {
            string soapAction = SoapHelper.ReadSoapAction(wsdlFaultBinding.OperationBinding);

            if (contractContext != null)
            {
                OperationFault wsdlOperationFault = contractContext.GetOperationFault(fault);
                string         wsaAction          = WsdlImporter.WSAddressingHelper.FindWsaActionAttribute(wsdlOperationFault);
                if (wsaAction == null && soapAction != null)
                {
                    fault.Action = soapAction;
                }
                //
            }
            else
            {
                //
            }
        }
예제 #18
0
        /// <summary>
        /// Im call establish completed callback method.
        /// </summary>
        /// <param name="asyncResult">Async result.</param>
        private void InstantMessagingCallEstablishCompleted(IAsyncResult asyncResult)
        {
            Exception exceptionCaught      = null;
            bool      exceptionEncountered = true;

            try
            {
                m_imCall.EndEstablish(asyncResult);
                exceptionEncountered = false;
            }
            catch (RealTimeException rte)
            {
                Helper.Logger.Info("Exception = {0}", EventLogger.ToString(rte));
                exceptionCaught = rte;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = null;
                    if (exceptionCaught != null)
                    {
                        operationFault = FaultHelper.CreateClientOperationFault(exceptionCaught.Message, exceptionCaught.InnerException);
                    }
                    else
                    {
                        operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    }
                    this.CompleteEstablishOperationWithException(new FaultException <OperationFault>(operationFault));
                }
                else
                {
                    InstantMessagingCallContext imCallContext = m_imCall.ApplicationContext as InstantMessagingCallContext;
                    Debug.Assert(null != imCallContext, "Im call context is null");
                    Debug.Assert(null != imCallContext.WebImcall, "Im call in Imcall context is null");
                    //Stamp im call.
                    m_webConversation.WebImCall = imCallContext.WebImcall;
                    EstablishInstantMessagingCallResponse response = new EstablishInstantMessagingCallResponse(m_establishImCallRequest, imCallContext.WebImcall);
                    this.CompleteEstablishOperationSuccessfully(response);
                }
            }
        }
        private static void ImportFaultSoapAction(WsdlContractConversionContext contractContext, FaultDescription fault, FaultBinding wsdlFaultBinding)
        {
            string soapAction = SoapHelper.ReadSoapAction(wsdlFaultBinding.OperationBinding);

            if (contractContext != null)
            {
                OperationFault wsdlOperationFault = contractContext.GetOperationFault(fault);
                string         wsaAction          = WsdlImporter.WSAddressingHelper.FindWsaActionAttribute(wsdlOperationFault);
                if (wsaAction == null && soapAction != null)
                {
                    fault.Action = soapAction;
                }
                //CONSIDER, hsomu: If WS-Addressing action was found, we should verify that it is the same as the SOAP action
                //      (for the request message).
            }
            else
            {
                //CONSIDER, hsomu: verify SOAP action matches referenced contract.operation.message
            }
        }
예제 #20
0
        /// <summary>
        /// Compare two operations (with same name)
        /// </summary>
        /// <remarks></remarks>
        private bool MatchOperations(Operation x, Operation y)
        {
            if (!MatchOperationMessages(x.Messages.Input, y.Messages.Input))
            {
                ReportOperationDefinedDifferently(x, y);
                return(false);
            }
            if (!MatchOperationMessages(x.Messages.Output, y.Messages.Output))
            {
                ReportOperationDefinedDifferently(x, y);
                return(false);
            }

            OperationFault[] faultsX = new OperationFault[x.Faults.Count];
            x.Faults.CopyTo(faultsX, 0);
            Array.Sort(faultsX, new OperationFaultComparer());

            OperationFault[] faultsY = new OperationFault[y.Faults.Count];
            y.Faults.CopyTo(faultsY, 0);
            Array.Sort(faultsY, new OperationFaultComparer());

            if (!MatchCollections <OperationFault>(faultsX, faultsY,
                                                   delegate(OperationFault faultX, OperationFault faultY)
            {
                if (faultX != null && faultY != null)
                {
                    return(MatchXmlQualifiedNames(faultX.Message, faultY.Message));
                }
                else if (faultX != null || faultY != null)
                {
                    return(false);
                }
                return(true);
            }
                                                   ))
            {
                ReportOperationDefinedDifferently(x, y);
                return(false);
            }
            return(true);
        }
예제 #21
0
    public static void Main()
    {
        try
        {
            // Read the 'StockQuote.wsdl' file as input.
            ServiceDescription myServiceDescription = ServiceDescription.
                                                      Read("StockQuote_cs.wsdl");
            PortTypeCollection myPortTypeCollection = myServiceDescription.
                                                      PortTypes;
            PortType            myPortType            = myPortTypeCollection[0];
            OperationCollection myOperationCollection = myPortType.Operations;
            Operation           myOperation           = myOperationCollection[0];
// <Snippet1>
            OperationFaultCollection myOperationFaultCollection = myOperation.Faults;
            OperationFault           myOperationFault           = new OperationFault();
            myOperationFault.Name    = "ErrorString";
            myOperationFault.Message = new XmlQualifiedName("s0:GetTradePriceStringFault");
            myOperationFaultCollection.Add(myOperationFault);
// </Snippet1>
            Console.WriteLine("Added OperationFault with Name: " +
                              myOperationFault.Name);
            myOperationFault         = new OperationFault();
            myOperationFault.Name    = "ErrorInt";
            myOperationFault.Message = new XmlQualifiedName
                                           ("s0:GetTradePriceIntFault");
            myOperationFaultCollection.Add(myOperationFault);

            myOperationCollection.Add(myOperation);
            Console.WriteLine("Added Second OperationFault with Name: " +
                              myOperationFault.Name);
            myServiceDescription.Write("StockQuoteNew_cs.wsdl");
            Console.WriteLine("\nThe file 'StockQuoteNew_cs.wsdl' is created" +
                              " successfully.");
        }
        catch (Exception e)
        {
            Console.WriteLine("Exception caught!!!");
            Console.WriteLine("Source : " + e.Source);
            Console.WriteLine("Message : " + e.Message);
        }
    }
        /// <summary>
        /// Establish call by first calling the phone number and then doing self transfer and then back to backing with the destination.
        /// </summary>
        private void EstablishClickToCall()
        {
            bool      exceptionEncountered = true;
            Exception exceptionCaught      = null;

            try
            {
                string callbackPhoneUri = Helper.GetCallbackPhoneUri(m_establishAvCallRequest.CallbackPhoneNumber);
                m_callbackCall.BeginEstablish(callbackPhoneUri, null /*establishOptions*/, this.CallbackAudioVideoCallEstablishCompleted, null /*state*/);
                exceptionEncountered = false;
            }
            catch (ArgumentException ae)
            {
                Helper.Logger.Error("Exception = {0}", EventLogger.ToString(ae));
                exceptionCaught = ae;
            }
            catch (InvalidOperationException ioe)
            {
                Helper.Logger.Info("Exception = {0}", EventLogger.ToString(ioe));
                exceptionCaught = ioe;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = null;
                    if (exceptionCaught != null)
                    {
                        operationFault = FaultHelper.CreateClientOperationFault(exceptionCaught.Message, exceptionCaught.InnerException);
                    }
                    else
                    {
                        operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    }

                    this.CompleteEstablishOperationWithException(new FaultException <OperationFault>(operationFault));
                }
            }
        }
        /// <summary>
        /// Callback Av call establish completed callback method.
        /// </summary>
        /// <param name="asyncResult">Async result.</param>
        private void CallbackAudioVideoCallEstablishCompleted(IAsyncResult asyncResult)
        {
            Exception exceptionCaught      = null;
            bool      exceptionEncountered = true;

            try
            {
                m_callbackCall.EndEstablish(asyncResult);
                //If establish operation succeeds immediately trigger a self transfer.
                m_callbackCall.BeginTransfer(m_callbackCall, null /*transferOptions*/, this.SelfTransferCompleted, null /*asyncState*/);
                exceptionEncountered = false;
            }
            catch (InvalidOperationException ioe)
            {
                Helper.Logger.Info("Exception = {0}", EventLogger.ToString(ioe));
                exceptionCaught = ioe;
            }
            catch (RealTimeException rte)
            {
                Helper.Logger.Info("Exception = {0}", EventLogger.ToString(rte));
                exceptionCaught = rte;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = null;
                    if (exceptionCaught != null)
                    {
                        operationFault = FaultHelper.CreateClientOperationFault(exceptionCaught.Message, exceptionCaught.InnerException);
                    }
                    else
                    {
                        operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    }
                    this.CompleteEstablishOperationWithException(new FaultException <OperationFault>(operationFault));
                }
            }
        }
        /// <summary>
        /// Av call establish completed callback method.
        /// </summary>
        /// <param name="asyncResult">Async result.</param>
        private void AudioVideoCallTerminated(IAsyncResult asyncResult)
        {
            bool exceptionEncountered = true;

            try
            {
                AudioVideoCall avCall = asyncResult.AsyncState as AudioVideoCall;
                avCall.EndTerminate(asyncResult);

                //Now try to terminate b2bcall.
                this.TerminateBackToBackCall();

                exceptionEncountered = false;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    this.CompleteTerminateConversationOperationWithException(new FaultException <OperationFault>(operationFault));
                }
            }
        }
        /// <summary>
        /// Conversation terminated callback method.
        /// </summary>
        /// <param name="asyncResult">Async result.</param>
        private void ConversationTerminated(IAsyncResult asyncResult)
        {
            bool exceptionEncountered = true;

            try
            {
                Conversation conv = asyncResult.AsyncState as Conversation;
                conv.EndTerminate(asyncResult);

                //Invoke all done.
                this.TerminationWorkCompleted();

                exceptionEncountered = false;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    this.CompleteTerminateConversationOperationWithException(new FaultException <OperationFault>(operationFault));
                }
            }
        }
예제 #26
0
        /// <summary>
        /// Im call establish completed callback method.
        /// </summary>
        /// <param name="asyncResult">Async result.</param>
        private void InstantMessagingSendMessageCompleted(IAsyncResult asyncResult)
        {
            Exception exceptionCaught      = null;
            bool      exceptionEncountered = true;

            try
            {
                m_imFlow.EndSendInstantMessage(asyncResult);
                exceptionEncountered = false;
            }
            catch (RealTimeException rte)
            {
                Helper.Logger.Info("Exception = {0}", EventLogger.ToString(rte));
                exceptionCaught = rte;
            }
            finally
            {
                if (exceptionEncountered)
                {
                    OperationFault operationFault = null;
                    if (exceptionCaught != null)
                    {
                        operationFault = FaultHelper.CreateClientOperationFault(exceptionCaught.Message, exceptionCaught.InnerException);
                    }
                    else
                    {
                        operationFault = FaultHelper.CreateServerOperationFault(FailureStrings.GenericFailures.UnexpectedException, null /*innerException*/);
                    }
                    this.CompleteSendMessageOperationWithException(new FaultException <OperationFault>(operationFault));
                }
                else
                {
                    SendInstantMessageResponse response = new SendInstantMessageResponse(m_sendImMessageRequest);
                    this.CompleteSendMessageOperationSuccessfully(response);
                }
            }
        }
		public int Add (OperationFault operationFaultMessage) 
		{
			Insert (Count, operationFaultMessage);
			return (Count - 1);
		}
		public void Insert (int index, OperationFault operationFaultMessage)
		{
			List.Insert (index, operationFaultMessage);
		}
		public bool Contains (OperationFault operationFaultMessage)
		{
			return List.Contains (operationFaultMessage);
		}
	// Methods
	public int Add(OperationFault operationFaultMessage) {}
	public bool Contains(OperationFault operationFaultMessage) {}
	public int IndexOf(OperationFault operationFaultMessage) {}
	public void CopyTo(OperationFault[] array, int index) {}
	public void Remove(OperationFault operationFaultMessage) {}
		public int IndexOf (OperationFault operationFaultMessage)
		{
			return List.IndexOf (operationFaultMessage);
		}
		public void CopyTo (OperationFault[] array, int index) 
		{
			List.CopyTo (array, index);
		}
		public void Remove (OperationFault operationFaultMessage)
		{
			List.Remove (operationFaultMessage);
		}
예제 #38
0
 public int IndexOf(OperationFault operationFaultMessage)
 {
     return(List.IndexOf(operationFaultMessage));
 }
예제 #39
0
 internal void AddFault(FaultDescription faultDescription, OperationFault wsdlOperationFault)
 {
     this.wsdlOperationFaults.Add(faultDescription, wsdlOperationFault);
     this.faultDescriptions.Add(wsdlOperationFault, faultDescription);
 }
예제 #40
0
 public FaultDescription GetFaultDescription(OperationFault operationFault)
 {
     return(this.faultDescriptions[operationFault]);
 }
    public static void Main()
    {
        // Read the 'StockQuote.wsdl' file as input.
        ServiceDescription myServiceDescription = ServiceDescription.Read("StockQuote.wsdl");

        PortTypeCollection       myPortTypeCollection       = myServiceDescription.PortTypes;
        PortType                 myPortType                 = myPortTypeCollection[0];
        OperationCollection      myOperationCollection      = myPortType.Operations;
        Operation                myOperation                = myOperationCollection[0];
        OperationFaultCollection myOperationFaultCollection = myOperation.Faults;

        // Reverse the operation fault order.
        if (myOperationFaultCollection.Count > 1)
        {
            OperationFault[] myOperationFaultArray = new OperationFault[myOperationFaultCollection.Count];
            // Copy the operation fault to a temporary array.
            myOperationFaultCollection.CopyTo(myOperationFaultArray, 0);
            // Remove all the operation fault instances in the fault binding collection.
            for (int i = 0; i < myOperationFaultArray.Length; i++)
            {
                myOperationFaultCollection.Remove(myOperationFaultArray[i]);
            }
            // Insert the operation fault instance in the reverse order.
            for (int i = 0, j = (myOperationFaultArray.Length - 1); i < myOperationFaultArray.Length; i++, j--)
            {
                myOperationFaultCollection.Insert(i, myOperationFaultArray[j]);
            }
        }

// <Snippet1>
// <Snippet2>
// <Snippet3>
// <Snippet4>
// <Snippet5>
// <Snippet6>

        BindingCollection          myBindingCollection          = myServiceDescription.Bindings;
        Binding                    myBinding                    = myBindingCollection[0];
        OperationBindingCollection myOperationBindingCollection = myBinding.Operations;
        OperationBinding           myOperationBinding           = myOperationBindingCollection[0];
        FaultBindingCollection     myFaultBindingCollection     = myOperationBinding.Faults;

        // Reverse the fault bindings order.
        if (myFaultBindingCollection.Count > 1)
        {
            FaultBinding myFaultBinding = myFaultBindingCollection[0];

            FaultBinding[] myFaultBindingArray = new FaultBinding[myFaultBindingCollection.Count];
            // Copy the fault bindings to a temporary array.
            myFaultBindingCollection.CopyTo(myFaultBindingArray, 0);

            // Remove all the fault binding instances in the fault binding collection.
            for (int i = 0; i < myFaultBindingArray.Length; i++)
            {
                myFaultBindingCollection.Remove(myFaultBindingArray[i]);
            }

            // Insert the fault binding instance in the reverse order.
            for (int i = 0, j = (myFaultBindingArray.Length - 1); i < myFaultBindingArray.Length; i++, j--)
            {
                myFaultBindingCollection.Insert(i, myFaultBindingArray[j]);
            }
            // Check if the first element in the collection before the reversal is now the last element.
            if (myFaultBindingCollection.Contains(myFaultBinding) &&
                myFaultBindingCollection.IndexOf(myFaultBinding) == (myFaultBindingCollection.Count - 1))
            {
                // Display the WSDL generated to the console.
                myServiceDescription.Write(Console.Out);
            }
            else
            {
                Console.WriteLine("Error while reversing");
            }
        }

// </Snippet6>
// </Snippet5>
// </Snippet4>
// </Snippet3>
// </Snippet2>
// </Snippet1>
    }