Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If a shared assembly is not feasible, you can always go with good ol' XML. It may not be the optimal solution and I'm sure plenty of users here will balk at the idea, but it is easy to support and relatively quick to implement, so it really depends on your individual situation and the skill level of the developers responsible for supporting the application. </p> <p>The benefit to using XML here, is that the calling application can be written in almost any language on almost any platform, as long as it adheres to the XML structure. </p> <p>The XML string should be easy enough to generate in the calling application, but the biggest downside here is that if you have a ton of data, the processing may take longer than desired -- on both ends of the service. </p> <p>Here is a working sample if you want to give it a try: </p> <pre><code> public class Whatever { public int SkuNumber { get; set; } public string FirstName { get; set; } public string LastName { get; set; } } [WebMethod] public void HelloWorld(string xmlString) { //make all the node names + attribute names lowercase, to account for erroneous xml formatting -- leave the values alone though xmlString = Regex.Replace(xmlString, @"&lt;[^&lt;&gt;]+&gt;", m =&gt; m.Value.ToLower(),RegexOptions.Multiline | RegexOptions.Singleline); var xmlDoc = LoadXmlDocument(xmlString); var listOfStuff = new List&lt;Whatever&gt;(); var rootNode = xmlDoc.DocumentElement; foreach(XmlNode xmlNode in rootNode) { var whatever = new Whatever { FirstName = xmlNode["first_name"].InnerText, LastName = xmlNode["last_name"].InnerText, SkuNumber = Convert.ToInt32(xmlNode["sku_number"].InnerText) }; listOfStuff.Add(whatever); } } public static XmlDocument LoadXmlDocument(string xmlString) { //some extra stuff to account for URLEncoded strings, if necessary if (xmlString.IndexOf("%3e%") &gt; -1) xmlString = HttpUtility.UrlDecode(xmlString); xmlString = xmlString.Replace((char)34, '\'').Replace("&amp;", "&amp;amp;").Replace("\\", ""); var xmlDocument = new XmlDocument(); xmlDocument.PreserveWhitespace = false; xmlDocument.LoadXml(xmlString); return xmlDocument; } </code></pre> <p>Your XML would look like this:</p> <pre><code>&lt;stuff_to_track&gt; &lt;whatever&gt; &lt;sku_number&gt;1&lt;/sku_number&gt; &lt;first_name&gt;jimi&lt;/first_name&gt; &lt;last_name&gt;hendrix&lt;/last_name&gt; &lt;/whatever&gt; &lt;whatever&gt; &lt;sku_number&gt;2&lt;/sku_number&gt; &lt;first_name&gt;miles&lt;/first_name&gt; &lt;last_name&gt;davis&lt;/last_name&gt; &lt;/whatever&gt; &lt;whatever&gt; &lt;sku_number&gt;3&lt;/sku_number&gt; &lt;first_name&gt;david&lt;/first_name&gt; &lt;last_name&gt;sanborn&lt;/last_name&gt; &lt;/whatever&gt; &lt;whatever&gt; &lt;sku_number&gt;4&lt;/sku_number&gt; &lt;first_name&gt;john&lt;/first_name&gt; &lt;last_name&gt;coltrane&lt;/last_name&gt; &lt;/whatever&gt; &lt;/stuff_to_track&gt; </code></pre> <p>I also recommend validating the incoming XML, for both schema and data. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload