<?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: Pre-Process Web Service Responses</title>
	<atom:link href="http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/feed/" rel="self" type="application/rss+xml" />
	<link>http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/</link>
	<description>Building intelligent forms using Adobe LiveCycle Designer</description>
	<lastBuildDate>Thu, 19 Jan 2012 16:32:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Justin</title>
		<link>http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/#comment-7032</link>
		<dc:creator>Justin</dc:creator>
		<pubDate>Fri, 30 Oct 2009 02:56:12 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/#comment-7032</guid>
		<description>Hi Stefan,
I recently used your pre-processor snippet in a government form I built to call a web service. It was very easy to follow and to use. Would you be able to confirm for me that given the return of web service call triggers an event that the actual web service call is asynchronous? I actually make the call right before I submit the form to our livecycle server however I noticed that we won&#039;t always get data populated. So does the javascript call the web service and then continue on execution, or does it actually stop and wait for a response from the web service. Is there a way to make the web service call synchronous?

Regards

Justin</description>
		<content:encoded><![CDATA[<p>Hi Stefan,<br />
I recently used your pre-processor snippet in a government form I built to call a web service. It was very easy to follow and to use. Would you be able to confirm for me that given the return of web service call triggers an event that the actual web service call is asynchronous? I actually make the call right before I submit the form to our livecycle server however I noticed that we won&#8217;t always get data populated. So does the javascript call the web service and then continue on execution, or does it actually stop and wait for a response from the web service. Is there a way to make the web service call synchronous?</p>
<p>Regards</p>
<p>Justin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Norbert</title>
		<link>http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/#comment-7031</link>
		<dc:creator>Norbert</dc:creator>
		<pubDate>Mon, 31 Aug 2009 08:31:52 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/#comment-7031</guid>
		<description>Hi stefan,
works great!!! Thanks a lot, if you ever visit vienna send me a mail!

br
norbert</description>
		<content:encoded><![CDATA[<p>Hi stefan,<br />
works great!!! Thanks a lot, if you ever visit vienna send me a mail!</p>
<p>br<br />
norbert</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/#comment-7030</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Wed, 26 Aug 2009 15:01:36 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/#comment-7030</guid>
		<description>Norbert,

I&#039;m afraid I forgot to access the &quot;value&quot; property everywhere in my script (from comment #3 above) where I access a node property in the &quot;returnNode&quot; variable.

Thanks for pointing this out to me. I have updated the script in the comment with the changes.</description>
		<content:encoded><![CDATA[<p>Norbert,</p>
<p>I&#8217;m afraid I forgot to access the &#8220;value&#8221; property everywhere in my script (from comment #3 above) where I access a node property in the &#8220;returnNode&#8221; variable.</p>
<p>Thanks for pointing this out to me. I have updated the script in the comment with the changes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Norbert</title>
		<link>http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/#comment-7029</link>
		<dc:creator>Norbert</dc:creator>
		<pubDate>Wed, 26 Aug 2009 14:31:48 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/#comment-7029</guid>
		<description>stefan,
thanks for your reply! working good till to the point where i want to adress the fields of the returnNode!
scripting stops  at &quot;KUNNR.addItem(returnNode.theName, returnNode.theId);&quot; and if i drop it, teh &quot;utils.itemMap&quot; is empty, too.
if i try with messages he declares returnNode.city  beiing an &quot;xfa object&quot;, but returnNode.city.value is &quot;null&quot;

thanks in advance!</description>
		<content:encoded><![CDATA[<p>stefan,<br />
thanks for your reply! working good till to the point where i want to adress the fields of the returnNode!<br />
scripting stops  at &#8220;KUNNR.addItem(returnNode.theName, returnNode.theId);&#8221; and if i drop it, teh &#8220;utils.itemMap&#8221; is empty, too.<br />
if i try with messages he declares returnNode.city  beiing an &#8220;xfa object&#8221;, but returnNode.city.value is &#8220;null&#8221;</p>
<p>thanks in advance!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Cameron</title>
		<link>http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/#comment-7028</link>
		<dc:creator>Stefan Cameron</dc:creator>
		<pubDate>Fri, 07 Aug 2009 14:27:31 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/#comment-7028</guid>
		<description>Norbert,

If rootXml.customersByIdResponse.return is an &quot;array&quot;, then I&#039;m assuming that rootXml.customersByIdResponse has multiple &quot;return&quot; nodes underneath it. In that case, you would do something like this:

&lt;pre&gt;&lt;code&gt;// JavaScript:

utils.itemMap = new Object(); // initialize map
KUNNR.clearItems(); // initialize list

for (var i = 0; i &lt; rootXml.customersByIdResponse.nodes.length; i++)
{
    var returnNode = rootXml.customersByIdResponse.nodes.item(i);

    // add new list item setting name as item text (displayed)
    //  and id as item value (hidden)
    KUNNR.addItem(returnNode.theName.value, returnNode.theId.value);

    // add entry to itemMap for this node which is an object that
    //  contains three properties: city, country, street
    utils.itemMap[returnNode.theId.value] =
        {city: returnNode.city.value, country: returnNode.country.value,
        street: returnNode.street.value};
}&lt;/code&gt;&lt;/pre&gt;

Later, in the KUNNR&#039;s Change event, you can retrieve the city, country and street info like this:

&lt;pre&gt;&lt;code&gt;// JavaScript:

var selectedId = this.boundItem(xfa.event.newText);
var itemInfo = utils.itemMap[selectedId];

xfa.host.messageBox(&quot;Selected item info: &quot; + itemInfo.city + &quot; &quot; +
    itemInfo.country + &quot; &quot; + itemInfo.street);&lt;/code&gt;&lt;/pre&gt;

Notes:
&lt;ul&gt;
&lt;li&gt;I changed &quot;id&quot; and &quot;name&quot; to &quot;theId&quot; and &quot;theName&quot; because using &quot;id&quot; and &quot;name&quot; and node names can cause conflicts because these are also properties on almost all XFA objects.&lt;/li&gt;
&lt;li&gt;I&#039;m assuming you have a Script Object named &quot;utils&quot; in which there is a declaration of a variable named &quot;itemMap&quot;: &quot;var itemMap = null;&quot; Variables in Script Objects keep their values as long as the Form DOM isn&#039;t reset.&lt;/li&gt;
&lt;li&gt;On an object variable, obj[&quot;string&quot;] adds a new dynamic property to that object that is named &quot;string&quot;.&lt;/li&gt;
&lt;li&gt;You can create new objects with dynamic properties with the following syntax: {propertyName: propertyValue, ...}&lt;/li&gt;
&lt;/ul&gt;
&lt;br&gt;
&lt;b&gt;Aug 26, 2009&lt;/b&gt; &#8212; Fixed script by adding &quot;.value&quot; property accessors on node properties within the &quot;returnNode&quot; object.</description>
		<content:encoded><![CDATA[<p>Norbert,</p>
<p>If rootXml.customersByIdResponse.return is an &#8220;array&#8221;, then I&#8217;m assuming that rootXml.customersByIdResponse has multiple &#8220;return&#8221; nodes underneath it. In that case, you would do something like this:</p>
<pre><code>// JavaScript:

utils.itemMap = new Object(); // initialize map
KUNNR.clearItems(); // initialize list

for (var i = 0; i < rootXml.customersByIdResponse.nodes.length; i++)
{
    var returnNode = rootXml.customersByIdResponse.nodes.item(i);

    // add new list item setting name as item text (displayed)
    //  and id as item value (hidden)
    KUNNR.addItem(returnNode.theName.value, returnNode.theId.value);

    // add entry to itemMap for this node which is an object that
    //  contains three properties: city, country, street
    utils.itemMap[returnNode.theId.value] =
        {city: returnNode.city.value, country: returnNode.country.value,
        street: returnNode.street.value};
}</code></code></pre>
<p>Later, in the KUNNR's Change event, you can retrieve the city, country and street info like this:</p>
<pre><code>// JavaScript:

var selectedId = this.boundItem(xfa.event.newText);
var itemInfo = utils.itemMap[selectedId];

xfa.host.messageBox("Selected item info: " + itemInfo.city + " " +
    itemInfo.country + " " + itemInfo.street);</code></pre>
<p>Notes:</p>
<ul>
<li>I changed "id" and "name" to "theId" and "theName" because using "id" and "name" and node names can cause conflicts because these are also properties on almost all XFA objects.</li>
<li>I'm assuming you have a Script Object named "utils" in which there is a declaration of a variable named "itemMap": "var itemMap = null;" Variables in Script Objects keep their values as long as the Form DOM isn't reset.</li>
<li>On an object variable, obj["string"] adds a new dynamic property to that object that is named "string".</li>
<li>You can create new objects with dynamic properties with the following syntax: {propertyName: propertyValue, ...}</li>
</ul>
<p>
<b>Aug 26, 2009</b> &mdash; Fixed script by adding ".value" property accessors on node properties within the "returnNode" object.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Norbert</title>
		<link>http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/#comment-7027</link>
		<dc:creator>Norbert</dc:creator>
		<pubDate>Thu, 30 Jul 2009 14:53:13 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/#comment-7027</guid>
		<description>function processResponse(rootXml, soapFault)
{
	KUNNR.clearItems();

	if (rootXml)
	{
		Name.rawValue = rootXml.customersByIdResponse.return.name.value;
		ORT.rawValue = rootXml.customersByIdResponse.return.city.value;
		LAND.rawValue = rootXml.customersByIdResponse.return.country.value;
		STRASSE.rawValue = rootXml.customersByIdResponse.return.street.value;
	}
	else if (soapFault)
	{
		//ListBox1.addItem(&quot;Fault code: &quot; + soapFault.code);
		//ListBox1.addItem(&quot;Fault message: &quot; + soapFault.message);
	}
}

&quot;return&quot; is the array and i populate the ddlb with &quot;name&quot; and &quot;id&quot; but want to read the &quot;city&quot;, &quot;country&quot; &quot;street&quot; later (when the user selects one entry of the dropdownlistbox)</description>
		<content:encoded><![CDATA[<p>function processResponse(rootXml, soapFault)<br />
{<br />
	KUNNR.clearItems();</p>
<p>	if (rootXml)<br />
	{<br />
		Name.rawValue = rootXml.customersByIdResponse.return.name.value;<br />
		ORT.rawValue = rootXml.customersByIdResponse.return.city.value;<br />
		LAND.rawValue = rootXml.customersByIdResponse.return.country.value;<br />
		STRASSE.rawValue = rootXml.customersByIdResponse.return.street.value;<br />
	}<br />
	else if (soapFault)<br />
	{<br />
		//ListBox1.addItem(&#8220;Fault code: &#8221; + soapFault.code);<br />
		//ListBox1.addItem(&#8220;Fault message: &#8221; + soapFault.message);<br />
	}<br />
}</p>
<p>&#8220;return&#8221; is the array and i populate the ddlb with &#8220;name&#8221; and &#8220;id&#8221; but want to read the &#8220;city&#8221;, &#8220;country&#8221; &#8220;street&#8221; later (when the user selects one entry of the dropdownlistbox)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Norbert</title>
		<link>http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/#comment-7026</link>
		<dc:creator>Norbert</dc:creator>
		<pubDate>Thu, 30 Jul 2009 14:45:49 +0000</pubDate>
		<guid isPermaLink="false">http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/#comment-7026</guid>
		<description>thanks for this article, works fine!
but what if the result of the service is an array and i want to read the single items??

please help me, i tried to populate a drop down list box (worked via binding).
but if the answer of the webservice contained more information i wanted to store it in a table and i failed...</description>
		<content:encoded><![CDATA[<p>thanks for this article, works fine!<br />
but what if the result of the service is an array and i want to read the single items??</p>
<p>please help me, i tried to populate a drop down list box (worked via binding).<br />
but if the answer of the webservice contained more information i wanted to store it in a table and i failed&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

