Thanks Jason, I have tried that and the datastreamVersion I got was:

<foxml:datastreamVersion ID="dctst.4" LABEL="Test Modify"
CREATED="2010-03-01T20:14:28.119Z"
MIMETYPE="text/xml;boundary=----------------------------48598ac9f1c5">

and I also got the boundary and some header stuff mixed in to the top
of the datastream. So It looks like it is messing up the multipart
content-type rather than assigning it to the XML part of the request
content. This post is the best explanation of how PHP/libcurl is
broken that I've found:

http://osdir.com/ml/web.curl.php/2007-12/msg00033.html

I'm new to PHP, and FedoraCommons, but it seems simpler to use the
mimeType parameter if I can figure if/how it works.

-Don

On 3 March 2010 14:06, Jason Nugent <[email protected]> wrote:
> hi Don,
>
> Have you tried using the PHP libcurl function curl_setopt() to set the
> MIME type for your PHP curl call?
>
> $header = array();
> $header[] = "Content-Type: text/html";
>
> ... other additions to $header, and then:
>
> curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
>
> before you do your curl_exec() call.
>
> Regards,
>
> Jason
>
> On 3/3/10 2:49 PM, Don Gourley wrote:
>> When I add or modify a managed XML datastream using the REST API, I am
>> unable to get the correct mime-type on the datastreamVersion. For
>> example,
>>
>> curl -i -XPUT 
>> "https://example.com:8443/fedora/objects/demo:29/datastreams/dctst?mimeType=text/xml&controlGroup=M&dsLabel=Test+mimeType";
>> --data-binary @dc.xml -k -u fedoraAdmin:******
>>
>> creates a datastreamVersion like this:
>>
>> <foxml:datastreamVersion ID="dctst.5" LABEL="Test mimeType"
>> CREATED="2010-03-03T18:10:23.286Z"
>> MIMETYPE="application/x-www-form-urlencoded">
>> <foxml:contentLocation TYPE="INTERNAL_ID" REF="demo:29+dctst+dctst.5"/>
>> </foxml:datastreamVersion>
>>
>> (I've tried it url-encoded with the mimeType=text%2Fxml also)
>>
>> I know that I can add -H "Content-Type: text/xml" to the cURL command
>> and get the right mime-type in the datastreamVersion, but the problem
>> is that I am trying to write client application using PHP and libcurl
>> and adding a content-type request header doesn't work with that mix.
>> And the mimeType parameter is supposed to override the request header
>> anyway, or am I not using it correctly?
>>
>> I am trying to update a Fedora 3.1 repository.
>>
>> thanks,
>> -Don
>>
>> ------------------------------------------------------------------------------
>> Download Intel&#174; Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Fedora-commons-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/fedora-commons-users
>>
>
> --
> Jason Nugent
> Systems Programmer/Database Developer
> Electronic Text Centre
> University of New Brunswick
> [email protected]
> (506) 447 3177
>



-- 
Don Gourley,  IT Manager
Digital Humanities Observatory
~a project of the Royal Irish Academy~
+353 1 234 2446   --   [email protected]

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Fedora-commons-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

Reply via email to