<?xml version="1.0" encoding="UTF-8"?>
<!--Generated by Squarespace Site Server v5.11.81 (http://www.squarespace.com/) on Thu, 16 Feb 2012 00:57:46 GMT--><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>blog</title><link>http://www.fischco.org/blog/</link><description></description><lastBuildDate>Thu, 31 Mar 2011 20:04:39 +0000</lastBuildDate><copyright></copyright><language>en-US</language><generator>Squarespace Site Server v5.11.81 (http://www.squarespace.com/)</generator><item><title>Ready for adventure with grandparents</title><dc:creator>Mark Fischer</dc:creator><pubDate>Thu, 31 Mar 2011 20:04:39 +0000</pubDate><link>http://www.fischco.org/blog/2011/3/31/ready-for-adventure-with-grandparents.html</link><guid isPermaLink="false">322878:3386806:11009950</guid><description><![CDATA[
<div style="text-align: left; padding: 3px;">
<a href="http://www.flickr.com/photos/fischco/5566309323/" title="photo sharing"><img src="http://farm6.static.flickr.com/5267/5566309323_6116c96617.jpg" style="border: solid 2px #000000;" alt="" /></a>
<br />
<span style="font-size: 0.8em; margin-top: 0px;"><a href="http://www.flickr.com/photos/fischco/5566309323/">Ready for adventure with grandparents</a>, originally uploaded by <a href="http://www.flickr.com/photos/fischco/">estranged42</a>.</span>
</div>
<p>
Kirin is off at my parent's house this week.  The house is so quiet without her around!  It's hard to see her grow up so fast!
</p>]]></description><wfw:commentRss>http://www.fischco.org/blog/rss-comments-entry-11009950.xml</wfw:commentRss></item><item><title>PHP SoapServer, Objects, Arrays, and encoding</title><category>Geek</category><category>Programming</category><category>php</category><category>soap</category><category>web service</category><dc:creator>Mark Fischer</dc:creator><pubDate>Sat, 26 Mar 2011 17:40:55 +0000</pubDate><link>http://www.fischco.org/blog/2011/3/26/php-soapserver-objects-arrays-and-encoding.html</link><guid isPermaLink="false">322878:3386806:10923439</guid><description><![CDATA[<p>I ran into an bothersome problem with PHP&#8217;s <a href="http://php.net/manual/en/class.soapserver.php">SoapServer</a> class this week.  Here&#8217;s what I wanted as output from the server:</p>

<pre><code>&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
   &lt;SOAP-ENV:Body&gt;
      &lt;locationCollection&gt;
         &lt;Location&gt;
            &lt;name&gt;AME s438&lt;/name&gt;
            &lt;id&gt;452&lt;/id&gt;
            &lt;latitude&gt;32.236322&lt;/latitude&gt;
            &lt;longitude&gt;-110.951614&lt;/longitude&gt;
         &lt;/Location&gt;
         &lt;Location&gt;
            &lt;name&gt;ECE 229&lt;/name&gt;
            &lt;id&gt;45&lt;/id&gt;
            &lt;latitude&gt;32.235069&lt;/latitude&gt;
            &lt;longitude&gt;-110.953417&lt;/longitude&gt;
         &lt;/Location&gt;
      &lt;/locationCollection&gt;
   &lt;/SOAP-ENV:Body&gt;
&lt;/SOAP-ENV:Envelope&gt;
</code></pre>

<p>However what I was getting instead was: </p>

<pre><code>&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
   &lt;SOAP-ENV:Body&gt;
      &lt;locationCollection&gt;
         &lt;SOAP-ENC:Struct&gt;
            &lt;name&gt;AME s438&lt;/name&gt;
            &lt;id&gt;452&lt;/id&gt;
            &lt;latitude&gt;32.236322&lt;/latitude&gt;
            &lt;longitude&gt;-110.951614&lt;/longitude&gt;
         &lt;/SOAP-ENC:Struct&gt;
         &lt;SOAP-ENC:Struct&gt;
            &lt;name&gt;ECE 229&lt;/name&gt;
            &lt;id&gt;45&lt;/id&gt;
            &lt;latitude&gt;32.235069&lt;/latitude&gt;
            &lt;longitude&gt;-110.953417&lt;/longitude&gt;
         &lt;/SOAP-ENC:Struct&gt;
      &lt;/locationCollection&gt;
   &lt;/SOAP-ENV:Body&gt;
&lt;/SOAP-ENV:Envelope&gt;
</code></pre>

<p>Here was my original code for the server:</p>

<pre><code>&lt;?php
$wsdl = 'http://example.com/locations_service.wsdl';
$service = new SoapServer($wsdl);

$service-&gt;addFunction('getComputerLabs');
$service-&gt;handle();

function getComputerLabs($input) {
  $all_locations = resource::get_all(FALSE, 'location');

  $return_array = array();

  foreach ($all_locations as $l) {

    // Build a basic return object.
    $new_loc = new Location();
    $new_loc-&gt;name = $l-&gt;name;
    $new_loc-&gt;id = $l-&gt;resource_id;
    $new_loc-&gt;latitude = $l-&gt;getProperty('Latitude');
    $new_loc-&gt;longitude = $l-&gt;getProperty('Longitude');

    $return_array[] = $new_loc;
  }

  return $return_array;
}

class Location {
    public $name;
    public $id;
    public $description;
    public $url;
    public $buildingName;
    public $roomNumber;
    public $openStatus;
    public $latitude;
    public $longitude;
}
?&gt;
</code></pre>

<p>Apparently the SOAP library really prefers that everything is an object.  In php 5 they added an <a href="http://www.php.net/manual/en/class.arrayobject.php">ArrayObject</a> class.  This coupled with a SoapVar call fixed my output for me.</p>

<pre><code>&lt;?php
function getComputerLabs($input) {
  $all_locations = resource::get_all(FALSE, 'location');

  /**
   * Use an ArrayObject instead of a plain array.
   */
  $return_array = new ArrayObject();

  foreach ($all_locations as $l) {

    // Build a basic return object.
    $new_loc = new Location();
    $new_loc-&gt;name = $l-&gt;name;
    $new_loc-&gt;id = $l-&gt;resource_id;
    $new_loc-&gt;latitude = $l-&gt;getProperty('Latitude');
    $new_loc-&gt;longitude = $l-&gt;getProperty('Longitude');

    /**
     * Encode each array element with SoapVar.  Parameter 5 is the name of the
     * XML element you want to use.  This only seems to work within
     * an ArrayObject.
     */
    $new_loc = new SoapVar($new_loc, SOAP_ENC_OBJECT, null, null, 'Location');

    $return_array-&gt;append($new_loc);
  }

  return $return_array;
}
?&gt;
</code></pre>

<p>Note that with only the ArrayObject part, and before I figured out the SoapVar wrapper, I was getting this interesting BOGUS tag:</p>

<pre><code>&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;
   &lt;SOAP-ENV:Body&gt;
      &lt;locationCollection&gt;
         &lt;BOGUS&gt;
            &lt;name&gt;AME s438&lt;/name&gt;
            &lt;id&gt;452&lt;/id&gt;
            &lt;latitude&gt;32.236322&lt;/latitude&gt;
            &lt;longitude&gt;-110.951614&lt;/longitude&gt;
         &lt;/BOGUS&gt;
         &lt;BOGUS&gt;
            &lt;name&gt;ECE 229&lt;/name&gt;
            &lt;id&gt;45&lt;/id&gt;
            &lt;latitude&gt;32.235069&lt;/latitude&gt;
            &lt;longitude&gt;-110.953417&lt;/longitude&gt;
         &lt;/BOGUS&gt;
      &lt;/locationCollection&gt;
   &lt;/SOAP-ENV:Body&gt;
&lt;/SOAP-ENV:Envelope&gt;
</code></pre>
]]></description><wfw:commentRss>http://www.fischco.org/blog/rss-comments-entry-10923439.xml</wfw:commentRss></item><item><title>Gingerbread House</title><category>Kirin</category><category>timelapse</category><dc:creator>Mark Fischer</dc:creator><pubDate>Sun, 12 Dec 2010 17:56:10 +0000</pubDate><link>http://www.fischco.org/blog/2010/12/12/gingerbread-house.html</link><guid isPermaLink="false">322878:3386806:9709650</guid><description><![CDATA[<div style="text-align: left; padding: 3px;"><object type="application/x-shockwave-flash" width="500" height="375" data="http://www.flickr.com/apps/video/stewart.swf?v=71377" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"> <param name="flashvars" value="intl_lang=en-us&photo_secret=c9f88325fd&photo_id=5254389085&flickr_show_info_box=true"></param> <param name="movie" value="http://www.flickr.com/apps/video/stewart.swf?v=71377"></param> <param name="bgcolor" value="#000000"></param> <param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="http://www.flickr.com/apps/video/stewart.swf?v=71377" bgcolor="#000000" allowfullscreen="true" flashvars="intl_lang=en-us&photo_secret=c9f88325fd&photo_id=5254389085&flickr_show_info_box=true" height="375" width="500"></embed></object> <br /> <span style="font-size: 0.8em; margin-top: 0px;"><a href="http://www.flickr.com/photos/fischco/5254389085/">GingerbreadHouse</a>, originally uploaded by <a href="http://www.flickr.com/people/fischco/">estranged42</a>.</span></div>
<p class="flickr-yourcomment">&nbsp;</p>
]]></description><wfw:commentRss>http://www.fischco.org/blog/rss-comments-entry-9709650.xml</wfw:commentRss></item><item><title>Tonight's Train Layout</title><dc:creator>Mark Fischer</dc:creator><pubDate>Fri, 17 Sep 2010 02:26:26 +0000</pubDate><link>http://www.fischco.org/blog/2010/9/17/tonights-train-layout.html</link><guid isPermaLink="false">322878:3386806:8908794</guid><description><![CDATA[
<div style="text-align: left; padding: 3px;">
<a href="http://www.flickr.com/photos/fischco/4997085421/" title="photo sharing"><img src="http://farm5.static.flickr.com/4133/4997085421_cdce71958a.jpg" style="border: solid 2px #000000;" alt="" /></a>
<br />
<span style="font-size: 0.8em; margin-top: 0px;"><a href="http://www.flickr.com/photos/fischco/4997085421/">Tonight's Train Layout</a>, originally uploaded by <a href="http://www.flickr.com/people/fischco/">estranged42</a>.</span>
</div>
<p>

</p>]]></description><wfw:commentRss>http://www.fischco.org/blog/rss-comments-entry-8908794.xml</wfw:commentRss></item><item><title>Pumpkin!</title><dc:creator>Mark Fischer</dc:creator><pubDate>Fri, 17 Sep 2010 00:41:24 +0000</pubDate><link>http://www.fischco.org/blog/2010/9/17/pumpkin.html</link><guid isPermaLink="false">322878:3386806:8907964</guid><description><![CDATA[
<div style="text-align: left; padding: 3px;">
<a href="http://www.flickr.com/photos/fischco/4997458360/" title="photo sharing"><img src="http://farm5.static.flickr.com/4091/4997458360_5927f980e3.jpg" style="border: solid 2px #000000;" alt="" /></a>
<br />
<span style="font-size: 0.8em; margin-top: 0px;"><a href="http://www.flickr.com/photos/fischco/4997458360/">Pumpkin!</a>, originally uploaded by <a href="http://www.flickr.com/people/fischco/">estranged42</a>.</span>
</div>
<p>
First pumpkin of the season!
</p>]]></description><wfw:commentRss>http://www.fischco.org/blog/rss-comments-entry-8907964.xml</wfw:commentRss></item><item><title>My Girls</title><dc:creator>Mark Fischer</dc:creator><pubDate>Thu, 24 Jun 2010 01:13:25 +0000</pubDate><link>http://www.fischco.org/blog/2010/6/24/my-girls.html</link><guid isPermaLink="false">322878:3386806:8068979</guid><description><![CDATA[
<div style="text-align: left; padding: 3px;">
<a href="http://www.flickr.com/photos/fischco/4727680285/" title="photo sharing"><img src="http://farm2.static.flickr.com/1351/4727680285_20569d95f2.jpg" style="border: solid 2px #000000;" alt="" /></a>
<br />
<span style="font-size: 0.8em; margin-top: 0px;"><a href="http://www.flickr.com/photos/fischco/4727680285/">IMG_3204</a>, originally uploaded by <a href="http://www.flickr.com/people/fischco/">estranged42</a>.</span>
</div>
<p>

</p>]]></description><wfw:commentRss>http://www.fischco.org/blog/rss-comments-entry-8068979.xml</wfw:commentRss></item><item><title>Darla</title><dc:creator>Mark Fischer</dc:creator><pubDate>Thu, 24 Jun 2010 01:12:27 +0000</pubDate><link>http://www.fischco.org/blog/2010/6/24/darla.html</link><guid isPermaLink="false">322878:3386806:8068974</guid><description><![CDATA[
<div style="text-align: left; padding: 3px;">
<a href="http://www.flickr.com/photos/fischco/4728323770/" title="photo sharing"><img src="http://farm2.static.flickr.com/1066/4728323770_2730fdaa2a.jpg" style="border: solid 2px #000000;" alt="" /></a>
<br />
<span style="font-size: 0.8em; margin-top: 0px;"><a href="http://www.flickr.com/photos/fischco/4728323770/">IMG_3194</a>, originally uploaded by <a href="http://www.flickr.com/people/fischco/">estranged42</a>.</span>
</div>
<p>
Guess what I got for Father's Day!
</p>]]></description><wfw:commentRss>http://www.fischco.org/blog/rss-comments-entry-8068974.xml</wfw:commentRss></item><item><title>Reid Park</title><dc:creator>Mark Fischer</dc:creator><pubDate>Mon, 26 Apr 2010 05:37:31 +0000</pubDate><link>http://www.fischco.org/blog/2010/4/26/reid-park.html</link><guid isPermaLink="false">322878:3386806:7446654</guid><description><![CDATA[
<div style="text-align: left; padding: 3px;">
<a href="http://www.flickr.com/photos/fischco/4551387781/" title="photo sharing"><img src="http://farm4.static.flickr.com/3014/4551387781_d1b847b745.jpg" style="border: solid 2px #000000;" alt="" /></a>
<br />
<span style="font-size: 0.8em; margin-top: 0px;"><a href="http://www.flickr.com/photos/fischco/4551387781/">Reid Park</a>, originally uploaded by <a href="http://www.flickr.com/people/fischco/">estranged42</a>.</span>
</div>
<p>
Kirin and I wandered around Reid Park this Saturday.  Couldn't pass up this shot!
</p>]]></description><wfw:commentRss>http://www.fischco.org/blog/rss-comments-entry-7446654.xml</wfw:commentRss></item><item><title>Kirin Turns 3</title><dc:creator>Mark Fischer</dc:creator><pubDate>Wed, 21 Apr 2010 01:21:47 +0000</pubDate><link>http://www.fischco.org/blog/2010/4/21/kirin-turns-3.html</link><guid isPermaLink="false">322878:3386806:7399841</guid><description><![CDATA[
<div style="text-align: left; padding: 3px;">
<a href="http://www.flickr.com/photos/fischco/4538981825/" title="photo sharing"><img src="http://farm5.static.flickr.com/4032/4538981825_c1469dc78c.jpg" style="border: solid 2px #000000;" alt="" /></a>
<br />
<span style="font-size: 0.8em; margin-top: 0px;"><a href="http://www.flickr.com/photos/fischco/4538981825/">IMG_3116</a>, originally uploaded by <a href="http://www.flickr.com/people/fischco/">estranged42</a>.</span>
</div>
<p>
Kirin had her 3rd birthday party up in Phoenix this past weekend.  Much fun was had by all!
</p>]]></description><wfw:commentRss>http://www.fischco.org/blog/rss-comments-entry-7399841.xml</wfw:commentRss></item><item><title>UITS Circuit People - It Works!</title><category>Arduino</category><category>Geek</category><category>UITS</category><dc:creator>Mark Fischer</dc:creator><pubDate>Sun, 11 Apr 2010 05:26:17 +0000</pubDate><link>http://www.fischco.org/blog/2010/4/10/uits-circuit-people-it-works.html</link><guid isPermaLink="false">322878:3386806:7292776</guid><description><![CDATA[<div style="text-align: left; padding: 3px;"><object type="application/x-shockwave-flash" width="500" height="375" data="http://www.flickr.com/apps/video/stewart.swf?v=71377" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"> <param name="flashvars" value="intl_lang=en-us&photo_secret=871e9839c3&photo_id=4509449713&flickr_show_info_box=true"></param> <param name="movie" value="http://www.flickr.com/apps/video/stewart.swf?v=71377"></param> <param name="bgcolor" value="#000000"></param> <param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="http://www.flickr.com/apps/video/stewart.swf?v=71377" bgcolor="#000000" allowfullscreen="true" flashvars="intl_lang=en-us&photo_secret=871e9839c3&photo_id=4509449713&flickr_show_info_box=true" height="375" width="500"></embed></object> <br /> <span style="font-size: 0.8em; margin-top: 0px;"><a href="http://www.flickr.com/photos/fischco/4509449713/">UITS Circuit People</a>, originally uploaded by <a href="http://www.flickr.com/people/fischco/">estranged42</a>.</span></div>
<p class="flickr-yourcomment">Well, I populated the circuit board tonight, soldered up all the components, tossed in some batteries, and flipped the switch!<br /> <br /> And nothing happened.<br /> <br /> After ten minutes or so poking at the traces with my multimeter, I discovered that I have one trace out of place leading into the power switch.  Fortunately a simple jumper from one pin to another on the switch was able to fix the problem.  And it worked!<br /> <br /> I have to admit, this thing looks pretty damn good!  Not too shabby for my first PCB layout and project.  I think I started toying around with this design over a year ago, so it&#8217;s pretty cool to actually hold a real, physical, blinking thing in my hands.</p>
<p class="flickr-yourcomment">&nbsp;</p>
<p class="flickr-yourcomment"><a href="http://www.fischco.org/storage/arduino/UITS%20Circuit%20People%20Mega8.zip">UITS Circuit People EAGLE Schematic Files</a></p>
<p class="flickr-yourcomment">&nbsp;</p>
]]></description><wfw:commentRss>http://www.fischco.org/blog/rss-comments-entry-7292776.xml</wfw:commentRss></item></channel></rss>
