<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web 3.0, 6 Bladed Razors, 7 Minute Abs &#187; SOAP</title>
	<atom:link href="http://www.zachleat.com/web/tag/soap/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zachleat.com/web</link>
	<description></description>
	<lastBuildDate>Fri, 30 Jul 2010 01:59:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Wash your mouth out with SOAP and the YUI Connection Manager</title>
		<link>http://www.zachleat.com/web/2007/05/09/wash-your-mouth-out-with-soap-and-the-yui-connection-manager/</link>
		<comments>http://www.zachleat.com/web/2007/05/09/wash-your-mouth-out-with-soap-and-the-yui-connection-manager/#comments</comments>
		<pubDate>Wed, 09 May 2007 22:56:58 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[SOAP]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2007/05/09/wash-your-mouth-out-with-soap-and-the-yui-connection-manager/</guid>
		<description><![CDATA[Now you&#8217;ve done it. You watched an R rated movie while your parents weren&#8217;t looking and used some of your newfound acquired colorful language in front of them. Your mom goes for the Dial Liquid Soap, she&#8217;s going to wash that profanity right out of your dirty little mouth. Harsh? Maybe, but I couldn&#8217;t say [...]]]></description>
			<content:encoded><![CDATA[<p>Now you&#8217;ve done it.  You watched an R rated movie while your parents weren&#8217;t looking and used some of your newfound acquired colorful language in front of them.  Your mom goes for the Dial Liquid Soap, she&#8217;s going to wash that profanity right out of your dirty little mouth.</p>
<p>Harsh?  Maybe, but I couldn&#8217;t say the word &#8216;Bastards&#8217; without feeling Dial on my cleansed taste buds.  Maybe I should take legal action against the cinematic classic &#8216;<a href="http://www.imdb.com/title/tt0102059/">Hot Shots</a>.&#8217;</p>
<p>What are we here for?  Not liquid soap, perhaps some profanity.  But really, you want to use the SOAP web services protocol with your Yahoo User Interface application, in particular the Connection Manager component.  This tutorial assumes you are at least familiar with <a href="http://developer.yahoo.com/yui/connection/">the examples provided on the Yahoo! UI Library: Connection Manager website</a>.</p>
<p>How is SOAP different than any other AJAX call using the Connection Manager?  Well, normally, when you perform an HTTP Post AJAX call, it is passing in a key-value pair string encoded with the normal key=value&#038;key2=value format.  But when doing a SOAP call, we want to post an XML SOAP Envelope to the server instead of this key-value pair string.  In case you&#8217;re reading this article and don&#8217;t know what a SOAP Envelope looks like, I&#8217;ll post a sample here:<br />
<code><br />
&lt;s11:Envelope xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"&gt;<br />
&lt;s11:Header&gt;<br />
&lt;/s11:Header&gt;<br />
&lt;s11:Body&gt;<br />
&lt;/s11:Body&gt;<br />
&lt;/s11:Envelope&gt;<br />
</code></p>
<p>Of course, it is beyond the scope of this article to argue whether a REST or a SOAP format for your Service Oriented Architecture is a better choice.  You&#8217;re stuck with SOAP, otherwise you wouldn&#8217;t have read this far.</p>
<p>So, let&#8217;s post our SOAP Envelope using the YUI Connection Manager with the code provided below:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> targetUrl <span style="color: #339933;">=</span> <span style="color: #3366CC;">'http://www.zachleat.com/postToServer.php'</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// this is not a real URL</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> callback <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
	success<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>o<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> root <span style="color: #339933;">=</span> o.<span style="color: #660066;">responseXML</span>.<span style="color: #660066;">documentElement</span><span style="color: #339933;">;</span> 
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> root.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'faultstring'</span> <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">// faultstring is a standard SOAP error message format</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> faultstring <span style="color: #339933;">=</span> root.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'faultstring'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">firstChild</span>.<span style="color: #660066;">nodeValue</span><span style="color: #339933;">;</span>
			<span style="color: #003366; font-weight: bold;">var</span> detailed <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
			YAHOO.<span style="color: #660066;">UP</span>.<span style="color: #660066;">util</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span> root.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'detail'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">childNodes</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> j<span style="color: #339933;">,</span> textNode <span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> textNode.<span style="color: #660066;">nodeValue</span> <span style="color: #339933;">!=</span> <span style="color: #003366; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span> detailed <span style="color: #339933;">+=</span> textNode.<span style="color: #660066;">nodeValue</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #006600; font-style: italic;">// do something with your error message stored in the faultstring variable, with a more detailed message in the detailed variable</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #006600; font-style: italic;">// this is an actual success.</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> 
	failure<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> o <span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #006600; font-style: italic;">// do something with your failure.</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> message <span style="color: #339933;">=</span> <span style="color: #3366CC;">'&lt;s11:Envelope...YOUR SOAP MESSAGE HERE'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// we need to set our own header.</span>
YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Connect</span>._use_default_post_header <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Connect</span>.<span style="color: #660066;">initHeader</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'Content-Type'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'text/xml'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> ajaxCall <span style="color: #339933;">=</span> YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Connect</span>.<span style="color: #660066;">asyncRequest</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'POST'</span><span style="color: #339933;">,</span> targetUrl<span style="color: #339933;">,</span> callback<span style="color: #339933;">,</span> message<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>I hope this code helps some of you bastards.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2007/05/09/wash-your-mouth-out-with-soap-and-the-yui-connection-manager/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>OMG SOA</title>
		<link>http://www.zachleat.com/web/2007/03/12/omg-soa/</link>
		<comments>http://www.zachleat.com/web/2007/03/12/omg-soa/#comments</comments>
		<pubDate>Tue, 13 Mar 2007 02:20:43 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[SOA]]></category>
		<category><![CDATA[SOAP]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2007/03/12/omg-soa/</guid>
		<description><![CDATA[In today&#8217;s Web 2.0 world of ultimate abstraction, you don&#8217;t need to be bothered with the rudimentary low level programming functions of everyday languages. Client Side implementation of JavaScript functions across the browser landscape is unreliable at best, so why should you trust it for anything? So using forward thinking and futureproof compatibility design, naturally [...]]]></description>
			<content:encoded><![CDATA[<p>In today&#8217;s Web 2.0 world of <strong>ultimate abstraction</strong>, you don&#8217;t need to be bothered with the rudimentary low level programming functions of everyday languages.  Client Side implementation of JavaScript functions across the browser landscape is unreliable at best, so why should you trust it for anything?  So using forward thinking and futureproof compatibility design, naturally we will turn to the next great phase of web&#8217;s evolutionary growth, the Service Oriented Architecture (SOA).  Using SOAP envelopes to package our function calls, I will now demo what is certainly to be the future of web development, and maybe, all programming endeavors.  I call it: <strong>OMG SOA</strong>.</p>
<div style="text-align: center; background: #fff"><a href='http://h-master.net/web2.0/index.php' title='OMG SOA'><img src='http://www.zachleat.com/web/wp-content/uploads/2007/03/reflectomg-soabeta.png' alt='OMG SOA' /></a></div>
<p>Are you programming a for loop?  How do you know that the client will increment your integers through the loop correctly?  That&#8217;s why you need to call our <strong>Incrementer Web Service</strong> to increment your loop counter.</p>
<p><em>Sample Service Calls</em>:<br />
Increment 0: <a href="http://www.zachleat.com/Projects/SOA/index.php/incrementer/0">http://www.zachleat.com/Projects/SOA/index.php/incrementer/0</a><br />
Increment 3920: <a href="http://www.zachleat.com/Projects/SOA/index.php/incrementer/3920">http://www.zachleat.com/Projects/SOA/index.php/incrementer/3920</a><br />
Increment 98: <a href="http://www.zachleat.com/Projects/SOA/index.php/incrementer/98">http://www.zachleat.com/Projects/SOA/index.php/incrementer/98</a></p>
<p>Are you programming an array that needs to be magically combined into a string?  Do you think you can reliably count on Internet Explorer to perform the function in the same way as your Firefox&#8217;s, or your Opera&#8217;s, or even your (God Forbid) Safari&#8217;s???  No, dare I say it, no.</p>
<p>But don&#8217;t fear.  We are here to comfort your pain, with a shot in the arm of standarditity.  Welcome the <strong>String Concatenation Web Service</strong>.</p>
<p><em>Sample Service Call</em>:<br />
Concatenate string1 with string2 with string3: <a href="http://www.zachleat.com/Projects/SOA/index.php/concat/string1/string2/string3/">http://www.zachleat.com/Projects/SOA/index.php/concat/string1/string2/string3/</a></p>
<p>And finally, are you feeling lost in this sea of amorphous web technologies mixing and mashing together to form the gelatinous blob of money and media whores we know as Web 2.0?  Don&#8217;t worry, OMG SOA is here for you again to solve all of your identity crisis problems.  Ask our <strong>Are you Web 2.0 Web Service</strong> with your URL and the magic 8 ball service will answer your question.</p>
<p><em>Sample Service Call</em>:<br />
Is www.zachleat.com Web 2.0? <a href="http://www.zachleat.com/Projects/SOA/index.php/am-i-web-2.0/www.zachleat.com/">http://www.zachleat.com/Projects/SOA/index.php/am-i-web-2.0/www.zachleat.com/</a></p>
<p><strong>Update</strong>: apparently there is already a company called the Object Management Group with a <a href="http://soa.omg.org/">website about SOA</a>.  Whoops?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/2007/03/12/omg-soa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
