Thursday, July 16, 2009

Thanks God Xml was made!!!

Xml is one of the most beautiful things in present scenario where numerous different platform, technologies have to interact with each other. Especially when you are working in Microsoft technology in SAP.
The beauty of Xml is highlighted when we have different technology in place, as this is the simplest sure shot way for interoperability.
Let’s take the example of retrieving data from SAP Backed. SAP has come up with the ESOA which exposes the services to the end user in a standard predefined way.
The underlying principle is same as to any web service, Expose the content in form of XML.
.NET being the one of the most advanced framework dealing with the XML files. Lots of the predefined APIs are there to manipulate the Xml file content and reformat it. The only issue is it should work consistently, that’s something that Microsoft is quite bad at. Remember “If Ferrari run Microsoft joke “
Ok, let’s come at two most basic issues that anybody dealing with Xml files has to worry about.

1. Encoding.
2. Unidentified non supported character.
Following are the solution.
1. Encoding: If you are worried about which encoding should be used, then please stick to Base64. It will save you lots of trouble. Especially when you are working in integration two different technologies (SAP and Microsoft). Base 64 is the most commonly used
2. Unsupported character: This issue has led to some of the most painful moments in life of professional (Me). Though following two solutions are best suited.
1. Remove the character from the source. One easy way keep on the character set for the alphabet and numbers (http://msdn.microsoft.com/en-us/library/60ecse8t(VS.80).aspx). Use this only when you don’t need printable character and also the software is meant to work only in Unicode languages, which usually is the case.
2. Another way which is the complete solution and renders al l the character as is, is to encode the content before sending them to Xml files. As I said, use Base 64 encoding which will convert any character into the form of Alphabets and number, which after passed to xml files can be read back to the original form using the Base64 decoding of the content.
So wondering where the code for implementation is, it depends on the languages and technology you use and I want to keep this article generic.
For specific sample in .NET you can mail me.

No comments: