Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > Indigo

Vista - FaultContractAttribute Question

 
 
Old 06-14-2006   #1 (permalink)
Cordell Lawrence


 
 

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 SpecsSystem Spec
Old 06-21-2006   #2 (permalink)
danroth27@hotmail.com


 
 

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 SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
IE8 Question Vista General
escape character question - hopefully an easy question PowerShell
vista genral question and ultimate question Vista General
Dual boot system question and family deal discount question Vista General
RC1 Cd Key Question Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46