The mysteries of software development and networking... RSS 2.0



 Wednesday, May 21, 2008

Anyone familiar with building applications using .NET Remoting (in .NET 2.0) knows that the DataSet and DataTable classes have a property called RemotingFormat. This could be set to either XML or Binary where Binary would give you a performance boost since it is more compact.

Windows Communication Foundation does not use this property at all. The service binding dictates the serialization format, no matter what you set the RemotingFormat property to be, even if your using a NetHttpBinding.

The following configuration will setup a service to use .NET Binary formatting over Http:

<system.serviceModel>
  <bindings>
    <customBinding>
      <binding name="NetHttpBinding">
        <reliableSession />
        <compositeDuplex />
        <oneWay  />
        <binaryMessageEncoding  />
        <httpTransport />
      </binding>
    </customBinding>
  </bindings>
  <services>
    <service behaviorConfiguration="ServiceBehavior" name="MyService">
      <endpoint address="" binding="customBinding"
        bindingConfiguration="NetHttpBinding" name="HttpBinding" contract="IService" />
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <behavior name="ServiceBehavior">
        <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
        <serviceMetadata httpGetEnabled="true"/>
        <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
        <serviceDebug includeExceptionDetailInFaults="false"/>
      </behavior>
    </serviceBehaviors>
  </behaviors>
</system.serviceModel>

So even if your service looks something like this:

public DataSet GetData()
{
    DataSet ds = BuildDataSet();   // retrieve some data here
    ds.RemotingFormat = SerializationFormat.Xml;
    return ds;
}

The DataSet will still get serialized as a .NET binary as defined in the binding ('binaryMessageEncoding').

Wednesday, May 21, 2008 4:04:18 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
C# | WCF
 Friday, May 09, 2008

Okay, so you read the title of this post. Perhaps you're expecting huge amounts of code, but guess what. As it turns out, this is so ridiculously easy. This will be a very short post.

Step one is to have a method that loads an RSS feed. WCF offers a new class called SyndicationFeed.

private SyndicationFeed Load( string url )

{

  XmlReader reader = XmlReader.Create( url );

  SyndicationFeed feed = SyndicationFeed.Load( reader );

  return feed;

}

 

The above method will take a url and use to load a feed. Now suppose I have a list of urls and I want to take all the items in all the feeds, sort them and use them to generate a new, aggregated feed. Sounds like a fair amount of work, right.

Here is the code:

 

private SyndicationFeed Aggregate( List<string> urls )

{

  var items = from url in urls

              from item in Load( url ).Items

              orderby item.PublishDate descending

              select item;

 

  SyndicationFeed feed = new SyndicationFeed( items );

  return feed;

}

 

Cool!

Friday, May 09, 2008 11:10:19 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
C# | LINQ | WCF
 Thursday, March 27, 2008

A friend of mine asked me about what book I'd recommend for learning Windows Communication Foundation.

I've read 'Learning WCF' from Michele Leroux Bustamante and think it's great and I still use it as reference material.

Thursday, March 27, 2008 10:40:50 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
WCF
 Sunday, January 13, 2008

In the .NET Framework, most of the time, the name of an assembly matches the namespace of the classes in that assembly.

Since WCF is kind of an add-on to the .NET 2.0 Framework this is not quite true for the assembly System.ServiceModel.Web.dll

Below a screenshot of what .NET Reflector shows to be inside this assembly.

As you can see this assembly extends a number of namespaces like System.Runtime.Serialization and System.Collections.ObjectModel.

The Json serialization classes are also in this assembly.

Sunday, January 13, 2008 10:42:42 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
.NET | WCF
 Sunday, November 11, 2007

Yesterday I spoke at the iSDC and Ronua Community Workshop. We had a great day and it was a pleasure meeting the people at iSDC, meeting the developers in Cluj and surroundings (some drove over 200km to make it to the meeting) and Petru Jucovschi (the DPE for Microsoft Romania).

Here are the two presentations that I did:

11-09-2007 - Developing Windows Vista gadgets.pptx (431.43 KB)

11-10-2007 - 2008.NET.pptx (252.91 KB)

In the Visual Studio 2008 presentation I also talked about the work I've done for AOL. The AOL developer site can be found at http://dev.aol.com and for more reference material on Vista gadgets you can visit my AOL blog.

Sunday, November 11, 2007 3:32:20 AM (Eastern Standard Time, UTC-05:00)  #    Comments [2] -
C# | General | LINQ | Vista | WCF
 Thursday, September 20, 2007

I've completed a comprehensive sample application integrating Windows Communication Foundation, ASP.NET and TRUVEO search into a custom search engine. Check it out here.

Thursday, September 20, 2007 1:01:55 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
AOL | ASP.NET | WCF
 Wednesday, August 22, 2007

I've just posted a new blog entry on my AOL blog. I think it turned out really cool!

I use Windows Communication Foundation 3.5 (beta 2) to create a service contract, data contract and client channel and then connect to a non WCF, REST based service.

More on: http://dev.aol.com/node/595.

Wednesday, August 22, 2007 1:21:48 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
AOL | C# | WCF
 Friday, August 10, 2007

Big companies, like Amazon and AOL, offering 'Software as a Service' seem to focus on REST more than on SOAP. Having a Microsoft background myself I found this strange... ASP.NET webservices work great, so therefor why not use SOAP?

The number one great thing about REST is the ability to easily test a service by... typing the URL in you browser. This will at least allow you to test the GET operation on your REST service.

Microsoft's number one dude on SOAP, Don Box seems to be moving away from SOAP himself (or is he running?). Below is an abstract of Don's words during Microsoft Tech Summit 07 taken from Ben Galbraith's blog. Read the full item here.

Q: What is the future of REST?

Don: Interesting word that means different things to different people, such as:

1. Get the WSDL and XSD out of my face
2. Get the SOAP out of my face
3. Put the URI in my face
4. Respect GET
5. Embrace PUT and DELETE

“It turns out a lot of the headache people have with Web Services or WS-* is tied to XSD. XSD is more flawed than most technologies that roam the earth. I was on the committee that created it, and that was back when I made my money explaining complicated technologies to people for money, and man, I could hear the cash registers ringing in my ears.”

“Now my job is making things simple, which is unfortunate since I’m stuck with XSD.”

“XSD was a standard-committee driven piece of ####ing crap.”

“If you’re Sun, if you’re Microsoft, if you’re IBM, you can just throw a bunch of engineers in a room and make it all work. Sun is committed to making their stuff interop with WCF with Project Tango. But if you’re Matz, or DHH, or Larry Wall, you’re screwed, because you don’t have time to build out this stack and then make it interoperate.”

Friday, August 10, 2007 7:49:04 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
WCF

Googling for some good examples on how to implement a REST style service using WCF does not provide many useful hits. Microsoft seems to not like the acronym REST very well instead using either the term POX (plain old XML) or 'the Web Programming Model' (WPM???).

Anyway Bryan Bell has a pretty decent post showing the very basics of REST/POX/WPM as made available using WCF 3.5.

Read more on: http://hyperthink.net/blog/2007/03/05/HTTPPOX+Programming+Basics.aspx.

Friday, August 10, 2007 6:43:42 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
WCF
About
This blog is run by Mark Blomsma.
© Copyright 2008
Develop-One
Sign In
Statistics
Total Posts: 305
This Year: 49
This Month: 2
This Week: 1
Comments: 36
All Content © 2008, Develop-One
DasBlog theme 'Business' created by Christoph De Baene (delarou)