Sending a Image or other data in nuSoap - web-services

How to send a image or a file using the web service to the server ?

Here is a good example of how to send a file using NuSOAP:
http://web.imkrisna.com/june/news/simple-file-transfer-using-nusoap/

The web service's documentation should specify the necessary format, which will probably involve base64 encoding the image data. You would do whatever encoding the web service requires and then pass it to nuSoap in the same way you already do for text.

Related

how to decode a encoded xml in developer studio/ web service

I am using web services to read a xml report from oracle xmlserver.
The service then returns encoded value of the report and then I have to decode it via web link. Problem is i can not use web link every time to decode it
Is there any way that it doesn't return me encoded value and returns actual xml.
Also, is there any way to decode the encoded file via developer studio?
Any ideas and thoughts will be appreciated.

Calling a webservice that uses ISO-8859-1 encoding from Progress 4GL

I'm use progress 4Gl and i have to call a webservice that uses ISO-8859-1 but i receive the error when a execute the run statment:
Error receiving Web Service Response: Cannot get 'ISO-8859-1' transcoder from the TranscoderRepository. (11773)
And the developer of webservice can not change the encoding.
Someone can help me?
Progress only supports the UTF-8 and UTF-16 encoding with the OpenEdge Web Services as required by the WS-I
According to this knowledgebase entry
If you're sure the data is standard ascii (character values with ascii value < 128) there is a work-around.
You download the wsdl of the webservice locally.
Replace iso8859-1 but utf-8 in the locally saved file.
Use that wsdl instead of the one from the webservice.
This is a work-around, not an ideal solution.

SOAP UI sending attachment which contains Cyrillic characters

I am working on an application allowing user to upload XML file to server through a web service. Files are sent as attachment. I am using MTOM. I was able to send and receive file.
The problem is that my XML file contains Cyrillic letter. When I print XML on server side all Cyrillic letters changed into something like "=D0=9A=D0=95=D0=9D=D0=96=D0=90=D0==9B=D0=98=D0=9D=D0=9E=D0=92=D0=90". At first I thought that java code was wrong and I used wrong encoding when reading XML file attachment on server side. To test the web service I use SOAPUI. I started looking at the request and found that even before request containing the file was sent, SOAPUI already "messed up" the characters in the attachment.
How should I set the SOAPUI setting to send proper request?
Set the Encoding property in you test request to UTF-8.
mmm anyways I was using old version of soapui. After I got the latest one, the problem disappeared.

Returning an image from a REST web service

I need to return an image from my rest web service. How can I achieve this? Furthermore, What would be the best way to do that? Should I send a link to my image or return the image directly from my web service? The image to be returned to the client is confidential. Plz help.
If it is a SOAP you can use MTOM to add your image in response. As you mentioned that you are using REST, following question may help you:
Is it possible to use MTOM in reponse of CXF RESTful Web Service

return a pdf in browser from web service

i am relative new in java development..
I want to create a web service (jax-ws)/web application that will receive some input and generate pdf, and then open the pdf in the browser. I manage to create the pdf (using itext) and open it in the broswer using servlet (with FileInputStream etc).
However i do not know, how to return the servlet from the web service.
What should I do, so when I call the web service to receive a pdf via the servlet ?
If you've returned PDF from servlet, it means your servlet sent PDF stream as output and probably set content type as "application/pdf". This works fine in the browser and this is the right way to do it.
However, you cannot easily invoke web service (no matter whether it is JAX-WS or any other stack) from the browser. Web service call requires POST and strictly defined SOAP content. You can, however, use AJAX to call web service, but that is a different story (also look at REST).
If you want to return binary data from web service (please keep in mind that web-services are for machines, not for humans using web browsers), you have two options: either serialize the binary data using base64 or use multipart HTTP response (MTOM standard, see for instance: http://www.mkyong.com/webservices/jax-ws/jax-ws-attachment-with-mtom).