user3428422
user3428422

Reputation: 4560

WCF Soap Faults: How to get Fault code on cilent

I am just wondering if I can have an example of handling a Soap Fault on the cilent side and mainly how I can capture the Fault code?

This is what I have for my fault in the WCF side

 Throw New FaultException(Of String)("Value to large", New FaultReason("Reason: Value too large"), New FaultCode(23))

Correct?

the reason does come through correctly in the client side however, not the fault code. (I need code http 500 for example)

How do I go about trapping this?

Thanks

Upvotes: 0

Views: 1167

Answers (1)

Emmanuel DURIN
Emmanuel DURIN

Reputation: 4913

I think you need to provide a string for the faultcode The constructor doesn't accept an integer,
For instance you could provide http500 not 500 (that is not converted in correct XML) :

Throw New FaultException(Of String)("Value to large", New FaultReason("Reason: Value too large"), New FaultCode("http500"))

Hope it helps

Upvotes: 1

Related Questions