<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Using complex types to make calling services less&#8230; complex</title>
	<atom:link href="http://encosia.com/using-complex-types-to-make-calling-services-less-complex/feed/" rel="self" type="application/rss+xml" />
	<link>http://encosia.com/using-complex-types-to-make-calling-services-less-complex/</link>
	<description>ASP.NET and AJAX code, ideas, and examples.</description>
	<lastBuildDate>Wed, 16 May 2012 23:02:53 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Zoina</title>
		<link>http://encosia.com/using-complex-types-to-make-calling-services-less-complex/#comment-67670</link>
		<dc:creator>Zoina</dc:creator>
		<pubDate>Sun, 06 May 2012 13:44:44 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=849#comment-67670</guid>
		<description>I am following your post, please help me how can I create DTO for my below class 

 &lt;pre lang=&quot;csharp&quot;&gt;
        public class SRMForm : IOracleCustomType
        {
        [OracleObjectMappingAttribute(&quot;UCA_APP_CATEGORY&quot;)]
        public virtual string uca_app_category    {get;set;}

        [OracleObjectMappingAttribute(&quot;MODULES&quot;)]
        public virtual SRMModules uca_module_description    {get;set;}
       }

      public class SRMRights : SRMForm
      {
        [OracleObjectMappingAttribute(&quot;CRT&quot;)]
        public virtual string Create     {get;set;}

        [OracleObjectMappingAttribute(&quot;RTV&quot;)]
        public virtual string Retrive     {get;set;}

        [OracleObjectMappingAttribute(&quot;UPD&quot;)]
        public virtual string Update     {get;set;}

        [OracleObjectMappingAttribute(&quot;DLT&quot;)]
        public virtual string Delete     {get;set;}
    }


    public class SRMModules : SRMForm 
    {
        [OracleObjectMappingAttribute(&quot;MODULE_NAME&quot;)]
        public virtual string ModuleName     {get;set;}

        [OracleObjectMappingAttribute(&quot;RIGHTS&quot;)]
        public virtual SRMRights ModuleRights     {get;set;}
    }
 &lt;/pre&gt;

My HTML form looks like
&lt;pre&gt;&lt;div id=&quot;ModuleDescriptions&quot;&gt;
    &lt;table &gt;
        &lt;tr&gt;
           &lt;td id=&quot;ModuleName1&quot; style=&quot;width: 400px;&quot;&gt;
             &lt;input id=&quot;ModuleName-1&quot; maxlength=&quot;35&quot; name=&quot;ModuleName&quot; style=&quot;width: 400px; text-transform: uppercase&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;
           &lt;/td&gt;&lt;td id=&quot;ModRights1&quot;&gt;
           &lt;table &gt;&lt;tr&gt;
                 &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Create-1&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;C&quot; /&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Retrive-1&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;R&quot;/&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Update-1&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;U&quot; /&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Delete-1&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;D&quot; /&gt;
            &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td style=&quot;width: 400px;&quot;&gt;
             &lt;input id=&quot;ModuleName-2&quot; maxlength=&quot;35&quot; name=&quot;ModuleName&quot; style=&quot;width: 400px; text-transform: uppercase&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;
           &lt;/td&gt;&lt;td&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Create-2&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;C&quot; /&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Retrive-2&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;R&quot;/&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Update-2&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;U&quot; /&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Delete-2&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;D&quot; /&gt;
            &lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td style=&quot;width: 400px;&quot;&gt;
             &lt;input id=&quot;ModuleName-3&quot; maxlength=&quot;35&quot; name=&quot;ModuleName&quot; style=&quot;width: 400px; text-transform: uppercase&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;
           &lt;/td&gt;&lt;td&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Create-3&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;C&quot; /&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Retrive-3&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;R&quot;/&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Update-3&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;U&quot; /&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Delete-3&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;D&quot; /&gt;
            &lt;/td&gt;
         &lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;
&lt;/pre&gt;

what i want is to create a Data Transfer object &quot;SRMModules&quot; using JQuery by looping &quot;input id=&quot;ModuleName-X&quot; with corresponding Rights &quot; &quot;input by check boxes but I dont know how to acheive this.</description>
		<content:encoded><![CDATA[<p>I am following your post, please help me how can I create DTO for my below class</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">        <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> SRMForm <span style="color: #008000;">:</span> IOracleCustomType
        <span style="color: #000000;">&#123;</span>
        <span style="color: #000000;">&#91;</span>OracleObjectMappingAttribute<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;UCA_APP_CATEGORY&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> <span style="color: #FF0000;">string</span> uca_app_category    <span style="color: #000000;">&#123;</span>get<span style="color: #008000;">;</span>set<span style="color: #008000;">;</span><span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #000000;">&#91;</span>OracleObjectMappingAttribute<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;MODULES&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> SRMModules uca_module_description    <span style="color: #000000;">&#123;</span>get<span style="color: #008000;">;</span>set<span style="color: #008000;">;</span><span style="color: #000000;">&#125;</span>
       <span style="color: #000000;">&#125;</span>
&nbsp;
      <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> SRMRights <span style="color: #008000;">:</span> SRMForm
      <span style="color: #000000;">&#123;</span>
        <span style="color: #000000;">&#91;</span>OracleObjectMappingAttribute<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;CRT&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> <span style="color: #FF0000;">string</span> Create     <span style="color: #000000;">&#123;</span>get<span style="color: #008000;">;</span>set<span style="color: #008000;">;</span><span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #000000;">&#91;</span>OracleObjectMappingAttribute<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;RTV&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> <span style="color: #FF0000;">string</span> Retrive     <span style="color: #000000;">&#123;</span>get<span style="color: #008000;">;</span>set<span style="color: #008000;">;</span><span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #000000;">&#91;</span>OracleObjectMappingAttribute<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;UPD&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> <span style="color: #FF0000;">string</span> Update     <span style="color: #000000;">&#123;</span>get<span style="color: #008000;">;</span>set<span style="color: #008000;">;</span><span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #000000;">&#91;</span>OracleObjectMappingAttribute<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;DLT&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> <span style="color: #FF0000;">string</span> Delete     <span style="color: #000000;">&#123;</span>get<span style="color: #008000;">;</span>set<span style="color: #008000;">;</span><span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
&nbsp;
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> SRMModules <span style="color: #008000;">:</span> SRMForm 
    <span style="color: #000000;">&#123;</span>
        <span style="color: #000000;">&#91;</span>OracleObjectMappingAttribute<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;MODULE_NAME&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> <span style="color: #FF0000;">string</span> ModuleName     <span style="color: #000000;">&#123;</span>get<span style="color: #008000;">;</span>set<span style="color: #008000;">;</span><span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #000000;">&#91;</span>OracleObjectMappingAttribute<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;RIGHTS&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
        <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">virtual</span> SRMRights ModuleRights     <span style="color: #000000;">&#123;</span>get<span style="color: #008000;">;</span>set<span style="color: #008000;">;</span><span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span></pre></div></div>

<p>My HTML form looks like</p>
<pre>&lt;div id=&quot;ModuleDescriptions&quot;&gt;
    &lt;table &gt;
        &lt;tr&gt;
           &lt;td id=&quot;ModuleName1&quot; style=&quot;width: 400px;&quot;&gt;
             &lt;input id=&quot;ModuleName-1&quot; maxlength=&quot;35&quot; name=&quot;ModuleName&quot; style=&quot;width: 400px; text-transform: uppercase&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;
           &lt;/td&gt;&lt;td id=&quot;ModRights1&quot;&gt;
           &lt;table &gt;&lt;tr&gt;
                 &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Create-1&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;C&quot; /&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Retrive-1&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;R&quot;/&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Update-1&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;U&quot; /&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Delete-1&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;D&quot; /&gt;
            &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td style=&quot;width: 400px;&quot;&gt;
             &lt;input id=&quot;ModuleName-2&quot; maxlength=&quot;35&quot; name=&quot;ModuleName&quot; style=&quot;width: 400px; text-transform: uppercase&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;
           &lt;/td&gt;&lt;td&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Create-2&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;C&quot; /&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Retrive-2&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;R&quot;/&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Update-2&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;U&quot; /&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Delete-2&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;D&quot; /&gt;
            &lt;/td&gt; &lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
           &lt;td style=&quot;width: 400px;&quot;&gt;
             &lt;input id=&quot;ModuleName-3&quot; maxlength=&quot;35&quot; name=&quot;ModuleName&quot; style=&quot;width: 400px; text-transform: uppercase&quot; type=&quot;text&quot; value=&quot;&quot; /&gt;
           &lt;/td&gt;&lt;td&gt;&lt;table&gt;&lt;tr&gt;&lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Create-3&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;C&quot; /&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Retrive-3&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;R&quot;/&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Update-3&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;U&quot; /&gt;
            &lt;/td&gt;
            &lt;td style=&quot;width: 50px;&quot;&gt;&lt;input id=&quot;Delete-3&quot; class=&quot;Rights&quot; type=&quot;checkbox&quot; name=&quot;Rights&quot; value=&quot;D&quot; /&gt;
            &lt;/td&gt;
         &lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;
</pre>
<p>what i want is to create a Data Transfer object &#8220;SRMModules&#8221; using JQuery by looping &#8220;input id=&#8221;ModuleName-X&#8221; with corresponding Rights &#8221; &#8220;input by check boxes but I dont know how to acheive this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nilesh</title>
		<link>http://encosia.com/using-complex-types-to-make-calling-services-less-complex/#comment-67196</link>
		<dc:creator>Nilesh</dc:creator>
		<pubDate>Fri, 04 May 2012 09:38:02 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=849#comment-67196</guid>
		<description>Good Method. I am very happy to pas whole Object into webservice or WebMethod.
Thanks to every one!!!! and Author for this.</description>
		<content:encoded><![CDATA[<p>Good Method. I am very happy to pas whole Object into webservice or WebMethod.<br />
Thanks to every one!!!! and Author for this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://encosia.com/using-complex-types-to-make-calling-services-less-complex/#comment-63407</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Sat, 31 Mar 2012 18:45:36 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=849#comment-63407</guid>
		<description>For the messy client side code at the beginning of the article, would it be better to begin with a single quote instead of a double quotes for the jquery ajax &lt;strong&gt;data&lt;/strong&gt; property?

&lt;pre lang=&quot;javascript&quot;&gt;        
data: &#039;{ &quot;FirstName&quot; : &#039; + JSON.stringify($(&quot;#FirstName&quot;).val()) + &#039;, &#039;
            + &#039;&quot;LastName&quot; : &#039; + JSON.stringify($(&quot;#LastName&quot;).val()) + &#039;}&#039;, &lt;/pre&gt;

Otherwise, I don&#039;t believe the inputs handle values well if the input values themselves contain single or double quotes; e.g., O&#039;Brien.</description>
		<content:encoded><![CDATA[<p>For the messy client side code at the beginning of the article, would it be better to begin with a single quote instead of a double quotes for the jquery ajax <strong>data</strong> property?</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">data<span style="color: #339933;">:</span> <span style="color: #3366CC;">'{ &quot;FirstName&quot; : '</span> <span style="color: #339933;">+</span> JSON.<span style="color: #660066;">stringify</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#FirstName&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">', '</span>
            <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot;LastName&quot; : '</span> <span style="color: #339933;">+</span> JSON.<span style="color: #660066;">stringify</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#LastName&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'}'</span><span style="color: #339933;">,</span></pre></div></div>

<p>Otherwise, I don&#8217;t believe the inputs handle values well if the input values themselves contain single or double quotes; e.g., O&#8217;Brien.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick</title>
		<link>http://encosia.com/using-complex-types-to-make-calling-services-less-complex/#comment-63008</link>
		<dc:creator>Rick</dc:creator>
		<pubDate>Thu, 23 Feb 2012 19:31:55 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=849#comment-63008</guid>
		<description>I tested that stringify works in IE8, FF, and Safari without JSON2.js so I&#039;m going to use that  :)
&lt;pre lang=&quot;javascript&quot;&gt;
var arrParamValuesJson = JSON.stringify(arrParamValues);
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I tested that stringify works in IE8, FF, and Safari without JSON2.js so I&#8217;m going to use that  :)</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> arrParamValuesJson <span style="color: #339933;">=</span> JSON.<span style="color: #660066;">stringify</span><span style="color: #009900;">&#40;</span>arrParamValues<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Rick</title>
		<link>http://encosia.com/using-complex-types-to-make-calling-services-less-complex/#comment-62983</link>
		<dc:creator>Rick</dc:creator>
		<pubDate>Wed, 22 Feb 2012 21:19:20 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=849#comment-62983</guid>
		<description>Hi Dave, 
Awesome post! I found that I can pass in a JavaScript Array to my function and serialize it without adding another dependency (JSON2) by using 
Sys.Serialization.JavaScriptSerializer.serialize()
However, I&#039;m new and need cross browser functionality so... what are your thoughts on this serializer? Also, I plan on changing this to hit a WCF web service.

Here&#039;s my JavaScript function:
&lt;pre lang=&quot;javascript&quot;&gt;
function RangeNotValid(arrParamValues) {
    var arrParamValuesJson = Sys.Serialization.JavaScriptSerializer.serialize(arrParamValues);

    var jData;
    var editCk = &#039;RangeNotValid&#039;;
    var options = {
        type: &quot;POST&quot;,
        async: false,
        cache: false,
        url: &quot;ScriptWS.asmx/ExecuteCheck&quot;,
        data: &quot;{&#039;CheckMethodName&#039;:&#039;&quot; + editCk + &quot;&#039;, &#039;ParameterArray&#039;:&quot; + arrParamValuesJson + &quot;}&quot;,
        contentType: &quot;application/json; charset=utf-8&quot;,
        dataType: &quot;html&quot;,
        success: function (data) {
            jData = data;
        },
        error: function (msg) {
            alert(&#039;Error at IsValidDate:&#039; + msg);
        }
    };
    $.ajax(options);

    return = jData;
}
&lt;/pre&gt;

Here is my VB.NET web service method:
&lt;pre lang=&quot;vbnet&quot;&gt;
    &lt;WebMethod(EnableSession:=True)&gt; _
    &lt;System.Web.Script.Services.ScriptMethod(ResponseFormat:=System.Web.Script.Services.ResponseFormat.Xml)&gt; _
    Public Function ExecuteEditCheck(ByVal CheckMethodName As String, ByVal ParameterArray() As String) As String
        Dim ParamList As List(Of Object) = ParameterArray.ToList.ConvertAll(Function(s) CObj(s))
		&#039;Dim ParamList As New List(Of Object)
		&#039;ParamList.Add(ParameterArray)
        Dim Query As XCQuery = UserSession.CRF.Form.Protocol.Queries.FirstOrDefault(Function(Q As XCQuery) Q.Script.FunctionName = CheckMethodName)
        
		Dim ret As String = New XCPatientQuery(Query).Run(ParamList).ToString
		Return ret
		&#039;Return New XCPatientQuery(Query).Run(ParamList).ToString
    End Function
&lt;/pre&gt;

Thanks</description>
		<content:encoded><![CDATA[<p>Hi Dave,<br />
Awesome post! I found that I can pass in a JavaScript Array to my function and serialize it without adding another dependency (JSON2) by using<br />
Sys.Serialization.JavaScriptSerializer.serialize()<br />
However, I&#8217;m new and need cross browser functionality so&#8230; what are your thoughts on this serializer? Also, I plan on changing this to hit a WCF web service.</p>
<p>Here&#8217;s my JavaScript function:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> RangeNotValid<span style="color: #009900;">&#40;</span>arrParamValues<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> arrParamValuesJson <span style="color: #339933;">=</span> Sys.<span style="color: #660066;">Serialization</span>.<span style="color: #660066;">JavaScriptSerializer</span>.<span style="color: #660066;">serialize</span><span style="color: #009900;">&#40;</span>arrParamValues<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> jData<span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> editCk <span style="color: #339933;">=</span> <span style="color: #3366CC;">'RangeNotValid'</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> options <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
        type<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;POST&quot;</span><span style="color: #339933;">,</span>
        async<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
        cache<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
        url<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;ScriptWS.asmx/ExecuteCheck&quot;</span><span style="color: #339933;">,</span>
        data<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;{'CheckMethodName':'&quot;</span> <span style="color: #339933;">+</span> editCk <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;', 'ParameterArray':&quot;</span> <span style="color: #339933;">+</span> arrParamValuesJson <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;}&quot;</span><span style="color: #339933;">,</span>
        contentType<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;application/json; charset=utf-8&quot;</span><span style="color: #339933;">,</span>
        dataType<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;html&quot;</span><span style="color: #339933;">,</span>
        success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            jData <span style="color: #339933;">=</span> data<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        error<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>msg<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Error at IsValidDate:'</span> <span style="color: #339933;">+</span> msg<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    $.<span style="color: #660066;">ajax</span><span style="color: #009900;">&#40;</span>options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #339933;">=</span> jData<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Here is my VB.NET web service method:</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;">    &lt;WebMethod<span style="color: #000000;">&#40;</span>EnableSession:<span style="color: #008000;">=</span><span style="color: #0600FF;">True</span><span style="color: #000000;">&#41;</span>&gt; _
    &lt;System.<span style="color: #0000FF;">Web</span>.<span style="color: #0000FF;">Script</span>.<span style="color: #0000FF;">Services</span>.<span style="color: #0000FF;">ScriptMethod</span><span style="color: #000000;">&#40;</span>ResponseFormat:<span style="color: #008000;">=</span>System.<span style="color: #0000FF;">Web</span>.<span style="color: #0000FF;">Script</span>.<span style="color: #0000FF;">Services</span>.<span style="color: #0000FF;">ResponseFormat</span>.<span style="color: #0000FF;">Xml</span><span style="color: #000000;">&#41;</span>&gt; _
    <span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Function</span> ExecuteEditCheck<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> CheckMethodName <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>, <span style="color: #FF8000;">ByVal</span> ParameterArray<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>
        <span style="color: #0600FF;">Dim</span> ParamList <span style="color: #FF8000;">As</span> List<span style="color: #000000;">&#40;</span>Of <span style="color: #FF0000;">Object</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">=</span> ParameterArray.<span style="color: #0000FF;">ToList</span>.<span style="color: #0000FF;">ConvertAll</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Function</span><span style="color: #000000;">&#40;</span>s<span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">CObj</span><span style="color: #000000;">&#40;</span>s<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #008080; font-style: italic;">'Dim ParamList As New List(Of Object)</span>
		<span style="color: #008080; font-style: italic;">'ParamList.Add(ParameterArray)</span>
        <span style="color: #0600FF;">Dim</span> Query <span style="color: #FF8000;">As</span> XCQuery <span style="color: #008000;">=</span> UserSession.<span style="color: #0000FF;">CRF</span>.<span style="color: #0000FF;">Form</span>.<span style="color: #0000FF;">Protocol</span>.<span style="color: #0000FF;">Queries</span>.<span style="color: #0000FF;">FirstOrDefault</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Function</span><span style="color: #000000;">&#40;</span>Q <span style="color: #FF8000;">As</span> XCQuery<span style="color: #000000;">&#41;</span> Q.<span style="color: #0000FF;">Script</span>.<span style="color: #0000FF;">FunctionName</span> <span style="color: #008000;">=</span> CheckMethodName<span style="color: #000000;">&#41;</span>
&nbsp;
		<span style="color: #0600FF;">Dim</span> ret <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span> <span style="color: #008000;">=</span> <span style="color: #FF8000;">New</span> XCPatientQuery<span style="color: #000000;">&#40;</span>Query<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Run</span><span style="color: #000000;">&#40;</span>ParamList<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">ToString</span>
		<span style="color: #FF8000;">Return</span> ret
		<span style="color: #008080; font-style: italic;">'Return New XCPatientQuery(Query).Run(ParamList).ToString</span>
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></pre></div></div>

<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dermot mcevoy</title>
		<link>http://encosia.com/using-complex-types-to-make-calling-services-less-complex/#comment-58226</link>
		<dc:creator>dermot mcevoy</dc:creator>
		<pubDate>Fri, 30 Dec 2011 15:27:02 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=849#comment-58226</guid>
		<description>Dave, this is a great post, got me out of a jam. This does helps to do atomic transactions where user is sending header/details from jQuery and .net service can process it all within one call. Also like the code when handling DTO and to expand it if require additional data...

var DTO = { &#039;NewPerson&#039; : NewPerson, &#039;MoreData&#039; : MoreData };
 
$.ajax({
  type: &quot;POST&quot;,
  contentType: &quot;application/json; charset=utf-8&quot;,
  url: &quot;PersonService.asmx/AddPerson&quot;,
  data: JSON.stringify(DTO),
  dataType: &quot;json&quot;
});

Regards
Dermot</description>
		<content:encoded><![CDATA[<p>Dave, this is a great post, got me out of a jam. This does helps to do atomic transactions where user is sending header/details from jQuery and .net service can process it all within one call. Also like the code when handling DTO and to expand it if require additional data&#8230;</p>
<p>var DTO = { &#8216;NewPerson&#8217; : NewPerson, &#8216;MoreData&#8217; : MoreData };</p>
<p>$.ajax({<br />
  type: &#8220;POST&#8221;,<br />
  contentType: &#8220;application/json; charset=utf-8&#8243;,<br />
  url: &#8220;PersonService.asmx/AddPerson&#8221;,<br />
  data: JSON.stringify(DTO),<br />
  dataType: &#8220;json&#8221;<br />
});</p>
<p>Regards<br />
Dermot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/using-complex-types-to-make-calling-services-less-complex/#comment-55118</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Mon, 19 Dec 2011 07:36:31 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=849#comment-55118</guid>
		<description>There&#039;s no need to add the extra complexity of the DTO for a single value. Do something like this:

&lt;pre lang=&quot;csharp&quot;&gt;[WebMethod]
public List&lt;SearchResult&gt; Search(string SearchTerm) {
  return YourSearchMethod(SearchTerm);
}&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>There&#8217;s no need to add the extra complexity of the DTO for a single value. Do something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #000000;">&#91;</span>WebMethod<span style="color: #000000;">&#93;</span>
<span style="color: #0600FF;">public</span> List<span style="color: #008000;">&lt;</span>SearchResult<span style="color: #008000;">&gt;</span> Search<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> SearchTerm<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
  <span style="color: #0600FF;">return</span> YourSearchMethod<span style="color: #000000;">&#40;</span>SearchTerm<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Oscar</title>
		<link>http://encosia.com/using-complex-types-to-make-calling-services-less-complex/#comment-55086</link>
		<dc:creator>Oscar</dc:creator>
		<pubDate>Mon, 19 Dec 2011 05:10:14 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=849#comment-55086</guid>
		<description>Dave, thanks for your quick answer, according to this in the web method should instantiate the object and call the search method, also thought to send a dto with just one property assigned (the id) to implement my application according to dto design pattern, is this a good idea or not?, maybe I&#039;m a little confused trying to follow this pattern.

Greetings.</description>
		<content:encoded><![CDATA[<p>Dave, thanks for your quick answer, according to this in the web method should instantiate the object and call the search method, also thought to send a dto with just one property assigned (the id) to implement my application according to dto design pattern, is this a good idea or not?, maybe I&#8217;m a little confused trying to follow this pattern.</p>
<p>Greetings.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/using-complex-types-to-make-calling-services-less-complex/#comment-55079</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Mon, 19 Dec 2011 04:46:29 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=849#comment-55079</guid>
		<description>I would just send the value.</description>
		<content:encoded><![CDATA[<p>I would just send the value.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oscar</title>
		<link>http://encosia.com/using-complex-types-to-make-calling-services-less-complex/#comment-55077</link>
		<dc:creator>Oscar</dc:creator>
		<pubDate>Mon, 19 Dec 2011 04:30:57 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=849#comment-55077</guid>
		<description>Hi Dave, first of all, thanks for your excellent articles, I have been very helpful in developing in asp.net. I have a question regarding the use of DTO&#039;s, Should I use a dto for a query that only uses a property of the object (the id) to search the database? Or is it more advisable to just send a value?, that is my question.

Thank you in advance and congratulations for your excellent work.</description>
		<content:encoded><![CDATA[<p>Hi Dave, first of all, thanks for your excellent articles, I have been very helpful in developing in asp.net. I have a question regarding the use of DTO&#8217;s, Should I use a dto for a query that only uses a property of the object (the id) to search the database? Or is it more advisable to just send a value?, that is my question.</p>
<p>Thank you in advance and congratulations for your excellent work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KS</title>
		<link>http://encosia.com/using-complex-types-to-make-calling-services-less-complex/#comment-54485</link>
		<dc:creator>KS</dc:creator>
		<pubDate>Fri, 16 Dec 2011 20:02:38 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=849#comment-54485</guid>
		<description>Ok.. I will try that.. Thx</description>
		<content:encoded><![CDATA[<p>Ok.. I will try that.. Thx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/using-complex-types-to-make-calling-services-less-complex/#comment-54481</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Fri, 16 Dec 2011 19:49:20 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=849#comment-54481</guid>
		<description>If some properties are missing in the JSON, it will work okay and those properties will be null.

One of the best ways to experiment quickly and figure out how these various cases will work is to use LINQPad. You can try all these simple examples in it without worrying about the complexity of building a whole service, client to consume it, etc.</description>
		<content:encoded><![CDATA[<p>If some properties are missing in the JSON, it will work okay and those properties will be null.</p>
<p>One of the best ways to experiment quickly and figure out how these various cases will work is to use LINQPad. You can try all these simple examples in it without worrying about the complexity of building a whole service, client to consume it, etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KS</title>
		<link>http://encosia.com/using-complex-types-to-make-calling-services-less-complex/#comment-54479</link>
		<dc:creator>KS</dc:creator>
		<pubDate>Fri, 16 Dec 2011 19:45:07 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=849#comment-54479</guid>
		<description>Sorry.. other question..

Hopefully this will solve my problem.. 

Is it ok if i will create myDTO for all my possible objects, reason for asking on different response JSON string will be different e.g one function return Person and COmpany other function return Person and Address..

So my question if i create general myDTO and pass only require JSON string is it going to be work??

e.g 

public class MyDTO {
  public Person person { get; set; }
  public Company company { get; set; }
  public Address address { get; set; }
}

and now i want to desirialze json string which has only Person and Address object or Person and Address object

{“Person”:{“ID”:”123″,”Name”:”Test”},”Company”:{“ID”:”123″,”Name”:”ABC”}}

Or,....

{“Person”:{“ID”:”123″,”Name”:”Test”},”Address”:{“City”:”Toronto″,”Country”:”Canada”}}


Then, I will use JavaScriptSerializer to deserialize that JSON into an object of type MyDTO, will it work or i have to create myDTO for each and every response??

Thank u very much in advance..</description>
		<content:encoded><![CDATA[<p>Sorry.. other question..</p>
<p>Hopefully this will solve my problem.. </p>
<p>Is it ok if i will create myDTO for all my possible objects, reason for asking on different response JSON string will be different e.g one function return Person and COmpany other function return Person and Address..</p>
<p>So my question if i create general myDTO and pass only require JSON string is it going to be work??</p>
<p>e.g </p>
<p>public class MyDTO {<br />
  public Person person { get; set; }<br />
  public Company company { get; set; }<br />
  public Address address { get; set; }<br />
}</p>
<p>and now i want to desirialze json string which has only Person and Address object or Person and Address object</p>
<p>{“Person”:{“ID”:”123″,”Name”:”Test”},”Company”:{“ID”:”123″,”Name”:”ABC”}}</p>
<p>Or,&#8230;.</p>
<p>{“Person”:{“ID”:”123″,”Name”:”Test”},”Address”:{“City”:”Toronto″,”Country”:”Canada”}}</p>
<p>Then, I will use JavaScriptSerializer to deserialize that JSON into an object of type MyDTO, will it work or i have to create myDTO for each and every response??</p>
<p>Thank u very much in advance..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KS</title>
		<link>http://encosia.com/using-complex-types-to-make-calling-services-less-complex/#comment-54477</link>
		<dc:creator>KS</dc:creator>
		<pubDate>Fri, 16 Dec 2011 19:32:24 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=849#comment-54477</guid>
		<description>Wow... It&#039;s seems some hope for me....

I will try that way.. and update you.

I really appreciate your very very quick help... Thank you very much..

Thanks for you time..</description>
		<content:encoded><![CDATA[<p>Wow&#8230; It&#8217;s seems some hope for me&#8230;.</p>
<p>I will try that way.. and update you.</p>
<p>I really appreciate your very very quick help&#8230; Thank you very much..</p>
<p>Thanks for you time..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/using-complex-types-to-make-calling-services-less-complex/#comment-54475</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Fri, 16 Dec 2011 19:22:59 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=849#comment-54475</guid>
		<description>It works the same backwards. You&#039;d need an object like:

&lt;pre lang=&quot;csharp&quot;&gt;public class MyDTO {
  public Person Person { get; set; }
  public Company Company { get; set; }
}&lt;/pre&gt;

Then, you can use JavaScriptSerializer to deserialize that JSON into an object of type MyDTO, which has properties matching the JSON&#039;s structure.</description>
		<content:encoded><![CDATA[<p>It works the same backwards. You&#8217;d need an object like:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> MyDTO <span style="color: #000000;">&#123;</span>
  <span style="color: #0600FF;">public</span> Person Person <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
  <span style="color: #0600FF;">public</span> Company Company <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Then, you can use JavaScriptSerializer to deserialize that JSON into an object of type MyDTO, which has properties matching the JSON&#8217;s structure.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

