Question

I've got a WCF project running on our web server that our Mobile Devices use to pull data from our databases.

private void GetData(string serialNum) {
  try {
    var service = new AcpServiceClient();
    service.GetData(serialNum);
  } catch (CFFaultException err) {
    MessageBox.Show(err.FaultMessage, "Web Service Error");
  }
}

As soon as I call GetData, I am presented with an ugly XML message like shown below:

CEZoom0

I see the error, buried in the XML text.

Procedure 'sp1_GetCoilFromTable' expects parameter '@serial_Number', which was not supplied.

Why is all of this XML being dumped into the FaultMessage?

All of the help I am finding by searching for CFFaultException seems to pull up dead links or pages where others have asked questions that answer using dead links.

What I would like is a clean way to get to the main error message without having to write a routine to parse the XML.

Was it helpful?

Solution

Because WCF is passing back a SOAP envelope with the exception data. It's trying to be nice and give you everything you might want to know because WCF was developed with giant data pipes in mind, not being frugal and giving you only what you need.

You might be able to change the error formatting on the server side. Here's some MSDN info: http://msdn.microsoft.com/en-us/library/vstudio/ee513227(v=vs.100).aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top