[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: http_header



Hi James,

I've put a "patched" copy of HTTPAPI here:
http://www.scottklement.com/httpapi/beta

I attempted to change that version so that it will still parse the headers, even with a 204 or 304 response code. So if I did this right, you will be able to call http_header() to get the header(s) you need.

Unfortunately, I do not have access to a server that returns 204, so I could not test it -- but the changes are pretty simple. So, if you could give it a try and tell me if it works, that would be helpful.

-SK

On 1/22/2015 2:54 AM, James Viney wrote:
Thanks Scott - I appreciate your help.

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: 21 January 2015 20:43
To: HTTPAPI and FTPAPI Projects
Subject: Re: http_header

Ahhh, I see what's going. on.    Yes, it looks like HTTPAPI will need to
be modified.   I don't remember why I'm stopping this early on a 204
(this was written in 2001) but I suspect I was thinking something like "if there's no response, no point in taking the time to parse the headers"

I'll make some changes here and let you know what to try next.


On 1/21/2015 8:47 AM, James Viney wrote:
Okay, it's because in parse_resp_chain there is a select statement picking up the 204 return code (204=No Content).

What's the best way round this?  Is there an easy way to accept the 204 or do I have to resort to amending the code?

Thanks,

James

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of James
Viney
Sent: 21 January 2015 14:30
To: 'HTTPAPI and FTPAPI Projects'
Subject: RE: http_header

Hi Thomas,

Funnily enough that's exactly what I'm doing now!  I'll let you know what I find.

Thanks,

James

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Thomas
Raddatz
Sent: 21 January 2015 14:26
To: 'HTTPAPI and FTPAPI Projects'
Subject: Re: http_header

James,

I suggest to start the debugger for service program HTTPAPIR4, module HTTPAPIR4 and procedure do_oper(). The "parse header" callback is called after HTTPAPI called the regular parse header procedure. So when you cannot get the "content-location" header without your callback, then you most likely cannot get it the callback either.

I am not sure, what exactly happens. But I assume that the problem is in do_oper() or, more likely, in parse_response_chain(). Either parse_response_chain() is not called or early exited.

HTTPAPI calls header_parse() and optionally the callback procedure at the end of parse_response_chain(). It might be worth a try to see what happens in parse_response_chain().

Thomas.

-----Ursprüngliche Nachricht-----
Von: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] Im Auftrag von James
Viney
Gesendet: Mittwoch, 21. Januar 2015 10:15
An: 'HTTPAPI and FTPAPI Projects'
Betreff: RE: http_header

I've tried with and without colon, and all upper and all lower case but, when I debug, the value of wkNewLoc is always blank.

I've also tried using the http_xproc(HTTP_POINT_PARSE_HEADER:%paddr('READ_HDR')), but for some reason it never escapes to my Read_Hdr subprocedure.


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott
Klement
Sent: 21 January 2015 02:24
To: HTTPAPI and FTPAPI Projects
Subject: Re: http_header


There should be no colon...

        wkNewLoc = http_header('content-location');

-SK


On 1/20/2015 12:59 PM, Mike Krebs wrote:
Maybe you are looking for
wkNewLoc = http_header('Content-Location:'); ?

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of James
Viney
Sent: Tuesday, January 20, 2015 4:21 AM
To: 'ftpapi@xxxxxxxxxxxxxxxxxxxxxx'
Subject: http_header

Hello,

I'm having a little trouble with the http_header function, and just wanted to check that I'm using it correctly.  I'm currently using v1.23, but will upgrade in case this might be the issue.

I've been using the HTTP APIs successfully for years with SOAP webservices, but I now have to start consuming a RESTful webervice.  The service in question appears quite simple where I would POST some data that needs checking, and the service will then pass back the URL that I would need to run a subsequent GET against to receive the results.  The URL is passed back in the header however, and I just can't seem to pick it up.

   From the debug log, it appears that the initial post is successful and I can see the URL begin returned:

Protocol Used: TLS Version 1
http_persist_post(): entered
http_long_ParseURL(): entered
do_post(): entered
POST /query/EmailValidate/1.0/ HTTP/1.1
Host: api.experianmarketingservices.com
User-Agent: http-api/1.23
Content-Type: text/xml
Expect: 100-continue
Content-Length: 36
Auth-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxx


recvresp(): entered
HTTP/1.1 100 Continue


SetError() #13: HTTP/1.1 100 Continue
senddoc(): entered
<Email>xxxxxxxxxxxx</Email>

recvresp(): entered
HTTP/1.1 204 No Content
Cache-Control: no-store, must-revalidate, no-cache, max-age=0
Pragma: no-cache
Content-Length: 0
Content-Location:
https://api.experianmarketingservices.com/result/EmailValidate/1.0/xx
x
xxxxxxxxxxxxxxxxx
Expires: Mon, 01 Jan 0001 00:00:00 GMT
Date: Tue, 20 Jan 2015 10:06:54 GMT


SetError() #13: HTTP/1.1 204 No Content
http_close(): entered



I've altered some of the values to xxxxx.  TheURL I need to pick up is under "Content-Location", so in my code directly after the http_url_post I've used the line wkNewLoc = http_header('Content-Length'); however wkNewLoc is blank.  I've tried with and without the colon after content-length but neither work.

The return code is "204" as there is no content to be returned (so my response file is blank) - would this affect the http_header api?  Having searched the archive I've read that a Content-Length of 0 shouldn't affect this however.

Any help would be very welcome.

Thanks,

James



-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------