Browse Source

Using cxf for webservices

7.x-2.x
Daniel Lamb 9 years ago
parent
commit
3e41114025
  1. 27
      islandora_basic_image/islandora_basic_image.module
  2. 12
      islandora_collection/islandora_collection.module

27
islandora_basic_image/islandora_basic_image.module

@ -141,7 +141,9 @@ function islandora_basic_image_node_postinsert($node) {
); );
} }
httprl_request("http://127.0.0.1:8888/islandora/rest/basic-image/?uuid=$parent_collection", $url = "http://127.0.0.1:8181/cxf/islandora/image/$parent_collection";
dd($options);
httprl_request($url,
$options); $options);
$response = httprl_send_request(); $response = httprl_send_request();
} }
@ -184,7 +186,28 @@ function islandora_basic_image_node_postupdate($node) {
); );
} }
httprl_request("http://127.0.0.1:8888/islandora/rest/basic-image/?uuid={$node->uuid}", httprl_request("http://127.0.0.1:8181/cxf/islandora/image/{$node->uuid}",
$options); $options);
$response = httprl_send_request(); $response = httprl_send_request();
} }
/**
* Implements hook_node_postdelete().
*/
function islandora_basic_image_node_postdelete($node) {
if (isset($_SERVER['HTTP_IGNORE_HOOKS']) && strcmp(strtolower($_SERVER['HTTP_IGNORE_HOOKS']), "true") == 0) {
return;
}
// Exit early if it's not a collection.
if (strcmp($node->type, ISLANDORA_BASIC_IMAGE_CONTENT_TYPE) != 0) {
return;
}
$uuid = $node->uuid;
httprl_request("http://127.0.0.1:8181/cxf/islandora/image/$uuid",
array(
'method' => 'DELETE',
));
$response = httprl_send_request();
}

12
islandora_collection/islandora_collection.module

@ -124,12 +124,15 @@ function islandora_collection_node_postinsert($node) {
} }
$node = array_pop($nodes); $node = array_pop($nodes);
$url = "http://127.0.0.1:8181/islandora/rest/collection/$parent_collection"; $url = "http://127.0.0.1:8181/cxf/islandora/collection/$parent_collection";
// Don't forget the trailing slash. // Don't forget the trailing slash.
httprl_request($url, httprl_request($url,
array( array(
'method' => 'POST', 'method' => 'POST',
'headers' => array(
'Content-Type' => 'application/json',
),
'data' => json_encode($node), 'data' => json_encode($node),
)); ));
$response = httprl_send_request(); $response = httprl_send_request();
@ -161,9 +164,12 @@ function islandora_collection_node_postupdate($node) {
$node = array_pop($nodes); $node = array_pop($nodes);
$uuid = $node->uuid; $uuid = $node->uuid;
httprl_request("http://127.0.0.1:8181/islandora/rest/collection/$uuid", httprl_request("http://127.0.0.1:8181/cxf/islandora/collection/$uuid",
array( array(
'method' => 'PUT', 'method' => 'PUT',
'headers' => array(
'Content-Type' => 'application/json',
),
'data' => json_encode($node), 'data' => json_encode($node),
)); ));
$response = httprl_send_request(); $response = httprl_send_request();
@ -183,7 +189,7 @@ function islandora_collection_node_postdelete($node) {
} }
$uuid = $node->uuid; $uuid = $node->uuid;
httprl_request("http://127.0.0.1:8181/islandora/rest/collection/$uuid", httprl_request("http://127.0.0.1:8181/cxf/islandora/collection/$uuid",
array( array(
'method' => 'DELETE', 'method' => 'DELETE',
)); ));

Loading…
Cancel
Save