Mimetype and ContentFormat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2005 02:12 PM
I'm a little bit confused. I create new content with the webservice so I call ContentService.create() which takes a ContentFormat. This one is constructed with a mimetype and encoding. But how do I add a new mimetype (like rfc/822)? I found the tutorial to create a new content type but how is this linked to the mimetype? I want to create a new content with the mentioned mimetype (which is not available in alfresco yet) and I need to add some properties to the content (which is probably done with the content type). Can somebody please enlighten me how this is supposed to work?
Thanks a bunch!
Carsten
- Labels:
-
Archive

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2005 04:44 AM
To add new mime types you edit the mimetype-map.xml file which you will find in projects/repository/config/alfresco if you are running from the source, in <alfresco-home>/tomcat/webapps/alfresco/WEB-INF/classes if you are running from the Tomcat bundle or <alfresco-home>/jboss/server/default/conf if you are running from the JBoss bundle.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2005 05:27 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2005 06:59 AM
At the moment there is no way to set the content type using the content service.
If you want to create a content node of a specific content type then use a CML update via the repository service.
Have a look at WebServiceSample4 for an example of this and the Wiki has some documentation relating to the CML capabilities.
Adding the ability to set the content type via the content service is defiantly an enhancement we need to do and I'll add a JIRA task to ensure it gets done.
Thanks,
Roy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2005 07:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2005 03:55 PM
In the meantime I tried to create a content node with CML but this fails. I have defined my own model, placed it in the alfresco/extension directory and added it to extension-context.xml (alfresco/extension/rfc822.xml).
<model name="inovox:model" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<description>RFC 822</description>
<author>Inovox</author>
<version>1.0</version>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
</imports>
<namespaces>
<namespace uri="http://www.inovox.de/model/1.0" prefix="inovox"/>
</namespaces>
<types>
<type name="inovox:email">
<title>RFC 822 EMail</title>
<parent>cm:content</parent>
<properties>
<property name="inovox

<type>d:datetime</type>
</property>
<property name="inovox

<type>d:text</type>
</property>
<property name="inovox:From">
<type>d:text</type>
</property>
<property name="inovox:To">
<type>d:text</type>
</property>
</properties>
</type>
</types>
</model>
Now I fire a CMLCreate:
CMLCreate create = new CMLCreate(uid, parentReference, "inovox:email", props);
The result is this:
RepositoryFault:<ns1:errorCode>0</ns1:errorCode><ns1:message>Class {}inovox:email has not been defined in the data dictionary</ns1:message>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2005 04:13 PM
Try …
CMLCreate create = new CMLCreate(uid, parentReference, "{http://www.inovox.de/model/1.0}email", props);
… instead.
Hope this helps,
Roy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2005 03:39 PM
So now I can create a content node of my type and set the properties with the NamedValue[]. But how can I set the content? Probably a stupid question but everything I found referred to the java api and not to the webservice.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2005 03:58 PM
Try using the write method on the content web service.
Have a look in WebServiceSample3.java for an example and here http://www.alfresco.org/mediawiki/index.php/Web_Service_Samples_for_Java for a little detail on what the web service samples include.
Hope this helps,
Roy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2005 05:05 PM
I already tried that but all I got was an exception:
{http://www.alfresco.org/ws/service/content/1.0}ContentFault:<ns1:errorCode>0</ns1:errorCode><ns1:message>Failed to set content property on stream closure:
node: workspace://SpacesStore/176db206-5ba4-11da-94ca-ad548187be52
property: {http://www.alfresco.org/model/content/1.0}content
writer: ContentAccessor[ contentUrl=store://2005/11/22/17b9af2a-5ba4-11da-94ca-ad548187be52.bin, mimetype=null, size=4, encoding=UTF-8]</ns1:message>
The exception is thrown when I try to write the content:
UpdateResult[] result = repositoryService.update(cml);
contentService.write(result[0].getDestination(), bytes);
