blog.devbroker.org author="Patrick Rabian" about="c#, sharepoint, biztalk, team system resources" more="news, samples, tips for .NET world's developers !"

Understanding WCF advanced concepts and comparing it to ASMX 2.0 or WSE 3.0

Wednesday, 10 January 2007 09:21 by prabian

Essentials references for understanding WCF….

WCF Base

WCF Callbacks, Events

WCF Instances Management

WCF Features comparison : (table below was extracted from this article)

Web Service Software Factory

Feature
ASMX 2 .0 plus WSE 3. 0
WCF
Hosting
IIS/ASP.NET (.asmx)
SoapReceivers
IIS/ASP.NET (.svc)
ServiceHost<T>
WAS
Programming Model
[WebService], [WebMethod], and so on (supports interfaces, generics, and the like)
[ServiceContract], [OperationContract], and so on (supports interfaces, generics, and so on)
Message Exchange Patterns (MEP)
One-way
Request-response
Custom (using WSE API)
One-way
Request-response
First/last-operation
Duplex
Custom

XML Serialization

 
 
System.Xml
.Serialization
System.Runtime
.Serialization
System.Xml.Serialization
(you can choose)

Encodings

 
XML 1.0
MTOM
DIME
Custom
XML 1.0
MTOM
Binary
Custom

Transports

 

 

 
HTTP
TCP
Custom
HTTP
TCP
Named pipes
MSMQ
P2P
Custom

Protocols

 

 

 
Security
Security
Reliable messaging
Transactions
Behaviors (enabled via attributes or configuration
Local DTC transactions
HTTP buffering
HTTP caching
HTTP sessions
Custom (via SoapExtensions, WSE filters)
Concurrency
Instancing
Throttling
Thread-binding
Exception handling and faults
Impersonation
Session management
Transaction behaviors
Custom (via behavior types)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   ,
Categories:   Architecture | Web Services | XML
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Xml Notepad sample application

Saturday, 21 October 2006 09:35 by prabian

Consultez cet article intéressant sur l’implémentation d’un notepad pour XML :

XML Notepad 2007

A menu :

Design and Implementation
Validation, IntelliSense, and Custom Editors
Infinite Undo/Redo
Unit Testing
Conclusion

Article : http://msdn2.microsoft.com/en-us/library/aa905339.aspx
Download : http://www.microsoft.com/downloads/details.aspx?familyid=72D6AA49-787D-4118-BA5F-4F30FE913628&mg_id=10051&displaylang=en

ou XML Notepad 2006 : http://www.microsoft.com/france/msdn/office/conception-xml-notepad-2006.mspx

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Validate XML with XSD

Monday, 15 May 2006 06:45 by prabian

To validate an XML file with an XSD file, use this !

public static XmlDocument ValidateAndLoadXmlDocument(string xmlFilePath, string xsdFilePath)
{

XmlDocument xmlDoc;

XmlReaderSettings xmlSettings = new XmlReaderSettings();
xmlSettings.Schemas.Add(null, xsdFilePath);
xmlSettings.ValidationType = ValidationType.Schema;

XmlReader xmlReader = XmlReader.Create(xmlFilePath, xmlSettings);
xmlDoc = new XmlDocument();
xmlDoc.Load(xmlReader);

return xmlDoc;

}

Use this for asynchronous validation :

xmlSettings.ValidationEventHandler += new ValidationEventHandler(YourValidationEventHandler);

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Remove nodes from xml document

Friday, 12 May 2006 23:54 by prabian

If you need to remove nodes from an xml document, here is an example.
This sample clean duplicated nodes and only keeps the last one (according to the date field). 
 
Source.xml (the file to filter) 
 
<?xmlversion="1.0"encoding="utf-8" ?>
<Root>
    <Products>
      <Product>
        <Name>Product1</Name>
        <DataGroup>
          <Data>
            <Name>NABC</Name>
            <Value>VABC</Value>
            <Date>2006-01-10 </Date>
          </Data>
          <Data>
            <Name>NADF</Name>
            <Value>VADF</Value>
            <Date>2006-01-13</Date>
          </Data>
          <Data>
            <Name>NABC</Name>
            <Value>VABC</Value>
            <Date>2006-02-09</Date>
          </Data>
          <Data>
            <Name>NABC</Name>
            <Value>VABC</Value>
            <Date>2006-01-19</Date>
          </Data>
          <Data>
            <Name>NADF</Name>
            <Value>VADF</Value>
            <Date>2006-03-09</Date>
          </Data>
          <Data>
            <Name>NAON</Name>
            <Value>VAON</Value>
            <Date>2006-02-22</Date>
          </Data>
        </DataGroup>
      </Product>
      <Product>
        <Name>Product2</Name>
        <DataGroup>
          <Data>
            <Name>NADF</Name>
            <Value>VADF</Value>
            <Date>2006-01-13</Date>
          </Data>
          <Data>
            <Name>NABC</Name>
            <Value>VABC</Value>
            <Date>2006-01-19</Date>
          </Data>
          <Data>
            <Name>NAON</Name>
            <Value>VAON</Value>
            <Date>2006-03-09</Date>
          </Data>
          <Data>
            <Name>NAON</Name>
            <Value>VAON</Value>
            <Date>2006-04-21</Date>
          </Data>
          <Data>
            <Name>NABC</Name>
            <Value>VABC</Value>
            <Date>2006-05-23</Date>
          </Data>
        </DataGroup>
      </Product>
    </Products>
</Root>
 
Destination.xml (the result after filtering)  
 
<?xmlversion="1.0"encoding="utf-8"?>
<Root>
 <Products>
    <Product>
      <Name>Product1</Name>
      <DataGroup>
        <Data>
          <Name>NABC</Name>
          <Value>VABC</Value>
          <Date>2006-02-09</Date>
        </Data>
        <Data>
          <Name>NADF</Name>
          <Value>VADF</Value>
          <Date>2006-03-09</Date>
        </Data>
        <Data>
          <Name>NAON</Name>
          <Value>VAON</Value>
          <Date>2006-02-22</Date>
        </Data>
      </DataGroup>
    </Product>
    <Product>
      <Name>Product2</Name>
      <DataGroup>
        <Data>
          <Name>NADF</Name>
          <Value>VADF</Value>
          <Date>2006-01-13</Date>
        </Data>
        <Data>
          <Name>NAON</Name>
          <Value>VAON</Value>
          <Date>2006-04-21</Date>
       </Data>
        <Data>
          <Name>NABC</Name>
          <Value>VABC</Value>
          <Date>2006-05-23</Date>
        </Data>
      </DataGroup>
    </Product>
 </Products>
</Root>
 
C# Source with .NET 2.0 
 
XmlDocument xmlSourceDoc = new XmlDocument();
xmlSourceDoc.Load("Source.xml");
XmlNodeList productList = xmlSourceDoc
    .SelectNodes(@"//Root/Products/Product" );
 
SortedDictionary<string, XmlNode> nodesToKeep 
= new SortedDictionary<string, XmlNode>();
 
List<XmlNode> nodesToDelete = new List<XmlNode>();
string dataName;
DateTime dataStoredDate, dataCurrentDate;
XmlNode parentNode;
XmlNodeList dataList; 
 
foreach (XmlNode product in productList)
{
    nodesToKeep.Clear();
    nodesToDelete.Clear(); 
 
    dataList = product.SelectNodes(@"DataGroup/Data" );
 
    foreach (XmlNode data in dataList)
    {
        dataName = data.SelectSingleNode("Name").InnerText; 
 
        if (nodesToKeep.ContainsKey(dataName))
        {
            dataStoredDate = DateTime.Parse(nodesToKeep[dataName]
                .SelectSingleNode("Date").InnerText);
            dataCurrentDate = DateTime.Parse(data