0

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

user3428422
  • 4,300
  • 12
  • 55
  • 119

1 Answers1

1

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

Emmanuel DURIN
  • 4,803
  • 2
  • 28
  • 53
  • Thanks, so is my concept correct then? (Using the Fault Exception object) – user3428422 Sep 21 '15 at 12:14
  • Just take care of the detail of passing an integer, but a string for the faultcode. On the client side, you 'll catch a FaultException(Of String) – Emmanuel DURIN Sep 21 '15 at 16:37
  • @user3428422 Did I answer your question ? – Emmanuel DURIN Sep 23 '15 at 08:46
  • Not really, I like to certain that the code that I have done and that you reference is an correct example of identifying a SOAP 1.1 fault and returning it to the client, however, you have been helpful so I will up vote you. – user3428422 Sep 23 '15 at 09:06
  • Here is a post that is pretty interesting regarding SOAP 1.1 Faultcode : http://stackoverflow.com/questions/65008/net-wcf-faults-generating-incorrect-soap-1-1-faultcode-values?rq=1 – Emmanuel DURIN Sep 23 '15 at 09:58