Scott Hanselman

SOAP with Attachments starting to make sense? - MTOM (Message Transmission Optimization Mechanism)

August 30, '04 Comments [1] Posted in ASP.NET | Web Services | XML
Sponsored By

It may make sense yet.  MTOM is a Candidate Recommendation - Omri breaks down the three specs.  This will be supported in WSE 3.0 and in Indigo, and appears to be the final and official way to do attachments with SOAP.  Only took four tries.

Omri explains why it took so many tries in this post from last year, and includes a series of examples that illustrate the DoInclude header and an inline encoded attachment as well as one outside the Envelope. 

He sums it up well (emphasis mine):

[The W3C's MTOM (which is based on PASwA) is] the attachments technology that we believe gives us an adequate interoperable solution for attaching large objects to SOAP messages, while still retaining the goodness of the XML Infoset, thereby enabling composition with other WS technologies such as WS-Security. [Omri Gazitt]

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Woof. XmlSerializer written in JavaScript - for the Chubby Client

August 26, '04 Comments [2] Posted in ASP.NET | Javascript | XmlSerializer
Sponsored By

I'll need at least a day to digest this.  Anders has written an XmlSerializer in JavaScript using the Javascript equivalent of Declarative Attributes called annotations.  He's used the Java syntax for attributes, as he says "JavaScript has a closer relation to the Java language than .NET."

(Which isn't really true, as Netscape's LiveScript begat JavaScript begat ECMAScript.  Java is in the name only for sex appeal.)

He's built a Javascript Reflection subsystem that parses the comments and gives a reflection-style API and feel.  The XmlSerializer is built on top of that Reflection system.  To implement "properties" you create get accessors for your fields. 

Example:

 Calculator.square=function(num) {
/**
 
*@Version(“1.0.0”)
 
*@Modifiers(modifiers=Modifier.static|Modifier.public
 
*@Returns(type=”number”,description=”The square of the given number”)
*/
 return num*num;
}

Kudos to you Anders!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Oy...XPathDocument 2.0 changes moved BACK into XmlDocument!

August 26, '04 Comments [2] Posted in ASP.NET | Web Services | XML
Sponsored By

Ok, now I'm confused.  I just noticed this on Dare's blog and again Oleg's blog:

The problem was that the XPathDocument had a radically different programming model than the XmlDocument meaning that anyone who'd written code using the XmlDocument against our v1.0/v1.1 bits would have to radically rewrite their code to get performance improvements and new features...

For this reason we've reverted the XPathDocument to what it was in v1.1 while new functionality and perf improvements will be made to the XmlDocument. Similarly we will keep the new and improved XPathEditableNavigator XPathNavigator class which will be the API for programming against XML data sources where one wants to abstract away what the underlying store actually is. We've shown the power of this model with examples such as the ObjectXPathNavigator and the DataSetNavigator.

So what are we saying here?

  • XPathEditableNavigator functionality is being rolled into XPathNavigator, adding functionality to XPathNavigator and removing XPathEditableNavigator all together. Oleg infers that XPathDocument won't be editable. But it seems to me that Dare still called it new and improved and says later in Oleg's comments (emphasis mine):
    • The XPathNavigator will be editable in Whidbey. However the XPathDocument will not be.
  • XPathDocument in 2.0 will be the same as it was in 1.1, and the new perf improvements will be rolled into XmlDocument. This should speed up all the XSLT transformations people are doing against XmlDocuments today, rather than forcing them to use XPathDocument.

Is this correct?  Time to go re-write my chapter on XML! :)

UPDATE: I fat fingered the quote and reversed the meaning.  Dare cleared it up in the comments.

Dare sez:  "I said XPathDocument will still be read-only but the XPathNavigator interface will allow editing. This means I can use the XPathNavigator API to edit an XmlDocument but not an XPathDocument."

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

ASP.NET: How to create a Default "Enter" Button for Forms/PostBacks

August 25, '04 Comments [16] Posted in ASP.NET
Sponsored By

Here's a useful gem...basically 'preloading' the __EVENTTARGET in a hidden form field - from Developer.com:

Imagine you've created an ASP.NET Web page with a search button. The user taps a phrase into a text box and presses Enter. On most regular Web pages (think: Google), the form would be submitted and the results returned. In other words, the search button is automatically "clicked" for you.

However on an ASP.NET Web page, pressing Enter resubmits the form to the server, but actually does nothing... which is pretty useless, really.

So, how do you set a default button to be clicked when the user presses Enter? Simply add the following line to your page's Load event, replacing "btnSearch" with the name of your button. It uses a hidden Page method called RegisterHiddenField and works splendidly:

Page.RegisterHiddenField("__EVENTTARGET", "btnSearch")

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

[OT] Thanks Mr. Blizzard!

August 25, '04 Comments [6] Posted in ASP.NET | Speaking | Gaming
Sponsored By

Thanks Jim!  This is my "payment" for speaking at DevDays and doing well. This year my presentation was the highest rated of all DevDays in the US, last year Carl Franklin had that distinction. It was a very jazz-hands presentation and a lot of fun.  Jim is my DE in Portland, and Rory is the DCC

Now the real question is, what will Rory schmooz me with? XBox games? A new Keyboard? Come on, M$FT, let's have some coupons! ;)  Sigh, I'll probably get only a warm handshake (probably not even that) and a lump of coal.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.