![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | FaultContractAttribute Question Guys, can't find much documentation on this attribute, so looking for any clairification I can get. // PREAMBLE: Don't need to read ... aka Salad Here's the deal: I'm developing a messaging (Web Service) application, started using ASP.NET 2.0. I prefer the Contract First school of thought (where appropriate), for now I'll work in hybrid mode, i.e. define message types in XML Schema, use XSD.exe to gen the basic classes, and 'extend' or rather complete the partial class definitions with convience method and overloaded constructors to make life easy. Of course I still don't have full control of the WSDL contract but I was thinking ... how do I communicate possible faults to the service consumers when I don't have contract control, did some digging found no ~'SoapFaultAttribute' and realized that couldn't do what I wanted (easily) so I decided to investigate WCF. Found the FaultContract attribute and decided to do a little experiment. // MEAT! My real problem is that after I declared my FaultContract attribute on the interface method that represents my service contract, and requested the WSDL, I saw the fault represented in ProcessMessage operation however the schema of the type I defined in my FaultContract (ProcessMessageFault) was not reflected in wsdl:types section of the WSDL Document. Q: Is this intentional? or am I being ignorant because the schema of faults aren't normally reflected in the wsdl:types section anyway. Here's a snippet of my contract. [ServiceContractAttribute(Name="MessageBroker", Namespace="http://www.teleios-systems.com/messaging/messageBroker/")] public interface IMessageBroker { [OperationContract(Action="*", IsOneWay=false)] [FaultContract(typeof(ProcessMessageFault), Name="ProcessMessageFault", Action="*")] Message ProcessMessage(Message request); } [System.Runtime.Serialization.DataContract(Name="ProcessMessageFault", Namespace="http://www.teleios-systems.com/messaging/messageBroker/faults/")] public class ProcessMessageFault { [System.Runtime.Serialization.DataMember] public string Message; [System.Runtime.Serialization.DataMember] public int ErrorCode; [System.Runtime.Serialization.DataMember] public int Severity; public ProcessMessageFault() { } } Cordell Lawrence [www.teleios-systems.com] |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: FaultContractAttribute Question Hello, If you use Action="*" you won't get metadata generated for your operation. Action="*" means any action, so there is no good action to use in the generated metadata. You can think of Action="*" operations as infrastructure operations that are really internal details of your service. It also doesn't make sense to put a FaultContract on a Message Foo(Message m) operation. This programming model is used to indicate that you want complete control over the message. When using FaultContracts, the message is generated for you. If you want to use FaultContracts you should also use a typed message programming model, or parameters. I hope this helps. Daniel Roth |
My System Specs![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SP1 Question | TH | Vista General | 7 | 04-20-2007 03:04 PM |
| Question | Cynthia Baumann-Retalic | Vista mail | 1 | 04-19-2007 09:41 PM |
| vista genral question and ultimate question | pedro g | Vista General | 7 | 02-09-2007 10:34 PM |
| Dual boot system question and family deal discount question | Betatesterzz | Vista General | 2 | 01-31-2007 08:25 AM |