private void SendRequest_Click(object sender, RoutedEventArgs e) { try { int value = mServiceA.GetValue(); textBox.AppendText("Returned value from service: " + value + "\n"); } /* * If a managed exception is thrown from a service operation, client is immediately reported with a “FaultException” * and the communication channel of the client is faulted and the proxy object cannot be used for calling any more * methods. If it is used then “CommunicationObjectFaultedException” is thrown in the client application. * If a “FaultException” is thrown from the service operation on server then the client application can handle this * FaultException and the communication channel of client and server will not be in faulted state. */ catch (FaultException fEx) { textBox.AppendText("Fault exception was thrown: " + fEx.Message + " " + fEx.Reason + " " + "SOAP Code: " + fEx.Code + "\n"); } catch (Exception ex) { textBox.AppendText("Exception was thrown: " + ex.Message); } }