qtsoap for sending image data can any body help?????
qtsoap for sending image data can any body help?????
Could you elaborate? There is a soap client available as part of Qt Solutions for commercial use.
Hi,
It would help if you could let use know in detail what you're trying to do / thinking so we can best answer your questions.
Here's my take on soap style communcation in Qt:
I did a job recently where I wrote an image uploader for a document imaging backend.
The developer of the backend developed his own Java web service transport format which was very similar to SOAP in concept (Why he never used in the first place is beyond me...sheesh).
To send the images I'd request that a 'Batch' be created, then the server returned a receipt which was an xml document (Batch Receipt), then I'd upload the images to his server with a standard QHttp request and I'd receive back an Image Receipt xml document which would state the name assigned to the file by the server. So I'd end up with a list of uploaded filenames.
Then I'd add these names as elements to the first Batch Receipt xml document I received then send that back to the server in 'Commit' mode.
I can't say what was going on in the server because I didn't write it.
But you could use this sort of technique or even Base 64 encode the image files into the xml document and send it all as one request. It really depends on your situation.
I haven't used the QtSoap library so I can't comment on how to use it.
Just remember that the SOAP stuff is just a way of getting the data across and you can do it in one step or many. The reason we uploaded images one at a time was due to the image quality. We were scanning up to A0 maps at 400 - 600 dpi so the files were massive. Also, an single batch could have hundreds of images. Sending any more than one at a time wasn't feasible, but in your case it might be okay to base 64 encode your images straight into an element in the xml document.
If you need to actually use SOAP (which is probably the best way to go) then you'll need QtSoap if you have a commercial licence to Qt, or you could have a look into how http://qsoapman.sourceforge.net/ works.
I hope this helps,
Steve York
hai
thanks for responding so fast, well i did go through the qt soap, the problem i am facing is
how to send base64binary , int, float type values the QtSoapMessage class has an
addMethodArgument function which i take is what is used to send arguments to the function
with the execption of one all takes string type values. while the other one takes a QtSoapType * . The QTSoapType class does not provide any way to pass value of the variable or he variable name . The webservice i plan to use have methods that take int, float
as well as base64 encoded image. can you please tell me how to use
addMethodArgument function or something else that can be used to pass base64 encoded
binary jpeg as well as other datatypes. my main concern is how to send the value .
for eg i have a function that takes a string , base64binary encoded jpeg image and double
how should i populate the QSoapMessage object with values i mean which all functions
can be used.
thanks in advance
Hello all Fellow QT programmers
Can any one tell me in the Scenario where i am supposed to send an image file encoded to Base64 and send as Binary data to SOAP web service using QT SOAP Libraries
How will I send Binary data in an Array and get the Response from the Web Service VIA QT
The Web service Where the QT SOAP has to send the image is located here
http://xrl.us/urur
Please do tell me how will i pass the Binary Data here in this Case the image to the Web Service Via QT SOAP Libraries
Thanks in Advance
Yours Friendly QT programmer
Roger
Last edited by MaxProgrammer; 13th February 2007 at 13:07. Reason: updated contents
How to addmethodargument function to pass base64 binary encoded JPG Image to a Webservice using SOAP ?
addmethodargument function allows to pass primitive methods like Int Bool and String how ever it allows only QtSoapType for passing other types QtSoapType class or its derivatives QtSoapType symbol type does not provide any method to pass value alothough it allows to set the type like Base64 Binary
Pls tell me how will i actually pass value to this particular class when the type is Base64 Binary
Thanks in Advance
where to give the Value of the Array ie the Encoded Base64 binary JPG image to the the Web Service Via SOAP
QtSoapArray ( const QtSoapQName & name, QtSoapType::Type type = Other, int size0 = -1, int size1 = -1, int size2 = -1, int size3 = -1, int size4 = -1 )
This is a quote from:
http://doc.trolltech.com/solutions/4...tsoaptype.html
QtSoapType::Base64Binary is among them.SOAP supports the types described in XML Schema Part 2: Datatypes listed at http://www.w3.org/TR/xmlschema-2/. The following values are represented using QtSoapSimpleType, except where noted.
And you can construct it through:
Just look at the xml schema from the url in the docs to see how should a particular type be created.bool QtSoapSimpleType:arse ( QDomNode node ) [virtual]
Inspects node and constructs the QtSoapSimpleType content if node qualifies as a SOAP simple type. Returns true if it does; otherwise returns false.
Reimplemented from QtSoapType.
anoop (14th February 2007)
hai
can you give me a code snippet or else tell me how to proceed, i mean how to use the parse function to get the base64encoded passed as an argument to the webservice
method
thanks in addvance
No, I can't give you a code snippet as I don't have access to QtSoap, so I won't be able to test it.
Just construct a QDomElement with data formatted as the xml document says and pass it to QSoapSimpleType::parse(). Remember that first you have to encode the data with base64 (if you don't know what that is, ask Google).
Edit:
Most probably it'll just bexml Code:
<base64Binary>base64 encoded data goes here</base64Binary>To copy to clipboard, switch view to plain text mode
Last edited by wysota; 14th February 2007 at 11:41.
How Will i add
Base64Binary ::= ((B64S B64S B64S B64S)*
((B64S B64S B64S B64) |
(B64S B64S B16S '=') |
(B64S B04S '=' #x20? '=')))?
add Base64 encoded image into a QDomNode element
This is just a grammar, you don't need it, just get a base64 encoder or write one yourself, it's trivial.
add Base64 encoded image into a QDomNode elementQt Code:
QBuffer buf; QImage img; // contains your image img.save(&buffer, "JPEG"); QDomDocument doc; elem.setAttribute("name", "somename"); elem.appendChild(doc.createTextNode(encodedstring)); QSoapSimpleType arg; arg.parse(elem); // this should get you a valid QSoapSimpleType objectTo copy to clipboard, switch view to plain text mode
anoop (14th February 2007)
How Will i add Base64 encoded image into a QDomNode element
Look at the previous post. There is a code snippet there that may work.
Once you have your base64 feed it into:
QDomText QDomDocument::createTextNode ( const QString & value )
You'll get back a QDomText object which you can pass into .appendChild(...)
So using the this technique, if you have a string like 'dl;kgjsdflkghlfjkghlkjf' and you call:
You should end up with:Qt Code:
base64Elem.appendChild(base64Text );To copy to clipboard, switch view to plain text mode
Qt Code:
<base64Binary>dl;kgjsdflkghlfjkghlkjf</base64Binary>To copy to clipboard, switch view to plain text mode
Wysota already showed this in his last example.
Hopefully this will highlight the section of his example that actually sticks the base 64 string in the element.
Last edited by stevey; 14th February 2007 at 21:56.
anoop (14th February 2007)
What are the
[HTML]elem.setAttribute("name", "somename");[/HTML]
What Will i have to pass here on "name", "somename" in case of this Webservice
http://xrl.us/urur
Thanks in Advance
Do you have any knowledge about XML or webservices?
You can either ignore it or set the argument name there (like srcImage or whatever is needed)...
Bookmarks