diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/ws/resources/api/ResourceListDTO.java b/navalplanner-webapp/src/main/java/org/navalplanner/ws/resources/api/ResourceListDTO.java
index 9033a7b83..e0435c5d6 100644
--- a/navalplanner-webapp/src/main/java/org/navalplanner/ws/resources/api/ResourceListDTO.java
+++ b/navalplanner-webapp/src/main/java/org/navalplanner/ws/resources/api/ResourceListDTO.java
@@ -25,12 +25,14 @@ import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlRootElement;
/**
* DTO for a list of Resource entities.
*
* @author Fernando Bellas Permuy
*/
+@XmlRootElement(name="resource-list")
public class ResourceListDTO {
@XmlElements({
diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/ws/resources/impl/ResourceServiceREST.java b/navalplanner-webapp/src/main/java/org/navalplanner/ws/resources/impl/ResourceServiceREST.java
index 5feb4fd80..b2e7c4fb6 100644
--- a/navalplanner-webapp/src/main/java/org/navalplanner/ws/resources/impl/ResourceServiceREST.java
+++ b/navalplanner-webapp/src/main/java/org/navalplanner/ws/resources/impl/ResourceServiceREST.java
@@ -23,6 +23,8 @@ package org.navalplanner.ws.resources.impl;
import java.util.ArrayList;
import java.util.List;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@@ -38,6 +40,7 @@ import org.navalplanner.ws.resources.api.ResourceDTO;
import org.navalplanner.ws.resources.api.ResourceListDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
/**
* REST-based implementation of IResourceService.
@@ -53,6 +56,9 @@ public class ResourceServiceREST implements IResourceService {
private IResourceDAO resourceDAO;
@Override
+ @POST
+ @Consumes("application/xml")
+ @Transactional
public InstanceConstraintViolationsListDTO addResources(
ResourceListDTO resources) {
diff --git a/navalplanner-webapp/src/main/resources/navalplanner-webapp-spring-config.xml b/navalplanner-webapp/src/main/resources/navalplanner-webapp-spring-config.xml
index b8b87c566..7d2d5dce1 100644
--- a/navalplanner-webapp/src/main/resources/navalplanner-webapp-spring-config.xml
+++ b/navalplanner-webapp/src/main/resources/navalplanner-webapp-spring-config.xml
@@ -48,6 +48,7 @@
+
diff --git a/scripts/rest-clients/README b/scripts/rest-clients/README
index 5a6fe6a48..44b19c3da 100644
--- a/scripts/rest-clients/README
+++ b/scripts/rest-clients/README
@@ -20,9 +20,20 @@
- export-criterion-types.sh (authenticate with wsreader/wsreader)
+ * Import resources:
+
+ - import-resources.sh resources-sample.xml
+ (authenticate with wswriter/wswriter)
+
+ - Check the returned errors are consistent with the comments in
+ resources-sample.xml.
+
+ When working with the online demo:
* import-criterions-types.sh --prod criterion-types-sample.xml
(authenticate with wswriter/wswriter)
* export-criterion-types.sh --prod (authenticate with wsreader/wsreader)
+
+ * import-resources.sh --prod resources-sample.xml
+ (authenticate with wswriter/wswriter)
diff --git a/scripts/rest-clients/import-resources.sh b/scripts/rest-clients/import-resources.sh
new file mode 100755
index 000000000..18ea8298c
--- /dev/null
+++ b/scripts/rest-clients/import-resources.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+. ./rest-common-env.sh
+
+printf "Login name: "
+read loginName
+printf "Password: "
+read password
+
+baseServiceURL=$DEVELOPMENT_BASE_SERVICE_URL
+certificate=$DEVELOPMENT_CERTIFICATE
+
+for i in "$@"
+do
+ if [ "$i" = "--prod" ]; then
+ baseServiceURL=$PRODUCTION_BASE_SERVICE_URL
+ certificate=$PRODUCTION_CERTIFICATE
+ else
+ file=$i
+ fi
+done
+
+if [ "$file" = "" ]; then
+ printf "Missing file\n" 1>&2
+ exit -1
+fi
+
+authorization=`./base64.sh $loginName:$password`
+
+curl -sv -X POST $certificate -d @$file \
+ --header "Content-type: application/xml" \
+ --header "Authorization: Basic $authorization" \
+ $baseServiceURL/resources | tidy -xml -i -q -utf8
diff --git a/scripts/rest-clients/resources-sample.xml b/scripts/rest-clients/resources-sample.xml
new file mode 100644
index 000000000..58627359a
--- /dev/null
+++ b/scripts/rest-clients/resources-sample.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+