Adding binary content via web services

We are trying to add content items to Rhythmyx using web services. We have been successful passing data collected from a web form to create a content item but we are struggling when it comes to adding binary data.

We have your standard documentation of web services but are there any known issues we need to be aware of or any further documentation or sample code (Java) that might help us?

To add a binary, you need to create a SOAP Attachment. In Java, the best way to do this is to create a javax.activation.DataSource from your data. How you do that depends on how you got the data.

If you’re uploading it from a web form, I recommend that you use the Apache Commons File Upload package, which will parse the multipart form data and return the binary to you in a convenient class (org.apache.commons.fileupload.FileItem). If you are getting the data from somewhere else, then you may need to create your own wrapper class that implements the DataSource interface.

There is some sample code here: http://forum.percussion.com/showthread.php?t=68. It’s a little on the old side: I’ve got cleaner ways of doing this now, but it shows the process clearly enough. The FileItemDataSource class is included in recent builds of the PSOToolkit, should you need it.

Dave