Tuesday, February 9, 2010

Keeping up with Microsoft

It seems that Microsoft releases new tools at an alarming rate. It feels like .Net 3.5 and Silverlight were just recently came to market, now Microsoft is at it again. Behold that .Net 4.0 and Visual Studio 2010 are just around the corner. Here is Scott Guthrie’s entry to confirm that, here.

From playing with Beta2 of VS 2010, I am highly looking forward to this release. They’ve made great strides at giving state of the art debugging, and visual design capabilities to developers.

The Beta2 and RC can both be installed side-by-side, so it’s time to play more with new stuff!!!

Thursday, February 4, 2010

Submitting Xml correctly into SOAP envelope

Over time, I became a bit comfortable for web services frameworks to take care of the serialization details. A few days ago, I had to deal with consuming the web service manually and quickly realized that i have not been below trenches in awhile.

The SOAP service has a string parameter which is in fact and xml fragment. Initially, I wrote the soap request in the following format:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <PersonalizedHelloWorld xmlns="http://tempuri.org/">
      <nameParameter><name>Roman</name></nameParameter>
    </PersonalizedHelloWorld>
  </soap:Body>
</soap:Envelope
Obviously, there is an issue with doing that. Can you spot it?

Well, you must use <![CDATA[]]> escaping syntax in the nameParameter element text. So the it should look like this:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <PersonalizedHelloWorld xmlns="http://tempuri.org/">
      <nameParameter><![CDATA[<name>Roman</name>]]></nameParameter>
    </PersonalizedHelloWorld>
  </soap:Body>
</soap:Envelope