locked
WCF TestClient: How to display Fault Exception instead of "Failed to invoke the service." RRS feed

  • Question

  • User1568091510 posted

    Hi,

    i wanna test my SOAP WCF Server.

    So i start my Visual Studio Project from the Service1.svc File into the WCF Testclient.

    public class Service1 : IService1
    {

    public string GetData(int value)
    {
         return string.Format("You entered: {0}", value);
    }

    public string GetDataFail(int value)
    {
         throw new FaultException("TestError");
    }

    }

    The Soap Response from GetDataFail is:

    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header />
    <s:Body>
       <s:Fault>
       <faultcode>s:Client</faultcode>
       <faultstring xml:lang="de-DE">TestError</faultstring>
       </s:Fault>
    </s:Body>
    </s:Envelope>

    The Problem is that the WCF Test client cant handle the fault exception, instead it trows "Failed to invoke the service." ...

    Is there any way to display the FaultException in the WCF Test Client? or is this intended behavior?

    Tuesday, July 3, 2018 10:57 AM

Answers

  • User1120430333 posted

    I doubt that the TestClient can do it. You would need to use a console application as a test solution.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 3, 2018 8:28 PM
  • User1168443798 posted

    Hi CharlesDev,

    I made a test and I could get the same result.

    After checking the available settings for WCF TestClient, I agree with DA924, and suggest you Create a Console App to use as test client.

    Best Regards,

    Edward

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 4, 2018 8:09 AM

All replies

  • User1120430333 posted

    I doubt that the TestClient can do it. You would need to use a console application as a test solution.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 3, 2018 8:28 PM
  • User1168443798 posted

    Hi CharlesDev,

    I made a test and I could get the same result.

    After checking the available settings for WCF TestClient, I agree with DA924, and suggest you Create a Console App to use as test client.

    Best Regards,

    Edward

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 4, 2018 8:09 AM