Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

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.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Indigo

FaultContractAttribute Question

Update your Vista Drivers Update Your Drivers Now!!
 
 
Thread Tools Display Modes
Old 06-14-2006   #1 (permalink)
Cordell Lawrence
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 SpecsSystem Spec
Old 06-21-2006   #2 (permalink)
danroth27@hotmail.com
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 SpecsSystem Spec
 

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


Vistax64.com 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 2005-2008

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 47 48 49 50 51