What is the best implementation for metadata



i’m currently working on extensis Server on document managing. Currently we are using demo enterprise edition.

the scenario is :
the document and its metadata (on separate file) are going to be send to extensis server. Also the metadata will added to the property of the document then the metadata be used to search the document later.

Is it possible to automatically add those metadata as soon as those field being uploaded to folder in server?
can we do this? or is there any alternative way to achieve this?

thank you for your attention.


Hi Rico,

Portfolio does not have a mechanism to parse metadata from a separate file and add it to an image while cataloging. This is something that you would need to develop.

What you can do is create an upload tool that can use a workflow similar to this.
[li]Select an image and a companion XML file.[/li]
[li]Upload the image to the Portfolio Server.[/li]
[li]At the completion of the upload cycle, the Portfolio Server returns the new Record ID of the recently uploaded file.[/li]
[li]Parse the XML file for the metadata that you wish to associate with the image.[/li]
[li]Using the Record ID returned in Step 3, upload the metadata to the record using the UpdateAssetFieldValues command.[/li]
[li]Repeat as necessary.[/li][/ol]

This is one method to accomplish what you are looking for. As you work, you may find a strategy that works better for your environment.

If you have any questions, feel free to ask.



thank you for your response,

i tried to upload the file using extensis API. Unfortunately, i found error 500 when i tried to do it.
here is my code :

[code] // Where the file is stored locally.
String directory = “/c:/aa”;
// The name of the file.
String item = “c.pdf”;
// Where the file will be saved on the server.
String destination = “::localhost:Portofolio:HRD Files:document”;
String ImageName = directory + “/” + item;
File imagePath = new File(ImageName);
if (imagePath.exists())
String cr = “\r\n”;
String boundary = “----” + UUID.randomUUID().toString().replace("-", “”);
String bar = “–” + boundary + cr;
String sHeader = bar;
sHeader += “Content-Disposition: form-data; name=“sessionId”” + cr + cr + sessionId + cr;
sHeader += bar;
sHeader += “Content-Disposition: form-data; name=“catalogId”” + cr + cr + catalogId + cr;
sHeader += bar;
sHeader += “Content-Disposition: form-data; name=“destinationFolder”” + cr + cr + destination + cr;
sHeader += bar;
sHeader += “Content-Disposition: form-data; name=“filename”” + cr + cr + item + cr;
sHeader += bar;
sHeader += “Content-Disposition: form-data; name=“action”” + cr + cr + “upload” + cr;
sHeader += bar;
sHeader += “Content-Disposition: form-data; name=“Filedata”; filename=”" + item + “”" + cr;
sHeader += “Content-Type: application/octet-stream” + cr + cr;

	// Convert the String to a Byte array.
	  byte[] header = sHeader.getBytes("UTF-8");
	  String footerStr = cr + "--" + boundary + "--";
	  byte[] footer = footerStr.getBytes("UTF-8");
	//Set up the connection URL.	
	  try {
		   URL url = new URL("http://" + SERVER_ADDRESS + ":" + SERVER_PORT + "/FileTransfer/upload");
		   HttpURLConnection conn = (HttpURLConnection)url.openConnection();
		   conn.setRequestProperty("Connection", "close");
		   conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
		   conn.setRequestProperty("Accept-Types", "text/*");
		   conn.setRequestProperty("Content-Length", String.valueOf(footer.length + header.length + (int)imagePath.length()));
		   OutputStream os = conn.getOutputStream();
		// Upload the Header
		   os.write(header, 0, header.length);

		// Read the image file into a Byte array
		   byte[] buf = new byte[8192 * 16];
		   FileInputStream imageFile = new FileInputStream(imagePath);
		   while (true)
			int nread = imageFile.read(buf);
			if (nread <= 0)
		// Write the Byte array to the Portfolio server
			os.write(buf, 0, nread);
		// Once the image has been written.  Write the footer byte array.
		   os.write(footer, 0 , footer.length);
		   BufferedReader in = new BufferedReader( new InputStreamReader( conn.getInputStream()));
		   String textResult = "";
		   String line = null;
		   while ((line = in.readLine()) != null) {
			textResult += line;
		// Print the resulting Record ID.
	  catch (Exception e){
		System.out.println (""+e.getMessage());

also i got this error on the server log :

2013-11-05 18:23:56,369 [] ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/].[FileTransferServlet]] Servlet.service() for servlet FileTransferServlet threw exception
javax.servlet.ServletException: NotFound
at extensis.portfolio.server.service.FileTransferServlet.doUpload(FileTransferServlet.java:195)
at extensis.portfolio.server.service.FileTransferServlet.doPost(FileTransferServlet.java:497)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:881)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:674)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:541)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:113)
at java.lang.Thread.run(Thread.java:662)

can you help me to find what is wrong?



It looks to me like your program cannot find the location to upload the file.
In your code, you have this line: String destination = “::localhost:Portofolio:HRD Files:document”;

Is this location referencing a directory within a Watchfolder? If it is not, then Portfolio will not be able to find it to upload the file. The other thing you may want to look at is localhost in your destination path. You may find that Portfolio is referring to this as a machine name and not localhost.

If you want to be sure what path that Portfolio is using. Connect to the server using the Webclient, select your Watchfolder and double click on it. You should see an image like this:

In the above screenshot, the Watchfolder path is ::GARM:Storage:Autosync:Pins and Things. If I wanted to upload to a subfolder called Upload, then my destination path would be ::GARM:Storage:Autosync:Pins and Things:Upload

If I were to use a path other than what is available in the Watchfolder, for example ::GARM:Storage:Upload, then I would get a javax.servlet.ServletException: NotFound error, because the location cannot be found by Portfolio.

I hope this helps, if you have any further questions, please let me know.