<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>gadget.io.makerequest GET with Paramaters fails with 403</title>
  <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_thread?p_l_id=&amp;threadId=5456580" />
  <subtitle>gadget.io.makerequest GET with Paramaters fails with 403</subtitle>
  <id>http://developer.cisco.com/c/message_boards/find_thread?p_l_id=&amp;threadId=5456580</id>
  <updated>2013-05-20T20:43:30Z</updated>
  <dc:date>2013-05-20T20:43:30Z</dc:date>
  <entry>
    <title>RE: gadget.io.makerequest GET with Paramaters fails with 403</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=5474478" />
    <author>
      <name>David Womer</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=5474478</id>
    <updated>2012-04-16T18:53:25Z</updated>
    <published>2012-04-16T18:53:25Z</published>
    <summary type="html">David - Thanks for the response.  I think I figured out where the cacheing is occurring.  gadgets.io.makerequest() caches web calls be default, so you need to disable cacheing when the request is made as outlined in this document:

http://code.google.com/p/opensocial-resources/wiki/GadgetsMakeRequest

The following code is working for me now:


function makeJSONRequest(webServiceURL) {

    var refreshInterval = 0; // no cache
    var ts = new Date().getTime();
    var sep = "?";
    if (refreshInterval &amp;&amp; refreshInterval &gt; 0) {
        ts = Math.floor(ts / (refreshInterval * 1000));
    }
    if (webServiceURL.indexOf("?") &gt; -1) {
        sep = "&amp;";
    }
    webServiceURL = [ webServiceURL, sep, "nocache=", ts ].join("");

    var params = {};
    params[gadgets.io.RequestParameters.CONTENT_TYPE] = "text/html";
    params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.GET;
    gadgets.io.makeRequest(webServiceURL, response, params);
};</summary>
    <dc:creator>David Womer</dc:creator>
    <dc:date>2012-04-16T18:53:25Z</dc:date>
  </entry>
  <entry>
    <title>RE: gadget.io.makerequest GET with Paramaters fails with 403</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=5472273" />
    <author>
      <name>David Lender</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=5472273</id>
    <updated>2012-04-16T17:01:26Z</updated>
    <published>2012-04-16T17:01:26Z</published>
    <summary type="html">[quote]Does Finesse cache the widget code?

[/quote]
 
No cache.  You should be able to just logout the agent(s) and log back in again and the latest gadget xml is fetched.</summary>
    <dc:creator>David Lender</dc:creator>
    <dc:date>2012-04-16T17:01:26Z</dc:date>
  </entry>
  <entry>
    <title>RE: gadget.io.makerequest GET with Paramaters fails with 403</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=5472162" />
    <author>
      <name>David Womer</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=5472162</id>
    <updated>2012-04-16T16:28:35Z</updated>
    <published>2012-04-16T16:28:35Z</published>
    <summary type="html">Hi David,

This appears to be working today.  I'm guessing it was some kind of cacheing issue but I'm not sure where the problem was.  I tried a number of different content types, restarted the web server, and restarted by dev environment but kept getting the same result.  Does Finesse cache the widget code?

The strange part about this is that it would only fail when I passed parameters in the URL string.  Otherwise it would work fine.  You can see the request on the web server side:

172.35.1.67 - - [13/Apr/2012:14:54:00 -0500] "GET /soap.php?accountNumber=11111 HTTP/1.1" 403 210
127.0.0.1 - - [13/Apr/2012:15:07:26 -0500] "GET /soap.php?accountNumber=11111 HTTP/1.1" 200 193

the 172.35.1.67 address is Finesse.  I was just about to turn up some additional logging, but it starting working.  

-Dave</summary>
    <dc:creator>David Womer</dc:creator>
    <dc:date>2012-04-16T16:28:35Z</dc:date>
  </entry>
  <entry>
    <title>RE: gadget.io.makerequest GET with Paramaters fails with 403</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=5472055" />
    <author>
      <name>David Lender</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=5472055</id>
    <updated>2012-04-16T15:44:17Z</updated>
    <published>2012-04-16T15:44:17Z</published>
    <summary type="html">It appears the error is coming from your web server not Finesse.  I suggest you try content-type application/xml rather than text/xml.</summary>
    <dc:creator>David Lender</dc:creator>
    <dc:date>2012-04-16T15:44:17Z</dc:date>
  </entry>
  <entry>
    <title>gadget.io.makerequest GET with Paramaters fails with 403</title>
    <link rel="alternate" href="http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=5456579" />
    <author>
      <name>David Womer</name>
    </author>
    <id>http://developer.cisco.com/c/message_boards/find_message?p_l_id=&amp;messageId=5456579</id>
    <updated>2012-04-13T22:03:41Z</updated>
    <published>2012-04-13T22:03:41Z</published>
    <summary type="html">Team,
 
I'm trying to use the gadget.io.makerequest method to retrieve JSON data within my gadget.  I have this working if I do not pass any paramters to my service, however, if I add ?parameter=value  I get a 403 error. I have been able to succesfully call this service with paramters direclty form the web browser as well as an http client.  
 
Here's the code I'm using:
 

function makeJSONRequest() {
    var params = {};
    params[gadgets.io.RequestParameters.CONTENT_TYPE] = "text/html";
    params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.GET;
    var url = "http://app02:8080/soap.php?accountNumber=11111";
    gadgets.io.makeRequest(url, response, params);
};

 
 
Here's what I see returned from the request:
&lt;ol class="properties properties-tree monospace" style="box-sizing: border-box; outline-style: none; outline-width: initial; outline-color: initial; font-size: 11px !important; font-family: Menlo, monospace; padding-top: 0px; padding-right: 6px; padding-bottom: 2px; padding-left: 16px; list-style-type: none; list-style-position: initial; list-style-image: initial; min-height: 18px; display: block; -webkit-text-size-adjust: none; line-height: normal; margin: 0px;"&gt;
&lt;li class="parent expanded selected" style="box-sizing: border-box; margin-left: 1px; white-space: nowrap; text-overflow: ellipsis; overflow-x: hidden; overflow-y: hidden; -webkit-user-select: text; cursor: auto;"&gt;http://app02:8080/soap.php?accountNumber=11111: {,…}&lt;ol class="children expanded" style="box-sizing: border-box; display: block; -webkit-padding-start: 12px; list-style-type: none; list-style-position: initial; list-style-image: initial; margin: 0px;"&gt;
&lt;li style="box-sizing: border-box; margin-left: 12px; white-space: nowrap; text-overflow: ellipsis; overflow-x: hidden; overflow-y: hidden; -webkit-user-select: text; cursor: auto;"&gt;DataHash: "csqkfhq4gui851dd113bdce9fg"&lt;/li&gt;
&lt;li style="box-sizing: border-box; margin-left: 12px; white-space: nowrap; text-overflow: ellipsis; overflow-x: hidden; overflow-y: hidden; -webkit-user-select: text; cursor: auto;"&gt;body: "&lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"&gt;↵&lt;html&gt;&lt;head&gt;↵&lt;title&gt;403 Forbidden&lt;/title&gt;↵&lt;/head&gt;&lt;body&gt;↵&lt;h1&gt;Forbidden&lt;/h1&gt;↵&lt;p&gt;You don't have permission to access /soap.php↵on this server.&lt;/p&gt;↵&lt;/body&gt;&lt;/html&gt;↵"&lt;/li&gt;
&lt;li style="box-sizing: border-box; margin-left: 12px; white-space: nowrap; text-overflow: ellipsis; overflow-x: hidden; overflow-y: hidden; -webkit-user-select: text; cursor: auto;"&gt;rc: 403&lt;/li&gt;
&lt;/ol&gt;&lt;/li&gt;
&lt;/ol&gt;</summary>
    <dc:creator>David Womer</dc:creator>
    <dc:date>2012-04-13T22:03:41Z</dc:date>
  </entry>
</feed>

