![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Defining WCF Fault Messages with a Message Contract I've got a WCF application, and i'm trying to get the WSDL just right. In my contract, I specify a Fault Contract: [OperationContract] [FaultContract(typeof(ValidationFault), Name = "ValidationFault")] Response DoSomething(Request input); This ValidationFault class is decorated with the standard data contract attributes. Everything works great, except the WSDL that's generated has names in it that I can't explicitly set. <wsdl:fault wsaw:Action="..." name="..." message="tns:BackgroundCheck_CheckOrderStatus_UnknownIdentifierFault_FaultMessage" /> I want to explicity set the message type, so that it's not left as that ungainly name. This WSDL is going to be with me for a long time to come, and if I can get it exactly right now, everything will be easier. I tried creating a MessageContract, and passing that type into the FaultContractAttribute, but that generates an ugly serialization exception. Any suggestions of how to explicitly create the FaultMessages? I'm using Beta2 of Orcas. (I'm trying hard not to manually write the WSDL file, or to even need to override the WSDL generation. I would like to do this with as little custom WCF code as I can...) -- Chris Mullins |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Defining WCF Fault Messages with a Message Contract Chris, Best is to create a Behavior and create the FaultDescription yourself associating it to every operation available. That way you can control exactly what is generated (and not automatically concatenated) to the action and namespace of the fault. Tiago Halm "Chris Mullins [MVP - C#]" <cmullins@xxxxxx> wrote in message news:%23j5oZvGAIHA.4984@xxxxxx Quote: > I've got a WCF application, and i'm trying to get the WSDL just right. > > In my contract, I specify a Fault Contract: > > [OperationContract] > [FaultContract(typeof(ValidationFault), Name = "ValidationFault")] > Response DoSomething(Request input); > > This ValidationFault class is decorated with the standard data contract > attributes. Everything works great, except the WSDL that's generated has > names in it that I can't explicitly set. > > <wsdl:fault wsaw:Action="..." name="..." > message="tns:BackgroundCheck_CheckOrderStatus_UnknownIdentifierFault_FaultMessage" > /> > > I want to explicity set the message type, so that it's not left as that > ungainly name. This WSDL is going to be with me for a long time to come, > and if I can get it exactly right now, everything will be easier. > > I tried creating a MessageContract, and passing that type into the > FaultContractAttribute, but that generates an ugly serialization > exception. > > Any suggestions of how to explicitly create the FaultMessages? > > I'm using Beta2 of Orcas. > > (I'm trying hard not to manually write the WSDL file, or to even need to > override the WSDL generation. I would like to do this with as little > custom WCF code as I can...) > > -- > Chris Mullins > |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Fault Message | Vista mail | |||
| Contract of Friendship | Chillout Room | |||
| The infamous page fault message | Vista performance & maintenance | |||
| "Unusual" fault message | Vista General | |||