dcragg at lacscentre.co.uk
Fri Nov 18 04:41:52 EST 2005
On 18 Nov 2005, at 01:53, Bruce A. Pokras wrote:
> Thanks, Dave, for the mauling. It was well deserved. However, I
> have been trying to get this to work over a period of several
> weeks. This was not a "try once and cry for help." This has been a
> long, drawn out bit of frustration. A couple of times I did throw
> "the result" into the script, but it was very un-enlightening. I
> also alternated using "revGoURL" with the same URL, and bingo, the
> patent showed up in Netscape. So there were no issues with the EPO
> server at the times I was trying.
> With that introduction, the "Result #1" (see below) shows the
> single word "error". Not very enlightening! I am using the
> following handler, if anyone wishes to try it:
> on mouseUp
> libUrlSetSSLVerification false
> put "https://publications.european-patent-office.org/
> PublicationServer/getpdf.jsp?cc=EP&pn=1502502&ki=A1" into theURL
> put URL theURL into holdData
> put the result into theRes
> if theRes <> empty then
> answer "Result #1: " & theRes
> put holdData into URL "binfile:1502503.pdf"
> put the result into theRes2
> if theRes2 <> empty then
> answer "Result #2: " & theRes2
> end if
> end if
> end mouseUp
The above worked here the first time I tried, and I got a nice patent
application saved to a pdf file.
However, on subsequent attempts I had mixed results, the main problem
being either a socket timeout or "redirection failed" result.
Logging the data (libUrlSetLogField), I see that the redirecton
failures were also socket timeouts.
Out of a browser, it worked initially, but at a later try I was
getting redirected to a Search page. Is this in fact a "pay for"
service, and they only let you download a few times for free?
The first response from the url request is a "redirection" response
(302). By default, libUrl will try to redirect the request using the
"Location" header in the response. However, I also saw that the first
response had a Set-Cookie header like this:
Set-Cookie: JSESSIONID=8A03B947A0B4703A14FA776E904EE40F; Path=/
I'm wondering if things would go better if the cookie were returned
in the redirected request. To do this, you'd need to handle the
redirect yourself (libUrlFollowHttpRedirects false), get the remote
server's headers (libUrlLastRHHeaders()), and extract the "Location:"
and "Set-Cookie" headers. Then set the Cookie to return (set the
httpHeaders to "Cookie: <something>") and then get the url extracted
from the Location header.
I'm not sure whether you just return the Cookie as you received it
(Cookie: JSESSIONID=8A03B947A0B4703A14FA776E904EE40F; Path=/
PublicationServer), or you have to set it differently. (perhaps
someone can help.)
Whatever, it seems like the service has some kind of session control
on it. Although whether this is a cause of the frequent timeouts is
hard to say. (increasing the socketTimeoutInterval to 60000 didn't
seem to have any effect.) Do you have any other information about how
the service works?
More information about the Use-livecode