Opened 10 years ago

Closed 10 years ago

#512 closed task (fixed)

failed to post cache status: 415 -Unsupported Media Type

Reported by: olof.olsson@snd.gu.se Owned by: olhsha
Priority: major Milestone: DASISH backend
Component: DASISH backend Version:
Keywords: cache Cc: olhsha

Description

When i post a cache to a target e.g:
https://lux17.mpi.nl/ds/webannotator/api/targets/450001c6-dd92-4e3f-aa09-a69121c697b3/fragment/placeholderForFragment/cached

First part of the multipart send:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cashedRepresentationInfo xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" URI="https://lux17.mpi.nl/ds/webannotator/api/cached/00000000-0000-0000-0000-000000000051" xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">

<mimeType>text/plain</mimeType>
<tool>DWAN</tool>
<type>html</type>

</cashedRepresentationInfo>

Second part:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" class="client-js ve-not-available" dir="ltr"><head>
...
</head><body></body></html>

The respose from the backend is:
Status Code: 415
Error : Unsupported Media Type

Change History (9)

comment:1 Changed 10 years ago by DefaultCC Plugin

Cc: olhsha added

comment:2 Changed 10 years ago by olof.olsson@snd.gu.se

I also tried with text/html as mimeType

comment:3 Changed 10 years ago by olof.olsson@snd.gu.se

Owner: set to olhsha
Status: newassigned

comment:4 Changed 10 years ago by olhsha@mpi.nl

This comment is just comment for debugging and testing convenience: an example of the posting cached via curl:

curl -u admin:password -H "Content-Type: multipart/mixed" -F "metadata=@cachedInfoToAddExistedUgot.xml; type=application/xml " -F "content=@sagradaopdracht.png; type=image/png" -X POST http://localhost:8080/api/targets/00000000-0000-0000-0000-000000000031/fragment/"(1,1)"/cached -i –v

comment:5 Changed 10 years ago by olof.olsson@snd.gu.se

xpointer used in the uri:

xpointer(start-point(string-range(//div[@id="mw-content-text"]/p[1]/text()[1],'',333))/range-to(string-range(//div[@id="mw-content-text"]/p[1]/text()[1],'',339)))

after encodeURIComponent:

xpointer(start-point(string-range(%2F%2Fdiv%5B%40id%3D%22mw-content-text%22%5D%2Fp%5B1%5D%2Ftext()%5B1%5D%2C''%2C333))%2Frange-to(string-range(%2F%2Fdiv%5B%40id%3D%22mw-content-text%22%5D%2Fp%5B1%5D%2Ftext()%5B1%5D%2C''%2C339)))

this will result in a 404 eg:
https://lux17.mpi.nl/ds/webannotator/api/targets/d28758a0-60b9-4129-8ec9-316a03fd7d7f/fragment/xpointer(start-point(string-range(%2F%2Fdiv%5B%40id%3D%22mw-content-text%22%5D%2Fp%5B1%5D%2Ftext()%5B1%5D%2C''%2C333))%2Frange-to(string-range(%2F%2Fdiv%5B%40id%3D%22mw-content-text%22%5D%2Fp%5B1%5D%2Ftext()%5B1%5D%2C''%2C339)))/cached

comment:6 Changed 10 years ago by olhsha@mpi.nl

Example of a working posting on lux 17 (simple fragment) via REST client

POST https://lux17.mpi.nl/ds/webannotator/api/targets/00000000-0000-0000-0000-000000000031/fragment/(1,1)/cached

Header name: Content-Type

Header value: multipart/mixed; boundary=fb28fa9c9192

--fb28fa9c9192
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cashedRepresentationInfo

xmlns="http://www.dasish.eu/ns/addit"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
URI="tmpNewCacheURI"
xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
<mimeType>text/html</mimeType>
<tool>DWAN</tool>
<type>html</type>

</cashedRepresentationInfo>

--fb28fa9c9192
Content-Type: text/html

<!DOCTYPE html>
<html xmlns="​http://www.w3.org/1999/xhtml" lang="en" class="client-js ve-not-available" dir="ltr"><head>

BZZZ

</head><body></body></html>

--fb28fa9c9192--

comment:8 Changed 10 years ago by olof.olsson@snd.gu.se

Thank you for the debug output, i missed one part in the RFC spec, begining each boundary with -- (not only ending the last one with --).
It works from the client now.

Will be looking into posting zip-files next.

comment:9 Changed 10 years ago by olof.olsson@snd.gu.se

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.