Results 1 to 2 of 2

Thread: HTTPS Get and Post using cookies

  1. #1
    Join Date
    Feb 2017
    Posts
    4
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default HTTPS Get and Post using cookies

    Needing some help with setting up a https get and post to send files to a custom API. I have listed the steps below and was hoping to be able to do this in QT/C++. The steps that I need to do are below. Please let me know if this is possible to do.

    Secure HTTP (HTTPS) can be used as a transport for HL7 Messages. The service that will be used to process HL7 messages is a protected resource and requires user authentication. The following steps outline the basic procedure for accessing a protected resource. This process should be used for all HL7 communications.

    1. The first step is to connect with the server and obtain a session id. The session id is captured in the HTTP cookie.
    o HTTP GET https://websiteurl
    o Get the JSESSIONID name-value pair from the “SetCookie” field in the HTTP Response Header. This name-value pair will be added to a variable called <cookie>.
    o The variable <cookie> should now look like JSESSIONID=XXXXX

    2. The next step is to authenticate your session.
    o HTTP GET https://api.websiteurl.com/j_securit...a&j_password=b
    o The HTTP Request Header should have the field “Cookie” set to the value <cookie>.
    o The username and password should be set in the URL Query replacing <a> and <b> values.
    o Get the JSESSIONID name-value pair from the “SetCookie” field in the HTTP Response Header. This name-value pair will be added to a variable called <cookie>.
    o The variable <cookie> should now look like JSESSIONID=YYYYY

    3. Once authenticated, you will be able to access the HL7 server. You may repeat this step as many times as necessary.
    o HTTP POST https://api.websiteurl.com/hl7/hl7Server
    o The HTTP Request Header should have the field “Cookie” set to the value <cookie>.
    o The HTTP Content will be the P03 or A04 message.
    o The HTTP Response will contain the ACK message.
    o Repeat this step for each HL7 message you need to process.

    4. Call logout to expire the session id
    o HTTP GET https://api.websiteurl.com/logout
    o The HTTP Request Header should have the field “Cookie” set to the value <cookie>.
    o This will end your session.

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: HTTPS Get and Post using cookies

    Have you actually tried to implement this at all? If not, take a look at the QNetworkAccessManager, QNetworkRequest, and QNetworkReply classes to get started.
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

Similar Threads

  1. Replies: 3
    Last Post: 20th November 2014, 17:12
  2. Replies: 3
    Last Post: 30th October 2013, 13:45
  3. QT HTTP Post issue when server requires cookies
    By shadyabhi in forum Qt Programming
    Replies: 0
    Last Post: 22nd December 2010, 13:10
  4. Replies: 6
    Last Post: 25th May 2010, 10:42
  5. Https POST Request
    By munna in forum Qt Programming
    Replies: 10
    Last Post: 11th November 2006, 14:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.