Qt- Web service Requests
I’m trying out web service requests using this site as an example:
http://www.rcsb.org/pdb/software/rest.do
I got some GET REST request to work, but I’ have no idea how to send the XML POST for its advanced search service. This is what I tried:
- void WindowWrapper::postRequest()
- {
- QNetworkRequest request;
- request.setRawHeader("Content-Type", "text/xml;charset=UTF-8");
- QString query =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- "<orgPdbQuery>"
- "<queryType>org.pdb.query.simple.StructureIdQuery</queryType>"
- "<description>Simple query for a list of PDB IDs (1 IDs) : 3I5F</description>"
- "<structureIdList>3I5F</structureIdList>"
- "</orgPdbQuery>";
- network_->post(request, query.toUtf8());
- }
- {
- if(reply->error() > 0)
- {
- qDebug() << reply->errorString();
- }
- else
- {
- qDebug() << "Request successful!";
- qDebug() << data;
- }
- }
And this is how i call the method:
- wrapper_->set_request_url("http://www.rcsb.org/pdb/rest/search/");
- wrapper_->postRequest();
There’s no error on the request, but i get no response at all…
Does anyone know how can i do this?
1 reply
You must log in to post a reply. Not a member yet? Register here!
