[jboss-user] [JBossWS] - Re: file transfer via SOAP and RPC
mendret
do-not-reply at jboss.com
Thu Jan 22 05:32:40 EST 2009
ok, now I found a relativ good example at
http://jbossws.jboss.org/mediawiki/index.php?title=Security_and_attachments_sample#MTOM.2FXOP_newspaper_server
and tried to convert it a bit into real file transfer and not only text, like it is in the example and I tried the following at server side:
| public EditionMTOM doSomething(EditionMTOM data)
| {
| try {
| System.out.println(data.getContent().getContentType());
| InputStream is = data.getContent().getInputStream();
| InputStreamReader isr = new InputStreamReader(is, "UTF-8");
| char[] buff = new char[10];
| isr.read(buff);
| isr.close();
| is.close();
| for (char b : buff) {
| System.out.print(b);
| }
| }
| catch (UnsupportedEncodingException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
| catch (IOException e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
|
| EditionMTOM edition = new EditionMTOM();
| edition.setContent(new DataHandler(new FileDataSource("/opt/test2.dat"), "application/octet-stream"));
| edition.setDate(new Date());
| edition.setId("test2.dat");
| return edition;
| }
|
I get some warnings but at all it works until the server tries to send back data, then i get the following exception:
| org.jboss.ws.WSException: No ByteArrayConverter for class: javax.activation.FileDataSource
|
My question is now what can I do to make this work?
I'm grateful for every advise you can give me
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4203925#4203925
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4203925
More information about the jboss-user
mailing list