Hi

I am working on a project that uses Basic authentication scheme to authenticate a user.

I need to call a api in a website.I need to send the username and password in base64 format.

After the header has the host and authentication details, I need to send the request in this format.

=== Request ===

<request client_id="1" client_serial_number="abcded" version="0.1">
<call name="test.reverse">abc</call>
</request>

This is the responce that i should get if all goes well

=== Response ===

<response version="0.1">
<value>cba</value>
</response>

For the header request part, i am using the following code

Qt Code:
  1. QXmlStreamReader xml;
  2. QHttp http;
  3.  
  4. void senddata::fetch()
  5. {
  6.  
  7. QString username = "abc";
  8. QString password = "12345";
  9.  
  10. xml.clear();
  11.  
  12. QUrl url(lineEdit->text());
  13.  
  14. http.setHost(url.host());
  15. http.setUser(username,password);
  16. connectionId = http.get(url.path());
  17. }
To copy to clipboard, switch view to plain text mode 
I am reading the data here

Qt Code:
  1. void senddata::readData(const QHttpResponseHeader &resp)
  2. {
  3. if (resp.statusCode() != 200)
  4. http.abort();
  5. else {
  6. xml.addData(http.readAll());
  7. parseXml();// This funtion has nothing in it as of now
  8. }
  9. }
To copy to clipboard, switch view to plain text mode 

Is my code correct? How should i proceed?

How can i parse the response xml and get the data i need?