<?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>Pete Tracey &#187; Keyring Labs</title>
	<atom:link href="http://www.petetracey.com/category/keyring-labs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.petetracey.com</link>
	<description>A blog about music and technology and miscellaneous other things that make up my life</description>
	<lastBuildDate>Fri, 10 Jun 2011 15:53:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Blueprint CSS Framework</title>
		<link>http://www.petetracey.com/2009/12/blueprint-css-framework/</link>
		<comments>http://www.petetracey.com/2009/12/blueprint-css-framework/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 09:30:39 +0000</pubDate>
		<dc:creator>Pete Tracey</dc:creator>
				<category><![CDATA[Keyring Labs]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Blueprint CSS Framework]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Framework]]></category>

		<guid isPermaLink="false">http://www.petetracey.com/?p=86</guid>
		<description><![CDATA[I stumbled on the BluePrint CSS framework, seeing it used in another blog&#8217;s template. I had no idea there was such a thing as a CSS framework. So I&#8217;ve been playing around with it this morning.

I first wanted to try it out on a very simple page, and the public end of the bbpointofsale.com site [...]]]></description>
			<content:encoded><![CDATA[<p>I stumbled on the BluePrint CSS framework, seeing it used in another blog&#8217;s template. I had no idea there was such a thing as a CSS framework. So I&#8217;ve been playing around with it this morning.<br />
<br/><br />
I first wanted to try it out on a very simple page, and the public end of the bbpointofsale.com site is very simple but uses a lot of floats which are replaced in the framework with the concept of a &#8220;grid.&#8221; It makes things a lot simpler.<br />
<br/><br />
There was one tricky part, the content of bbpointofsale.com is centered ala most Google pages. In screen.css there is a container class that you use when you want to use grid layouts. The default width is 950px so it doesn&#8217;t center at all. I was only using 18 columns in my grid and the math for width of columns is <i>columns * 40 &#8211; 10 = width</i> so I changed it to this:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.container</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">710px</span><span style="color: #00AA00;">;</span>margin<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Viola! Centered content with the magic of grid layouts!<br />
<br/><br />
<img src="http://www.petetracey.com/wp-content/uploads/2009/12/bbpos.gif" alt="bbpos" title="bbpos" width="538" height="462" class="alignnone size-full wp-image-89" /><br />
<br/><br />
My initial impression is that the Blueprint CSS Framework is well worth learning and using for reduced development time and great simplicity and easier maintenance. Two thumbs up!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.petetracey.com/2009/12/blueprint-css-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>battlerc.com</title>
		<link>http://www.petetracey.com/2009/12/battlerc-com/</link>
		<comments>http://www.petetracey.com/2009/12/battlerc-com/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 10:27:57 +0000</pubDate>
		<dc:creator>Pete Tracey</dc:creator>
				<category><![CDATA[Keyring Labs]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[BattleRC]]></category>
		<category><![CDATA[island]]></category>

		<guid isPermaLink="false">http://www.petetracey.com/?p=80</guid>
		<description><![CDATA[I checked the stats for battlerc.com this morning. Turns out I&#8217;ve actually created a google search:
battle rc
rc plane laser tag
laser tag rc airplanes
jet laser tag
laser tag plane
rc laser aircraft
battlerc
laser tag airplanes
laser remote control
1	real laser tag
1	laser tag remote control
battlerc island
Nobody was searching for these things before, they&#8217;re all directly related to battlerc.com being up. Looks like [...]]]></description>
			<content:encoded><![CDATA[<p>I checked the stats for battlerc.com this morning. Turns out I&#8217;ve actually created a google search:<br />
battle rc<br />
rc plane laser tag<br />
laser tag rc airplanes<br />
jet laser tag<br />
laser tag plane<br />
rc laser aircraft<br />
battlerc<br />
laser tag airplanes<br />
laser remote control<br />
1	real laser tag<br />
1	laser tag remote control<br />
battlerc island</p>
<p>Nobody was searching for these things before, they&#8217;re all directly related to battlerc.com being up. Looks like there is some buzz. It&#8217;s about time for a mailing list send!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.petetracey.com/2009/12/battlerc-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Card Swipe for BlackBerry</title>
		<link>http://www.petetracey.com/2009/12/card-swipe-for-blackberry/</link>
		<comments>http://www.petetracey.com/2009/12/card-swipe-for-blackberry/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 11:23:20 +0000</pubDate>
		<dc:creator>Pete Tracey</dc:creator>
				<category><![CDATA[Keyring Labs]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[BlackBerry Point of Sale]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Peter Tracey]]></category>

		<guid isPermaLink="false">http://www.petetracey.com/?p=73</guid>
		<description><![CDATA[It&#8217;s been a good morning. I took the code from the manufacturer&#8217;s website and hooked it all in so that a BlackBerry should theoretically connect to the device and read card information. Now that I know the code is, well, sane, I can actually get the device with no worry that it&#8217;ll be a nightmare [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a good morning. I took the code from the manufacturer&#8217;s website and hooked it all in so that a BlackBerry should theoretically connect to the device and read card information. Now that I know the code is, well, sane, I can actually get the device with no worry that it&#8217;ll be a nightmare to interface with it from Java code. When I have it working with the device I&#8217;ll post an update here.</p>
<p>Here&#8217;s what the BlackBerry will show when no P25M is connected:<br />
<img class="alignnone size-full wp-image-74" title="bbpointofsale.com P25M not connected" src="http://www.petetracey.com/wp-content/uploads/2009/12/cantconnect.jpg" alt="bbpointofsale.com P25M not connected" width="243" height="405" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.petetracey.com/2009/12/card-swipe-for-blackberry/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KSoap with PHP Tutorial</title>
		<link>http://www.petetracey.com/2009/11/ksoap-with-php-tutorial/</link>
		<comments>http://www.petetracey.com/2009/11/ksoap-with-php-tutorial/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 09:21:52 +0000</pubDate>
		<dc:creator>Pete Tracey</dc:creator>
				<category><![CDATA[Keyring Labs]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[BlackBerry Point of Sale]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[KSoap]]></category>
		<category><![CDATA[Peter Tracey]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.petetracey.com/?p=43</guid>
		<description><![CDATA[This post is for:
You: developing a BlackBerry application in KSoap2 with PHP as the server
If that doesn&#8217;t describe you, don&#8217;t read this post!
If that does describe you, hope you enjoy!
The first step is to preverify your KSoap jar file. Copy ksoap2-j2me-core-2.1.2.jar to C:\Program Files\Eclipse\plugins\net.rim.eide.componentpack4.5.0_4.5.0.16\components\bin
Make sure the JDK is in your PATH environment varaible.
Then run:

preverify -classpath [...]]]></description>
			<content:encoded><![CDATA[<p>This post is for:<br />
You: developing a BlackBerry application in KSoap2 with PHP as the server</p>
<p>If that doesn&#8217;t describe you, don&#8217;t read this post!<br />
If that does describe you, hope you enjoy!</p>
<p>The first step is to preverify your KSoap jar file. Copy ksoap2-j2me-core-2.1.2.jar to C:\Program Files\Eclipse\plugins\net.rim.eide.componentpack4.5.0_4.5.0.16\components\bin</p>
<p>Make sure the JDK is in your PATH environment varaible.</p>
<p>Then run:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">preverify <span style="color: #339933;">-</span>classpath <span style="color: #0000ff;">&quot;JDE_PATH_HERE<span style="color: #000099; font-weight: bold;">\l</span>ib<span style="color: #000099; font-weight: bold;">\n</span>et_rim_api.jar&quot;</span> <span style="color: #0000ff;">&quot;ksoap2-j2me-core-2.1.2.jar&quot;</span></pre></div></div>

<p>Preverify put a new jar into an &#8220;output&#8221; directory in that folder. Copy that to where you put the original jar.</p>
<p>Now add that jar in your eclipse project by clicking on your project properties and going to &#8220;Java Build Path&#8221; &#8211; make sure you click on &#8220;Order and Export&#8221; and check the box that tells it to export it.</p>
<p>Well here&#8217;s where the rubber meets the road, you need KSoap to talk to PHP. I created a &#8220;Service&#8221; class which handles all the communication with the server:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.ksoap2.SoapEnvelope</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.ksoap2.SoapFault</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.ksoap2.serialization.SoapObject</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.ksoap2.serialization.SoapSerializationEnvelope</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.ksoap2.transport.HttpTransport</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.xmlpull.v1.XmlPullParserException</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Service <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> action <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://keyringlabs.com/Login&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> namespaceRoot <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;keyringlabs.com&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> webroot <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://192.168.1.2/bbpointofsale.com/&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> errorMessage<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> key<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> transactionID<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> HttpTransport transport<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> SoapSerializationEnvelope envelope<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> Service<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		transport <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HttpTransport<span style="color: #009900;">&#40;</span>webroot <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;bb/service/index.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		transport.<span style="color: #006633;">debug</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		envelope <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SoapSerializationEnvelope<span style="color: #009900;">&#40;</span>SoapEnvelope.<span style="color: #006633;">VER10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		key <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span></pre></div></div>

<p>A request is made by setting parameters and getting back a parameter, getting back more than one parameter is left as an exercise for the reader. Here&#8217;s what I&#8217;ve done:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> ProcessLogin<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> email, <span style="color: #003399;">String</span> password<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003399;">System</span>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ProcessLogin&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	errorMessage <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003399;">String</span> namespace <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;urn:&quot;</span> <span style="color: #339933;">+</span> namespaceRoot <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;:login&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	SoapObject message <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SoapObject<span style="color: #009900;">&#40;</span>namespace, <span style="color: #0000ff;">&quot;login&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	message.<span style="color: #006633;">addProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;email&quot;</span>, email<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	message.<span style="color: #006633;">addProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;password&quot;</span>, password<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	envelope.<span style="color: #006633;">bodyOut</span> <span style="color: #339933;">=</span> message<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003399;">String</span> soapAction <span style="color: #339933;">=</span> namespace <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;#login&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
		transport.<span style="color: #006633;">call</span><span style="color: #009900;">&#40;</span>soapAction, envelope<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;error: &quot;</span><span style="color: #339933;">+</span>e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		errorMessage <span style="color: #339933;">=</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;response: &quot;</span><span style="color: #339933;">+</span>transport.<span style="color: #006633;">responseDump</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>XmlPullParserException e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		errorMessage <span style="color: #339933;">=</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;response: &quot;</span><span style="color: #339933;">+</span>transport.<span style="color: #006633;">responseDump</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
		SoapObject result <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>SoapObject<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>SoapObject<span style="color: #009900;">&#41;</span>envelope.<span style="color: #006633;">getResponse</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getProperty</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		key <span style="color: #339933;">=</span> hackToGetResponse<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;serviceToken&quot;</span>, result.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>key.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;KEY:&quot;</span> <span style="color: #339933;">+</span> key<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>SoapFault e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		errorMessage <span style="color: #339933;">=</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;response: &quot;</span><span style="color: #339933;">+</span>transport.<span style="color: #006633;">responseDump</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		errorMessage <span style="color: #339933;">=</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;response: &quot;</span><span style="color: #339933;">+</span>transport.<span style="color: #006633;">responseDump</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>hackToGetResponse is necessary because the return of the PHP page the request is sent to is difficult to get at through KSoap. This is hackToGetResponse:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> hackToGetResponse<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> key, <span style="color: #003399;">String</span> response<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hackToGetResponse:&quot;</span> <span style="color: #339933;">+</span> response<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003399;">String</span> start <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;anyType{key=&quot;</span> <span style="color: #339933;">+</span> key <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;; value=&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #003399;">String</span> end <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;; }&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>response.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span>start<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">||</span>
		response.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span>end<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hackToGetResponse:&quot;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;response.substring(0, &quot;</span> <span style="color: #339933;">+</span> response.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span>start<span style="color: #009900;">&#41;</span>  <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;).substring(0, &quot;</span> <span style="color: #339933;">+</span> response.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span>end<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;);&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	response <span style="color: #339933;">=</span> response.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span>response.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span>start<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> start.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	response <span style="color: #339933;">=</span> response.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, response.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span>end<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>response.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;anyType{}&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">return</span> response<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>And finally, the PHP code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$server</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SoapServer<span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'uri'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;urn:keyringlabs.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$server</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addFunction</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;login&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> login<span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pass</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #990000;">Array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'serviceToken'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pass</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #990000;">Array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'serviceToken'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$objMerchant</span> <span style="color: #339933;">=</span> Merchant<span style="color: #339933;">::</span><span style="color: #004000;">LoadByEmailPassword</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pass</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$objMerchant</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">null</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$objMerchant</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Id</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #990000;">Array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'serviceToken'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$key</span> <span style="color: #339933;">=</span> <span style="color: #990000;">uniqid</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$objSess</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Merchantsessions<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$objSess</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">MerchantID</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$objMerchant</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Id</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$objSess</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ServiceToken</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$key</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$objSess</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">Array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'serviceToken'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$result</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>That&#8217;s it, a BlackBerry application that communicates with a PHP application with very little legwork. I hope this is useful to some people, it was a long journey for me to arrive at this code.</p>
<p>When I have some time I will make the Service class multi-threaded (as it should be being that it does network connections), I will post an update here when I&#8217;ve done that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.petetracey.com/2009/11/ksoap-with-php-tutorial/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Coming Along Good!</title>
		<link>http://www.petetracey.com/2009/11/coming-along-good/</link>
		<comments>http://www.petetracey.com/2009/11/coming-along-good/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 12:57:16 +0000</pubDate>
		<dc:creator>Pete Tracey</dc:creator>
				<category><![CDATA[Keyring Labs]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[BlackBerry Point of Sale]]></category>
		<category><![CDATA[Peter Tracey]]></category>

		<guid isPermaLink="false">http://www.petetracey.com/?p=32</guid>
		<description><![CDATA[The new version of bbpointofsale.com is almost ready. It is now a java application instead of a web-based application. It integrates with a card swipe and receipt printer machine that doesn&#8217;t cost much. Besides those two things not much has changed.


]]></description>
			<content:encoded><![CDATA[<p>The new version of bbpointofsale.com is almost ready. It is now a java application instead of a web-based application. It integrates with a card swipe and receipt printer machine that doesn&#8217;t cost much. Besides those two things not much has changed.</p>
<p><img class="alignnone size-full wp-image-31" title="cardswipe" src="http://www.petetracey.com/wp-content/uploads/2009/11/cardswipe2.jpg" alt="cardswipe" width="148" height="116" /></p>
<p><img class="alignnone size-full wp-image-33" title="screen1" src="http://www.petetracey.com/wp-content/uploads/2009/11/screen1.jpg" alt="screen1" width="345" height="604" /><img class="alignnone size-full wp-image-34" title="screen2" src="http://www.petetracey.com/wp-content/uploads/2009/11/screen2.jpg" alt="screen2" width="345" height="604" /><img class="alignnone size-full wp-image-35" title="screen3" src="http://www.petetracey.com/wp-content/uploads/2009/11/screen3.jpg" alt="screen3" width="345" height="604" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.petetracey.com/2009/11/coming-along-good/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Card Swipe</title>
		<link>http://www.petetracey.com/2009/11/card-swipe/</link>
		<comments>http://www.petetracey.com/2009/11/card-swipe/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 12:15:44 +0000</pubDate>
		<dc:creator>Pete Tracey</dc:creator>
				<category><![CDATA[Keyring Labs]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[BlackBerry Point of Sale]]></category>
		<category><![CDATA[Peter Tracey]]></category>

		<guid isPermaLink="false">http://www.petetracey.com/?p=19</guid>
		<description><![CDATA[Hard at work on a new version of the BlackBerry Point of Sale system which will integrate with a mobile card swipe and receipt printer combination machine. Found a supplier that has good machines for a good price. I am thinking about posting a tutorial here on my experience developing a java application for the [...]]]></description>
			<content:encoded><![CDATA[<p>Hard at work on a new version of the BlackBerry Point of Sale system which will integrate with a mobile card swipe and receipt printer combination machine. Found a supplier that has good machines for a good price. I am thinking about posting a tutorial here on my experience developing a java application for the BlackBerry when it is complete.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.petetracey.com/2009/11/card-swipe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bbpointofsale.com</title>
		<link>http://www.petetracey.com/2009/09/bbpointofsale-com/</link>
		<comments>http://www.petetracey.com/2009/09/bbpointofsale-com/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 10:14:15 +0000</pubDate>
		<dc:creator>Pete Tracey</dc:creator>
				<category><![CDATA[Keyring Labs]]></category>
		<category><![CDATA[BlackBerry Point of Sale]]></category>
		<category><![CDATA[Peter Tracey]]></category>

		<guid isPermaLink="false">http://www.petetracey.com/?p=14</guid>
		<description><![CDATA[I&#8217;ve put the store system with click to chat on the back burner for a while. I developed a system that allows people to take credit card payments on their BlackBerry. I&#8217;ve launched it at www.bbpointofsale.com
The first sign up was last Wednesday, basically just a few days after there was any traffic going to the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve put the store system with click to chat on the back burner for a while. I developed a system that allows people to take credit card payments on their BlackBerry. I&#8217;ve launched it at <a title="BlackBerry Point of Sale" href="http://www.bbpointofsale.com" target="_blank">www.bbpointofsale.com</a></p>
<p>The first sign up was last Wednesday, basically just a few days after there was any traffic going to the site at all. If things keep going this way it could end up being successful.</p>
<p>I&#8217;m still planning to pursue my original strategy but this looked like an opportunity for a service that could have some activity right out of the gates.</p>
<p>I&#8217;ll post updates here as the service grows.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.petetracey.com/2009/09/bbpointofsale-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

