<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>I'm Persian - Web Services</title>
    <link>http://gluegadget.com/blog/</link>
    <description>My land is Iran</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.4.1 - http://www.s9y.org/</generator>
    <pubDate>Thu, 22 May 2008 15:11:09 GMT</pubDate>

    <image>
        <url>http://gluegadget.com/blog/templates/bulletproof/img/s9y_banner_small.png</url>
        <title>RSS: I'm Persian - Web Services - My land is Iran</title>
        <link>http://gluegadget.com/blog/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Calling protected SOAP from Mozilla</title>
    <link>http://gluegadget.com/blog/index.php?/archives/25-Calling-protected-SOAP-from-Mozilla.html</link>
            <category>Mozilla</category>
            <category>SOAP</category>
            <category>Web Services</category>
    
    <comments>http://gluegadget.com/blog/index.php?/archives/25-Calling-protected-SOAP-from-Mozilla.html#comments</comments>
    <wfw:comment>http://gluegadget.com/blog/wfwcomment.php?cid=25</wfw:comment>

    <slash:comments>12</slash:comments>
    <wfw:commentRss>http://gluegadget.com/blog/rss.php?version=2.0&amp;type=comments&amp;cid=25</wfw:commentRss>
    

    <author>nospam@example.com (Amir Mohammad Saied)</author>
    <content:encoded>
    &lt;div align=&quot;left&quot; dir=&quot;ltr&quot;&gt;&lt;br /&gt;
Recently I had to write a Firefox extension for a &lt;a href=&quot;http://www.hostiran.net/&quot;&gt;company&lt;/a&gt; which provides &lt;a href=&quot;http://sms.hostiran.net/webservice/&quot;&gt;text messaging web services&lt;/a&gt;. The Web-Service is an RPC-Style SOAP one which is written by &lt;a href=&quot;http://blog.phpmystery.com/&quot;&gt;&quot;Nima Shayafar&quot;&lt;/a&gt;.&lt;br /&gt;
When I got this offer, I didn&#039;t think that this one would cause any troubles, as Mozilla has a SOAP implementation landed in it&#039;s platform since years (&lt;strike&gt;And if you ask me, I&#039;ll tell you no one, never touched it again to improve it -even a little bit&lt;/strike&gt; &lt;strong&gt;UPDATE:&lt;/strong&gt;&lt;em&gt;They finally touched it, and they completely removed it from Mozilla 1.9!&lt;/em&gt;&lt;img src=&quot;http://gluegadget.com/blog/templates/default/img/emoticons/tongue.png&quot; alt=&quot;:-P&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt;).&lt;br /&gt;
This Web-Service is protected by basic HTTP Authentication, nothing tricky so far, but to my surprise Mozilla&#039;s SOAP implementation doesn&#039;t provide any mean to do authentication against an endpoint, and nah, not even a basic one.&lt;br /&gt;
Well I thought as this (writing Firefox extensions for protected SOAP Web Services) is not that uncommon situation I may get a good amount of information by Googling, but nothing catchy comes there in results except a thread at &lt;a href=&quot;http://groups.google.com/group/netscape.public.mozilla.xml/browse_thread/thread/b46993fbc34afee9/0aee2d3d620ff42e&quot;&gt;netscape.public.mozilla.xml&lt;/a&gt; where I found two solutions, one was submitting username/password pair together with URL, and the other one was to make an XHR connection to the endpoint (XMLHttpRequest implementation let you provide login/password for a basic authentication), and as Mozilla remembers that for the browser session, you&#039;re there.&lt;br /&gt;
The first solution is hmm ... horrible! And the second one, I didn&#039;t manage to get it to work.&lt;br /&gt;
So I started wondering in other possible ways to overcome this, and guess what? It was damn easy!&lt;br /&gt;
You just need to set Authorization header in HTTP request (which is base64 encoded of login:password), but just for that particular endpoint, and how?&lt;br /&gt;
You need to use nsIHttpChannel in conjugation with nsIObserverService, register it right before invoking the SOAPCall, and (don&#039;t forget to!) unregister it when the call is done, that&#039;s it.&lt;br /&gt;
Well, it took me an hour to come up with this, and I&#039;m writing it in hopes save someone else &quot;one hour&quot;.&lt;br /&gt;
&lt;/div&gt; 
    </content:encoded>

    <pubDate>Fri, 14 Dec 2007 02:16:00 -0500</pubDate>
    <guid isPermaLink="false">http://gluegadget.com/blog/index.php?/archives/25-guid.html</guid>
    
</item>
<item>
    <title>Ohloh API</title>
    <link>http://gluegadget.com/blog/index.php?/archives/24-Ohloh-API.html</link>
            <category>REST</category>
            <category>Web Services</category>
    
    <comments>http://gluegadget.com/blog/index.php?/archives/24-Ohloh-API.html#comments</comments>
    <wfw:comment>http://gluegadget.com/blog/wfwcomment.php?cid=24</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://gluegadget.com/blog/rss.php?version=2.0&amp;type=comments&amp;cid=24</wfw:commentRss>
    

    <author>nospam@example.com (Amir Mohammad Saied)</author>
    <content:encoded>
    &lt;div align=&quot;left&quot; dir=&quot;ltr&quot;&gt;&lt;br /&gt;
It&#039;s a while since I started using &lt;a href=&quot;http://www.ohloh.net/api&quot;&gt;Ohloh API&lt;/a&gt; for the &lt;a href=&quot;http://www.facebook.com/apps/application.php?id=5754608444&quot;&gt;facebook app&lt;/a&gt; I mentioned in earlier post.&lt;br /&gt;
It&#039;s a REST-based one with well structured URIs, the only thing that could be implemented better (from the definitions perspective), is the way Ohloh let you know what happened to your request, the response status.&lt;br /&gt;
It&#039;s now represented in entity-body (&amp;lt;response&amp;gt;&amp;lt;status&amp;gt;....&amp;lt;/status&amp;gt;...&amp;lt;/response&amp;gt;), but IMO using ``HTTP Response Code&#039;&#039; would be a better choice when you&#039;re talking about a RESTful web service, data transmitting over HTTP without an additional messaging layer.&lt;br /&gt;
&lt;/div&gt; 
    </content:encoded>

    <pubDate>Sat, 24 Nov 2007 03:16:04 -0500</pubDate>
    <guid isPermaLink="false">http://gluegadget.com/blog/index.php?/archives/24-guid.html</guid>
    
</item>

</channel>
</rss>