Does anyone know how I can upload an asset dynamically?
E.g. using php to build the xml string and then post the request to the DMM.
I've tried the following but I always get an error message
<?php
$xml = '<n1:asset xmlns:n1="http://www.cisco.com/dms/xml/ns/dsm/contentManagement">
<title>Testing</title>
<fileName>http://192.168.11.30:8080/temp/dr_1.html</fileName>
<description>dr_1description</description>
<fileType>HTML</fileType>
<estimatedDuration>
<Hours>0</Hours>
<Minutes>0</Minutes>
<Seconds>10</Seconds>
</estimatedDuration>
<categoryIdList><id>5</id></categoryIdList>
<assetOwner>admin</assetOwner>
<storageType>url</storageType>
<downloadurl>true</downloadurl>
</n1:asset>';
$url = "http://dmst.xxxx.com:8080/xTAS-core/services/content/assets/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false );
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_USERPWD, "admin:Cisco123");
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>
Error message...
HTTP/1.1
415 Unsupported Media Type Server: Apache-Coyote/1.1 Content-Type: text/xml;charset=UTF-8 Content-Length: 0 Date: Fri, 24 Dec 2010 05:23:22 GMT
Anyone got any clue what's wrong with the script?