Archives by Tag 'XML'
WCF POX, JSON and SOAP Coexist
Sometimes, we want to make a service available in different protocols so that clients could have an option to choose one of their favorite methods to consume the web services. Here we are going to talk about how to make one WCF service available in POX(Plain Old XML as XML for short), JSON and SOAP […]
XML deserialization, XML undefined property becomes an empty list
When deserialize XML into object, the object’s property becomes an empty list even if the property is absence from the XML, the expected behavior is the property is null. For example, given a class public class MyFoo { public string Id { get; set; } […]
XSLT 1.0, Join a list of elements’s value with separator
In order to join a sequence with a customized separator in XSLT 1.0, similar to C# function string.Join( array, separator), I’ve come up with a template which takes the sequence and separator as parameter. Given a sample XML <?xml version=”1.0″ encoding=”utf-8″ ?> <?xml-stylesheet type=”text/xsl” href=”ElementJoin.xslt”?> <Root> <Years> <int>2008</int> <int>2009</int> […]
WCF Soap11 vs Soap11WSAddressing10 vs Soap11WSAddressingAugust2004 vs Soap12 vs Soap12WSAddressing10 vs Soap12WSAddressingAugust2004
I’ve done some quick test on WCF interoperability of the SOAP versions and WSAddressing. SOAP 1.1 vs SOAP 1.2 SOAP 1.2 is an extended version of SOAP 1.1, it does everything that SOAP 1.1 offers, SOAP 1.2 provides clear processing model and it is based on XML infoset, it has no dependency on the underlying […]
XSLT XML transformation vs Object mapping
I’ve run some tests on transformation from one XML schema to the other so that I can compare the performance between XSLT and XmlSerializer with object mapping as well as the Pros and Cons. It appears XSLT transformed my source XML to target XML faster than the object mapping since XSLT doesn’t take the type […]
C# XmlSerializer, Add an attribute to an array element
In order words, add an attribute to an object element after xml serialization, If you want something like, <Rats count=“2”> <Rat>little rat</Rat> <Rat>old rat</Rat> </Rats> The C# code is [XmlType(“Rats”)] public class Rats { [XmlAttribute(“count”)] public int Count { get; set; […]
WSE UsernameToken Password SendHashed – Crack
Using ServiceCapture, Ethereal, Charles or some SOAP sniffer software to inspect the XML sent on wire. Here is XML snippet in the SOAP header. <wsse:usernametoken wsu:id=”….” xmlns:wsu=”….”> <wsse:username>xxxxxx</wsse:username> <wsse:password type=”….”> fCQCp/A9wFD/Gku0L+yF/u+0leg= </wsse:password> <wsse:nonce>eSM7S/iT0KyA39vuWPQcPQ==</wsse:nonce> <wsu:created>1975-12-01T05:28:36Z</wsu:created> </wsse:usernametoken> [STAThread] static void Main() { […]
SQL 2005 generates XML comment, array of elements
SELECT ‘nameValue’ AS “@name”, CAST('<!– your comment –>’ AS XML), ‘anotherValue’ AS “another”, (SELECT ‘i’ AS “@name”, ‘1’ AS “@value” FOR XML PATH(’item’), TYPE), (SELECT ‘j’ AS “@name”, ‘2’ AS “@value” FOR XML PATH(’item’), TYPE) […]
XML Elements or Attributes in the world
Elements way is good at interoperability. Attributes way is good at size of the XML. <message> <id>1</id> <myword>Hello</myword> </message> <message id=”1″> <myword>Hello</myword> </message> <message id=”1″>Hello</message> <message id=”1″ myword=”Hello” /> Which way do you prefer?