Date: Wed, 3 Jun 2009 23:25:33 -0400
Reply-To: Joe Whitehurst <joewhitehurst@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Joe Whitehurst <joewhitehurst@GMAIL.COM>
Subject: Re: As If and Calling Twitter from SAS
In-Reply-To: <02f701c9e4b6$807c7270$81755750$@com>
Content-Type: text/plain; charset=windows-1252
Alan,
I like the title of your proposed paper and look forward to reading it. For
now, I can see from the docs that "Fiddler is an HTTP Proxy running on port
8888 on your local PC. You can configure any application which accepts a
HTTP Proxy to run through Fiddler so you can debug its traffic." I have
modified the little PROC HTTP example to use Fiddler as a Proxy server
running on port 8888:
filename twtIn "e:\TwitterFun\TweetsIn\status_update.txt";
filename twtout temp;
%let proxyhst="sasquatch host";
%let twUser="Beelzebub";
%let twPass="lostatsea";
proc http
in=twtIn
out=twtOut url="http://twitter.com/statuses/update.xml"
method="post"
proxyhost=&proxyhst
proxyport=8888
webusername=&twUser
webpassword=&twPass;
run;
Fiddler does not appear to monitor the HTTP request coming from SAS or at
least I see no evidence that it does. Yet I know the HTTP request went to
Twitter because I get this response in the SAS log:
NOTE: PROCEDURE HTTP used (Total process time):
real time 2.50 seconds
cpu time 0.00 seconds
NOTE: The SAS System stopped processing this step because of errors.
ERROR: java.io.IOException: Server returned HTTP response code: 401 for URL:
http://twitter.com/statuses/update.xml
On Wed, Jun 3, 2009 at 9:48 PM, Alan Churchill <savian001@gmail.com> wrote:
> Joe,
>
>
>
> Fiddler monitors all http traffic to and from the machine. I use it all of
> the time for REST services work and when I invoke HTTP GET/POSTs via code.
>
>
>
> Look at the Text View a lot for any of the views. However, make a request
> to Twitter from SAS and you should see it show up. Then, click on the
> Request Builder tab and drag your previous request to the Request Builder
> section and it will replicate the HTTP GET/POST. You can then manually
> change it and interactively determine what is happening. It is a massive
> improvement in debugging time.
>
>
>
> Fiddler is a godsend for web traffic work, even if it is outside of the
> browser. It is a sniffer tool so don’t fret the browser.
>
>
>
> For the community, the method you are using in SAS is known as REST
> services. SAS 9.2 also supports SOAP based services. Either one is fine but
> a lot of ‘consumer’ services use REST and it works fine. REST is basically a
> URL that may (or may not) return an HTML page. I use REST services at my
> current client to send/return tab-delimited data using HTTP.
>
>
>
> Fun stuff. I am thinking of a SGF paper focused on using SAS/IntrNet for
> REST-based services:
>
>
>
> “No need for SOAP: A clean way to get SAS data and get some REST in the
> process.”
>
>
>
>
>
> Alan
>
>
>
> Alan Churchill
> Savian
> www.savian.net
> Office: (719) 687-5954
> Cell: (719) 310-4870
>
>
>
> *From:* Joe Whitehurst [mailto:joewhitehurst@gmail.com]
> *Sent:* Wednesday, June 03, 2009 7:28 PM
> *To:* Savian
> *Cc:* SAS-L@listserv.uga.edu
> *Subject:* Re: As If and Calling Twitter from SAS
>
>
>
> Alan,
>
>
>
> I have downloaded, installed and watched a movie about Fiddler2. I'm very
> impressed with what I can understand so far. I do have a question that I
> think is best posed on SAS-L because I think many others may be interested
> in this tool if they knew more about it. I don't immediately see how to get
> Fiddler2 to monitor HTTP requests submitted directly from SAS without any
> browser involvement. I assume it is possible, but I have not yet read
> enough of the docs to see how its done. Could you point me in the right
> direction?
>
>
>
> Joe
>
> On Wed, Jun 3, 2009 at 8:36 PM, Joe Whitehurst <joewhitehurst@gmail.com>
> wrote:
>
> Alan,
>
>
>
> I knew I was missing something! I will get Fiddler right away! Thanks.
>
>
>
> Joe
>
>
>
> On Wed, Jun 3, 2009 at 8:33 PM, Savian <savian.net@gmail.com> wrote:
>
> On Jun 3, 5:36 pm, joewhitehu...@GMAIL.COM (Joe Whitehurst) wrote:
> > I was watching the French Open, in particular, the women's match between
> > Serena. Williams and Svetlana Kuznetsova, and was really struck by the
> wild
> > shrieks each screamed each time they hit the ball. As a Kellian
> psychologist
> > and follower of Hans Vaihinger--the originator of Philosophie des Als Ob
>
> > (Philosophy of As If) that so influenced Kellyhttp://
> en.wikipedia.org/wiki/Hans_Vaihinger)--Igot to wondering what
>
> > baseball might be like if baseball players played "as if" they were women
> > tennis players. Everytime a pitcher hurled a pitch he would scream a
> shreik,
> > the batter would scream a shreik eveytime he swung at a pitch, the
> catcher
> > would scream a shreik evey time he caught the ball or tried to peg a
> runner
> > stealing a base, a base runner would scream a shreik evey time he stomped
> a
> > base or home plate, a fielder would scream a shreik evey time he caught a
> > ball or threw it to another player and so on. What a different game it
> would
> > be.. And why not? And don't get me started on what would happen in the
> > workplace if SAS programmers programmed "as if" they were women tennis
> > players.
> > Now on to another topic. Have you tried calling Twitter from SAS?
> > filename twtIn "\\sas\status_update.txt";
> > filename twtOut temp;
> > %let proxyhst="myproxy host"
> > %let twUser="mytwitterusername";
> > %let twPass="mytwitterpassword";
> >
> > proc http
> > in=twtIn
> > out=twtOut
> > url="http://twitter.com/statuses/update.xml"
> > method="post"
> > proxyhost=&proxyhst
> > proxyport=80
> > webusername=&twUser
> > webpassword=&twPass;
> > run;
> > I have but could not get it to work. I have a working userid and password
> > but I keep getiing an HTTP 401 error. Can you get this to work?
>
> Joe,
>
> I have not (and probably won't unless I need to). However, look at
> REST services,Twitter, and .NET to see if it can lend a hand.
>
> Here's a video that might shed some light:
>
>
> http://www.pluralsight.com/main/screencasts/screencast.aspx?id=httpclient-consuming-twitter-in-under-3-minutes
>
> I work with REST services but I use C# for the consumption side.
> Nevertheless, it might shed some clues on which parm you are missing.
> Another suggestion is to download and run Fiddler and see what SAS is
> passing to Twitter and use Fiddler to test various parms until you
> have it operational. When in doubt, use Fiddler and manually make the
> request until you determine what parms need to go out in SAS.
>
> Fiddler is a MUST HAVE utility if you are working with the web.
>
> Alan
>
>
>
>
>
|