<?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:58 GMT--><feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><title>blog</title><subtitle>blog</subtitle><id>http://www.fischco.org/blog/</id><link rel="alternate" type="application/xhtml+xml" href="http://www.fischco.org/blog/"/><link rel="self" type="application/atom+xml" href="http://www.fischco.org/blog/atom.xml"/><updated>2011-03-31T20:04:39Z</updated><generator uri="http://www.squarespace.com/" version="Squarespace Site Server v5.11.81 (http://www.squarespace.com/)">Squarespace</generator><entry><title>Ready for adventure with grandparents</title><id>http://www.fischco.org/blog/2011/3/31/ready-for-adventure-with-grandparents.html</id><link rel="alternate" type="text/html" href="http://www.fischco.org/blog/2011/3/31/ready-for-adventure-with-grandparents.html"/><author><name>Mark Fischer</name></author><published>2011-03-31T20:04:39Z</published><updated>2011-03-31T20:04:39Z</updated><content type="html" xml:lang="en-US"><![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>]]></content></entry><entry><title>PHP SoapServer, Objects, Arrays, and encoding</title><category term="Geek"/><category term="Programming"/><category term="php"/><category term="soap"/><category term="web service"/><id>http://www.fischco.org/blog/2011/3/26/php-soapserver-objects-arrays-and-encoding.html</id><link rel="alternate" type="text/html" href="http://www.fischco.org/blog/2011/3/26/php-soapserver-objects-arrays-and-encoding.html"/><author><name>Mark Fischer</name></author><published>2011-03-26T17:40:55Z</published><updated>2011-03-26T17:40:55Z</updated><content type="html" xml:lang="en-US"><![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>
]]></content></entry><entry><title>Gingerbread House</title><category term="Kirin"/><category term="timelapse"/><id>http://www.fischco.org/blog/2010/12/12/gingerbread-house.html</id><link rel="alternate" type="text/html" href="http://www.fischco.org/blog/2010/12/12/gingerbread-house.html"/><author><name>Mark Fischer</name></author><published>2010-12-12T17:56:10Z</published><updated>2010-12-12T17:56:10Z</updated><content type="html" xml:lang="en-US"><![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>
]]></content></entry><entry><title>Tonight's Train Layout</title><id>http://www.fischco.org/blog/2010/9/17/tonights-train-layout.html</id><link rel="alternate" type="text/html" href="http://www.fischco.org/blog/2010/9/17/tonights-train-layout.html"/><author><name>Mark Fischer</name></author><published>2010-09-17T02:26:26Z</published><updated>2010-09-17T02:26:26Z</updated><content type="html" xml:lang="en-US"><![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>]]></content></entry><entry><title>Pumpkin!</title><id>http://www.fischco.org/blog/2010/9/17/pumpkin.html</id><link rel="alternate" type="text/html" href="http://www.fischco.org/blog/2010/9/17/pumpkin.html"/><author><name>Mark Fischer</name></author><published>2010-09-17T00:41:24Z</published><updated>2010-09-17T00:41:24Z</updated><content type="html" xml:lang="en-US"><![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>]]></content></entry><entry><title>My Girls</title><id>http://www.fischco.org/blog/2010/6/24/my-girls.html</id><link rel="alternate" type="text/html" href="http://www.fischco.org/blog/2010/6/24/my-girls.html"/><author><name>Mark Fischer</name></author><published>2010-06-24T01:13:25Z</published><updated>2010-06-24T01:13:25Z</updated><content type="html" xml:lang="en-US"><![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>]]></content></entry><entry><title>Darla</title><id>http://www.fischco.org/blog/2010/6/24/darla.html</id><link rel="alternate" type="text/html" href="http://www.fischco.org/blog/2010/6/24/darla.html"/><author><name>Mark Fischer</name></author><published>2010-06-24T01:12:27Z</published><updated>2010-06-24T01:12:27Z</updated><content type="html" xml:lang="en-US"><![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>]]></content></entry><entry><title>Reid Park</title><id>http://www.fischco.org/blog/2010/4/26/reid-park.html</id><link rel="alternate" type="text/html" href="http://www.fischco.org/blog/2010/4/26/reid-park.html"/><author><name>Mark Fischer</name></author><published>2010-04-26T05:37:31Z</published><updated>2010-04-26T05:37:31Z</updated><content type="html" xml:lang="en-US"><![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>]]></content></entry><entry><title>Kirin Turns 3</title><id>http://www.fischco.org/blog/2010/4/21/kirin-turns-3.html</id><link rel="alternate" type="text/html" href="http://www.fischco.org/blog/2010/4/21/kirin-turns-3.html"/><author><name>Mark Fischer</name></author><published>2010-04-21T01:21:47Z</published><updated>2010-04-21T01:21:47Z</updated><content type="html" xml:lang="en-US"><![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>]]></content></entry><entry><title>UITS Circuit People - It Works!</title><category term="Arduino"/><category term="Geek"/><category term="UITS"/><id>http://www.fischco.org/blog/2010/4/10/uits-circuit-people-it-works.html</id><link rel="alternate" type="text/html" href="http://www.fischco.org/blog/2010/4/10/uits-circuit-people-it-works.html"/><author><name>Mark Fischer</name></author><published>2010-04-11T05:26:17Z</published><updated>2010-04-11T05:26:17Z</updated><content type="html" xml:lang="en-US"><![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>
]]></content></entry></feed>
