How do you catch a thrown soap exception from a web service?

前端 未结 3 1703
忘掉有多难
忘掉有多难 2021-02-19 19:05

I throw a few soap exceptions in my web service successfully. I would like to catch the exceptions and access the string and ClientFaultCode that are called with the exception.

3条回答
  •  醉梦人生
    2021-02-19 19:54

    Catch the SoapException instance. That way you can access its information:

    try {
         service.StartGame();
    } catch (SoapException e)  {
        // The variable 'e' can access the exception's information.
    }
    

提交回复
热议问题