The exceptions thrown by business actions in EDRA are caught by the corresponding adapters (either a generic Exception or a BusinessRuleException). In the case of the WebServiceInterfaceAdapter, it will catch BusinessRuleException’s and Exception’s and will generate a SoapException and with the exception information in its details node.


This way the client will always see a SoapException (in the case of webservices) or an ApplicationException (in the case of remoting).


The idea is to get the SoapException on the client and make use of it.


This piece of code will clarify it.


try {
    // call EDRA service
}
catch ( SoapException se ) {
    if ( se.Code == SoapException.ClientFaultCode ) {
         // this is a BusinessRuleException. Show it to the client
         lblBizRuleBroken.Text = GetDetails( se.Detail );
    } else {
         // this is an Exception, a server fault, user normally don’t want to see it
         // Show a generic message and the reference code. The reference code is in the Detail XmlNode of the se
    }
}


 

Validation in EDRA

September 28th, 2004

“A business action can provide a semantic input validation method (see the validationMethod attribute in the BusinessAction configuration). If requested in the configuration file, the method is called by the business action pipeline target before the service implementation method is called. The method is given the input data as argument(s) and should raise an exception if the date is not valid. If an exception is raised, the service implementation method is not called.“


To implement it you would have to



  • Write another method it in your BA class (the name is arbitrary)
  • Put these attribute as part of the in the configuration file.
       validate=”true”
       validationMethod=”ValidateFunds”
  • The method will receive the same request that your BA method
  • If the data doesn’t validate throw a BusinessRuleException

EDRA also gives you a method to do syntactic validation of the message.


The syntactic validation is implemented with a handler, and it will validate the request/response message with a XML schema (xsd).


<ra:handler ra:handlerName=“SyntacticValidation”>
    <ra:syntactValidationSettings ra:requestSchema=“C:\Projects\Test\Schemas\FundsTransferRequest.xsd” ra:responseSchema=“”/>


“This can be used whenever you need to validate the structure of messages. This would typically be used with public services that can be called by any external client.
With public services, you do not have control over the requester. Another reason for using this handler is to validate messages as early as possible in order to avoid overloading the system. This would also be used in a Service Implementation pipeline.


There is a performance impact to consider as well. When both the request and response messages are validated, you may see a significant decrease in performance.
You can reduce the impact to performance by only validating the request message.“

Here is the whole picture for VSTS

VSTSOverview

This week on the EDRA message board, there was a question about EDRA runtime user context. This made me research on asp.net and IIS security and after some research I posted the IdentityImpersonate handler. Johnatan Wanagel, one of the MS guys that works tight with EDRA, posted these very interesting links…


IIS & ASP.Net Pipeline processing
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetAP04.asp


IIS authentication settings, the resultant identity that is obtained from each of the variables that maintain an IPrincipal and/or IIdentity object.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetAP05.asp


The chapter that explains everything about impersonation, WindowsIdentity and ASP.NET Security Architecture in general
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetch08.asp

Today while was reading a post from edjez found this CoolStuff: an xpath navigator to navigate through an object graph


ObjectXPathNavigator: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexxml/html/xml03172003.asp