tags:

views:

189

answers:

0

I use Soap extension and I have problem with how sen exception on client side. How can I send exception from ProcessMessage on client side. For example:

public bool fun1()
{...}

public bool fun2()
{...}

public override void ProcessMessage(SoapMessage message)
        {
            switch (message.Stage)
            {
                case SoapMessageStage.BeforeSerialize:
                    break;
                case SoapMessageStage.AfterSerialize:
                    {
                      if(fun1())
                        {
                            // do something with stream
                        }
                      else
                        {
                        throw new SecurityException("error 1");
                        }
                    }
                    break;
                    case SoapMessageStage.BeforeDeserialize:
                    {

                      if(fun2())
                        {
                            //do something with stream
                        }
                      else
                        {
                        throw new SecurityException("error 2");
                        }
                    }
                    break;
                case SoapMessageStage.AfterDeserialize:
                    break;
                default:
                    throw new ArgumentException("Serialization error");
            }
        }

On client side I get this exception : Response is not well-formed XML.