Hi all ,
After executing a query, How i need to do XML- Serialization of the resultant query. How can i pass Serialization object to Web Service to get required response.
Hi all ,
After executing a query, How i need to do XML- Serialization of the resultant query. How can i pass Serialization object to Web Service to get required response.
Can you add some details to that? Execute what kind of query, which web services, etc?
Cheers,
_
Thanks for the reply....
In Local database i save my transaction data ..I need to insert this data in server....so now i get my required data from local db to transfer to server through query. For example i got 5 rows with 10 columns........now to insert in server db,I need to do serialization for these result and hit the web service with that serialized object to pass these data and get inserted in the server....???? OR it can be solved in any other way if so plz give me an idea on it ..??
Generating XML for your query result should be quite easy with QXmlStreamWriter, the Qt documentation even has a full example for its usage.
You basically create a QXmlStreamWriter object and have it operate on a QBuffer or QByteArray.
Then you start the XML document by calling writeStartDocument(). At the end you finish the XML document by calling writeEndDocument().
In between you iterate over your query and call writeStartElement(), writeEndElement() for creating XML elements/tags, using the tag names and structure specified by your web service's API.
Cheers,
_
Hi anda_skoa thankz for reply........That part of writing db data to xml is completed with DomDocument without any problem.
My question is about how to hit the web service api through object as a parameter( i.e created in asp.net) .For example my service is http://serviceurl.com/postStudentDataMethod. ......This url accepts the student object in c# with id ,name , phone,address,age.....etc upt o 30. How to create that student object in qt and how to pass these object with those details to above url !
I think this is what You need.
thankz for reply Lesiok.................In the given example,the response data is formated to xml ...But i need to pass a object to web service api..where the object holds 10 values(like name,area,ID,phno...etc) in xml kind of format...
Well, sending data to a web service is usually done via HTTP POST, which is available in Qt through QNetworkAccessManager.
How the post data has to be structured depends on the web service API.
If it is a SOAP API and therefore has a WSDL file describing the API, you could use a code generate like the one from https://github.com/KDAB/KDSoap to generate Qt API for you.
If it is something different, e.g. a REST interface using XML as the data format, you'll have send your XML data manually using QNetworkAccessManager.
Cheers,
_
Bookmarks