Hi,
I have a web service inteface to a Document Management System that I can use to add a file to the DMS if it is encoded in base64Binary.
How can I take a file uploaded to Ebase, read it as a binary file stream and output that to the web service?
Regards,
Edd Parsons
Reading files as binary data
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 53
- Joined: Wed Jan 02, 2013 4:23 pm
- Location: Lyndhurst, Hampshire
- Contact:
-
- Moderator
- Posts: 421
- Joined: Fri Sep 07, 2007 3:44 pm
- Location: Sandy, UK
- Contact:
Hi Edd,
I am afraid that this is not supported with the current Ebase web service resources.
You can create your own web service using CXF API (This is our underlying Web Service technology), providing there is a WSDL to import from the DMS.
http://cxf.apache.org/docs/wsdl-to-java.html demonstrates how to convert the WSDL into Java stub classes that you can populate using a custom resource or invoke directly using server side JavaScript.
http://cxf.apache.org/docs/how-do-i-dev ... lient.html demostrates how to create a CXF client and invoke the web service using your stub classes.
I hope this helps?
Steve
I am afraid that this is not supported with the current Ebase web service resources.
You can create your own web service using CXF API (This is our underlying Web Service technology), providing there is a WSDL to import from the DMS.
http://cxf.apache.org/docs/wsdl-to-java.html demonstrates how to convert the WSDL into Java stub classes that you can populate using a custom resource or invoke directly using server side JavaScript.
http://cxf.apache.org/docs/how-do-i-dev ... lient.html demostrates how to create a CXF client and invoke the web service using your stub classes.
I hope this helps?
Steve
0 x
-
- Ebase User
- Posts: 53
- Joined: Wed Jan 02, 2013 4:23 pm
- Location: Lyndhurst, Hampshire
- Contact:
-
- Moderator
- Posts: 421
- Joined: Fri Sep 07, 2007 3:44 pm
- Location: Sandy, UK
- Contact:
Hi Edd,
I have been reading around this subject and you might be able to set the convert the data to base64 string and set this on your Web Service Document:
Using Java code you can:
note that encodedImage is a string and you can map this to a web service resource field.
Also Base64 can be found in the apache commons API.
Using the server side JavaScript:
I think this should work.
Steve
I have been reading around this subject and you might be able to set the convert the data to base64 string and set this on your Web Service Document:
Using Java code you can:
Code: Select all
BufferedImage img = ImageIO.read(new File("image.png"));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(img, "png", baos);
baos.flush();
String encodedImage = Base64.encodeToString(baos.toByteArray());
baos.close(); // should be inside a finally block
Also Base64 can be found in the apache commons API.
Using the server side JavaScript:
Code: Select all
importPackage(java.io);
.......
//note need other imports here
var img = ImageIO.read(new File("image.png"));
var baos = new ByteArrayOutputStream();
ImageIO.write(img, "png", baos);
baos.flush();
var encodedImage = Base64.encodeToString(baos.toByteArray());
baos.close(); // should be inside a finally block
Steve
0 x
- dvanhussel
- Ebase User
- Posts: 161
- Joined: Fri Oct 19, 2007 12:45 pm
- Location: Haarlem, the Netherlands
Who is online
Users browsing this forum: No registered users and 6 guests