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

Re: HTTPAPI -Header Parser



Thank you Scott for quick response.

As I mentioned In the email below, I have developed an application integration frame which is fairly generic enough to service any request coming from any business application/developer within our application environment. This framework is completely unaware of the business application requirements for service consumption or dealing with any error/exception message. In order to keep it generic, I am trying to provide the response body and header as 2 separate lists back to calling procedure, and letting it decide what to do next.

I currently have three web services to start with. All three services require some authentication/credential information (other than SSL) to be include in header while making http request. In response, these services returns the token, or a verification code in HTTP HEADER. Since, my framework is completely unaware of the information that could possibly be returned, I need to iterate through the headers (in case of any error messages, or tokens, or verification code) and provide it back to the calling procedure for any further processing.

Athar

----------------------------------------------------------------------

Message: 1
Date: Fri, 5 Aug 2016 18:01:36 +0000
From: Athar Iqbal <iqbala@xxxxxxxxxxxxx>
To: "ftpapi@xxxxxxxxxxxxxxxxxxxxxx" <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: HTTPAPI -Header Parser
Message-ID:
<DM5PR04MB0522831BFDCEADF7BF51E55CD3180@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>

Content-Type: text/plain; charset="us-ascii"

Hi,

I am new to this forum, so please forgive me if I ask something that has already been asked. I did go through the archives and didn't find any information.

My question is on header parser function in HTTPAPI. Currently, header_parse() function reads all the headers and puts them in the data structure which is available to the HEADERR4 module only.  In order to get the header information, we need to use http_header() function. Also, header_parse() goes through the complete response object to pull headers from it. Wouldn't it be faster, if it looks for <CRLF><CRLF>  and stop the search after that?

I am developing a generic framework to consume web services offered by different businesses such MelissaData or D&B. Developers on my team may or may not know all the headers coming back in the response object. I want to iterate though the all the header and put them in the list and return it back to the calling procedure.

Challenge I am coming across is that there is no iterator that can get me all headers without specifying name. Also, could someone please explain, what is best use of USERDATA pointer in http_xproc()

If someone has come across something like this, could you please share. If not, I would like to contribute to HTTPAPI by enhancing existing code and send it back to the team to see if it is acceptable to include in package.

Again, I apologize in advance, if this has been already discussed and if you can point me to some resource.

Athar




DISCLAIMER:
This e-mail is intended for the use of the addressee(s) only and may contain privileged, confidential, or proprietary information that is exempt from disclosure under law. If you are not the intended recipient, please do not read, copy, use or disclose the contents of this communication to others. Please notify the sender that you have received this e-mail in error by replying to the e-mail. Please then delete the e-mail and destroy any copies of it. Thank you.
-------------- next part --------------
   Hi,


   I am new to this forum, so please forgive me if I ask something that
   has already been asked. I did go through the archives and didn't find
   any information.


   My question is on header parser function in HTTPAPI. Currently,
   header_parse() function reads all the headers and puts them in the data
   structure which is available to the HEADERR4 module only.  In order to
   get the header information, we need to use http_header() function.
   Also, header_parse() goes through the complete response object to pull
   headers from it. Wouldn't it be faster, if it looks for <CRLF><CRLF>
   and stop the search after that?


   I am developing a generic framework to consume web services offered by
   different businesses such MelissaData or D&B. Developers on my team may
   or may not know all the headers coming back in the response object. I
   want to iterate though the all the header and put them in the list and
   return it back to the calling procedure.


   Challenge I am coming across is that there is no iterator that can get
   me all headers without specifying name. Also, could someone please
   explain, what is best use of USERDATA pointer in http_xproc()


   If someone has come across something like this, could you please share.
   If not, I would like to contribute to HTTPAPI by enhancing existing
   code and send it back to the team to see if it is acceptable to include
   in package.


   Again, I apologize in advance, if this has been already discussed and
   if you can point me to some resource.


   Athar


   DISCLAIMER:
   This e-mail is intended for the use of the addressee(s) only and may
   contain privileged, confidential, or proprietary information that is
   exempt from disclosure under law. If you are not the intended
   recipient, please do not read, copy, use or disclose the contents of
   this
   communication to others. Please notify the sender that you have
   received this e-mail in error by replying to the e-mail. Please then
   delete the e-mail and destroy any copies of it. Thank you.

------------------------------

Message: 2
Date: Fri, 5 Aug 2016 19:07:31 -0500
From: Scott Klement <sk@xxxxxxxxxxxxxxxx>
To: HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: HTTPAPI -Header Parser
Message-ID: <18fc3c0c-acec-068f-1b09-0e231d3d1bf0@xxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset=windows-1252; format=flowed

Hi Athar,

It's unusual for an application to need information from the headers, that's why you haven't seen much discussion in the archives.  Normally header data is not needed for anything except httpapi, but in the rare occasion that it is, the application usually just needs a single header, so they just use http_header() to grab that one.

Can you explain why you'd like to iterate through all of them? That seems like a strange thing to do.

Your comment about searching for CRLF,CRLF is a good point. HTTPAPI
should definitely NOT be looking at data after the HTTP headers.
Though, I don't think it does read past the CRLF,CRLF, because the calling routine only passes the headers to parse_resp_chain, it does not pass the entire response document. The variable names might be a bit misleading, however.

-SK


On 8/5/2016 1:01 PM, Athar Iqbal wrote:
>     Hi,
>
>
>     I am new to this forum, so please forgive me if I ask something that
>     has already been asked. I did go through the archives and didn't find
>     any information.
>
>
>     My question is on header parser function in HTTPAPI. Currently,
>     header_parse() function reads all the headers and puts them in the data
>     structure which is available to the HEADERR4 module only.  In order to
>     get the header information, we need to use http_header() function.
>     Also, header_parse() goes through the complete response object to pull
>     headers from it. Wouldn't it be faster, if it looks for <CRLF><CRLF>
>     and stop the search after that?
>
>
>     I am developing a generic framework to consume web services offered by
>     different businesses such MelissaData or D&B. Developers on my team may
>     or may not know all the headers coming back in the response object. I
>     want to iterate though the all the header and put them in the list and
>     return it back to the calling procedure.
>
>
>     Challenge I am coming across is that there is no iterator that can get
>     me all headers without specifying name. Also, could someone please
>     explain, what is best use of USERDATA pointer in http_xproc()
>
>
>     If someone has come across something like this, could you please share.
>     If not, I would like to contribute to HTTPAPI by enhancing existing
>     code and send it back to the team to see if it is acceptable to include
>     in package.
>
>
>     Again, I apologize in advance, if this has been already discussed and
>     if you can point me to some resource.
>
>
>     Athar
>
>
>     DISCLAIMER:
>     This e-mail is intended for the use of the addressee(s) only and may
>     contain privileged, confidential, or proprietary information that is
>     exempt from disclosure under law. If you are not the intended
>     recipient, please do not read, copy, use or disclose the contents of
>     this
>     communication to others. Please notify the sender that you have
>     received this e-mail in error by replying to the e-mail. Please then
>     delete the e-mail and destroy any copies of it. Thank you.
>
>
>
> ----------------------------------------------------------------------
> - This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> ----------------------------------------------------------------------
> -



------------------------------

Message: 3
Date: Sat, 6 Aug 2016 11:52:29 +0200
From: Rainer Ross <rainer_ross@xxxxxx>
To: HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: HTTPAPI -Header Parser
Message-ID: <b69a955d-41c2-5d88-46fc-cb5df46914f4@xxxxxx>
Content-Type: text/plain; charset="windows-1252"; Format="flowed"


Hi Athar,

when you are only interested on the header and you are on V7.1 you can try this SQL-Statement:

SELECT * FROM TABLE(SYSTOOLS.HTTPGETCLOBVERBOSE ('http://google.de','<httpHeader connectTimeout="5000" readTimeout="5000">
   <header name="User-Agent" value="test"/></httpHeader>'))
  as Data;

With this command you get a  ResponseMSG and a ResponseHTTPHeader in XML-Format like this:

<?xml version="1.0" encoding="UTF-8" ?>
<httpHeader responseCode="200">
     <responseMessage>OK</responseMessage>
     <header name="HTTP_RESPONSE_CODE" value="HTTP/1.1 200 OK"/>
     <header name="X-Frame-Options" value="SAMEORIGIN"/>
     <header name="Date" value="Sat, 06 Aug 2016 09:38:22 GMT"/>
     <header name="Content-Length" value="5062"/>
     <header name="P3P" value="CP=&quot;This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info.&quot;"/>
     <header name="X-XSS-Protection" value="1; mode=block"/>
     <header name="Expires" value="-1"/>
     <header name="Content-Encoding" value="gzip"/>
     <header name="Set-Cookie"
value="NID=83=J-PNn924OjRBbR8Ybh6r_Bn8PDy94-IiRz2hugt9ykxxiIEiIo6V9dyiK8oWMiRASLPZG3qR0RDn5DkCbQDjzGiDsXFExFsP085YkWeaDgNFUyduRpk5RBXO68o1swk0;
expires=Sun, 05-Feb-2017 09:38:22 GMT; path=/; domain=.google.de; HttpOnly"/>
     <header name="Content-Type" value="text/html; charset=ISO-8859-1"/>
     <header name="Server" value="gws"/>
     <header name="Cache-Control" value="private, max-age=0"/> </httpHeader>

Rainer


Am 05.08.2016 um 20:01 schrieb Athar Iqbal:
>     Hi,
>
>
>     I am new to this forum, so please forgive me if I ask something that
>     has already been asked. I did go through the archives and didn't find
>     any information.
>
>
>     My question is on header parser function in HTTPAPI. Currently,
>     header_parse() function reads all the headers and puts them in the data
>     structure which is available to the HEADERR4 module only.  In order to
>     get the header information, we need to use http_header() function.
>     Also, header_parse() goes through the complete response object to pull
>     headers from it. Wouldn't it be faster, if it looks for <CRLF><CRLF>
>     and stop the search after that?
>
>
>     I am developing a generic framework to consume web services offered by
>     different businesses such MelissaData or D&B. Developers on my team may
>     or may not know all the headers coming back in the response object. I
>     want to iterate though the all the header and put them in the list and
>     return it back to the calling procedure.
>
>
>     Challenge I am coming across is that there is no iterator that can get
>     me all headers without specifying name. Also, could someone please
>     explain, what is best use of USERDATA pointer in http_xproc()
>
>
>     If someone has come across something like this, could you please share.
>     If not, I would like to contribute to HTTPAPI by enhancing existing
>     code and send it back to the team to see if it is acceptable to include
>     in package.
>
>
>     Again, I apologize in advance, if this has been already discussed and
>     if you can point me to some resource.
>
>
>     Athar
>
>
>     DISCLAIMER:
>     This e-mail is intended for the use of the addressee(s) only and may
>     contain privileged, confidential, or proprietary information that is
>     exempt from disclosure under law. If you are not the intended
>     recipient, please do not read, copy, use or disclose the contents of
>     this
>     communication to others. Please notify the sender that you have
>     received this e-mail in error by replying to the e-mail. Please then
>     delete the e-mail and destroy any copies of it. Thank you.
>
>
>
> ----------------------------------------------------------------------
> - This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> ----------------------------------------------------------------------
> -


--
Rainer Ross
IT-Beratung
www.myhofi.com
Hotels finden - leicht gemacht
Sitz:   Schmalholzstr. 27, 86916 Kaufering
Tel:    0171/9637923
Ust-ID: DE154580259

-------------- next part --------------
   Hi Athar,
   when you are only interested on the header and you are on V7.1
   you can try this SQL-Statement:
   SELECT * FROM TABLE(SYSTOOLS.HTTPGETCLOBVERBOSE
   ('[1]http://google.de','<httpHeader connectTimeout="5000"
   readTimeout="5000">
     <header name="User-Agent" value="test"/></httpHeader>'))
    as Data;
   With this command you get a  ResponseMSG and a ResponseHTTPHeader in
   XML-Format
   like this:
   <?xml version="1.0" encoding="UTF-8" ?>
   <httpHeader responseCode="200">
       <responseMessage>OK</responseMessage>
       <header name="HTTP_RESPONSE_CODE" value="HTTP/1.1 200 OK"/>
       <header name="X-Frame-Options" value="SAMEORIGIN"/>
       <header name="Date" value="Sat, 06 Aug 2016 09:38:22 GMT"/>
       <header name="Content-Length" value="5062"/>
       <header name="P3P" value="CP=&quot;This is not a P3P policy! See
   [2]https://www.google.com/support/accounts/answer/151657?hl=en for more
   info.&quot;"/>
       <header name="X-XSS-Protection" value="1; mode=block"/>
       <header name="Expires" value="-1"/>
       <header name="Content-Encoding" value="gzip"/>
       <header name="Set-Cookie"
   value="NID=83=J-PNn924OjRBbR8Ybh6r_Bn8PDy94-IiRz2hugt9ykxxiIEiIo6V9dyiK
   8oWMiRASLPZG3qR0RDn5DkCbQDjzGiDsXFExFsP085YkWeaDgNFUyduRpk5RBXO68o1swk0
   ; expires=Sun, 05-Feb-2017 09:38:22 GMT; path=/; domain=.google.de;
   HttpOnly"/>
       <header name="Content-Type" value="text/html; charset=ISO-8859-1"/>
       <header name="Server" value="gws"/>
       <header name="Cache-Control" value="private, max-age=0"/>
   </httpHeader>
   Rainer
   Am 05.08.2016 um 20:01 schrieb Athar Iqbal:

   Hi,


   I am new to this forum, so please forgive me if I ask something that
   has already been asked. I did go through the archives and didn't find
   any information.


   My question is on header parser function in HTTPAPI. Currently,
   header_parse() function reads all the headers and puts them in the data
   structure which is available to the HEADERR4 module only.  In order to
   get the header information, we need to use http_header() function.
   Also, header_parse() goes through the complete response object to pull
   headers from it. Wouldn't it be faster, if it looks for <CRLF><CRLF>
   and stop the search after that?


   I am developing a generic framework to consume web services offered by
   different businesses such MelissaData or D&B. Developers on my team may
   or may not know all the headers coming back in the response object. I
   want to iterate though the all the header and put them in the list and
   return it back to the calling procedure.


   Challenge I am coming across is that there is no iterator that can get
   me all headers without specifying name. Also, could someone please
   explain, what is best use of USERDATA pointer in http_xproc()


   If someone has come across something like this, could you please share.
   If not, I would like to contribute to HTTPAPI by enhancing existing
   code and send it back to the team to see if it is acceptable to include
   in package.


   Again, I apologize in advance, if this has been already discussed and
   if you can point me to some resource.


   Athar


   DISCLAIMER:
   This e-mail is intended for the use of the addressee(s) only and may
   contain privileged, confidential, or proprietary information that is
   exempt from disclosure under law. If you are not the intended
   recipient, please do not read, copy, use or disclose the contents of
   this
   communication to others. Please notify the sender that you have
   received this e-mail in error by replying to the e-mail. Please then
   delete the e-mail and destroy any copies of it. Thank you.


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

--
Rainer Ross
IT-Beratung
[4]www.myhofi.com
Hotels finden - leicht gemacht
Sitz:   Schmalholzstr. 27, 86916 Kaufering
Tel:    0171/9637923
Ust-ID: DE154580259

References

   1. http://google.de/
   2. https://www.google.com/support/accounts/answer/151657?hl=en
   3. http://www.scottklement.com/mailman/listinfo/ftpapi
   4. http://www.myhofi.com/

------------------------------

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


End of Ftpapi Digest, Vol 118, Issue 2
**************************************



DISCLAIMER:
This e-mail is intended for the use of the addressee(s) only and may contain privileged, confidential, or proprietary information that is
exempt from disclosure under law. If you are not the intended recipient, please do not read, copy, use or disclose the contents of this
communication to others. Please notify the sender that you have received this e-mail in error by replying to the e-mail. Please then
delete the e-mail and destroy any copies of it. Thank you.
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------