Thanks David Ennis and Florent Georges. I will try them.
On Tue, Feb 10, 2015 at 6:53 PM, David Ennis <[email protected]>
wrote:
> I just checked some of our source code for saving from a post to disk.
> Florent's example has the key - its the casting to xs:base64binary..
>
> An example from working code is: xdmp:save([your-path-here],
> binary{xs:hexBinary(xs:base64Binary([your post variable here)})
>
>
>
> Kind Regards,
> David Ennis
>
>
> David Ennis
> *Content Engineer*
>
> [image: HintTech] <http://www.hinttech.com/>
> Mastering the value of content
> creative | technology | content
>
> Delftechpark 37i
> 2628 XJ Delft
> The Netherlands
> T: +31 88 268 25 00
> M: +31 63 091 72 80
>
> [image: http://www.hinttech.com] <http://www.hinttech.com>
> <https://twitter.com/HintTech> <http://www.facebook.com/HintTech>
> <http://www.linkedin.com/company/HintTech>
>
> On 10 February 2015 at 13:57, Florent Georges <[email protected]> wrote:
>
>> Hi,
>>
>> In addition, you might be interested in the following (not been
>> maintained for years and never been completely implemented, but there
>> was something WRT multipart, if I remember correctly):
>>
>>
>> https://github.com/fgeorges/expath-http-client-ml/blob/master/src/http-client.xq
>>
>> Regards,
>>
>> --
>> Florent Georges
>> http://fgeorges.org/
>> http://h2oconsulting.be/
>>
>>
>> On 10 February 2015 at 07:29, Raghu wrote:
>> > Hi All,
>> >
>> > I'm calling a web service from my xquery and the response I'm getting
>> is a
>> > multipart response with two parts. I need the binary content(pdf) in the
>> > second part to be stored in Marklogic, using xdmp:document-insert(),
>> but I'm
>> > unable to do that, I'm getting the following errors
>> >
>> >
>> > If I use xdmp:document-insert ($uri,$secondPart) it says ARG2 IS NOT A
>> NODE
>> >
>> > If I use xdmp:document-insert ($uri,document { $secondPart } ) the query
>> > times out
>> >
>> > If I use binary{$secondPart} then it says invalid xdmp:cast exception
>> >
>> > If I use xdmp:multipart-decode($boundary-value, $multipart-response[2])
>> then
>> > I get xdmp:invalid multipart
>> >
>> > How do I parse a mutlipart response in xquery? What is the right way to
>> do
>> > this?
>> > Please help me out here.
>> >
>> > (: Logic I've used to parse the multipart response is below :)
>> >
>> > let $boundary-value := fn:concat('--',
>> >
>> fn:substring-after($multipart-response[1]/http:headers/http:content-type,
>> > 'application/x-multipart-mixed;boundary='))
>> >
>> > let $multipart-responseStr :=
>> > xdmp:binary-decode($multipart-response[2], 'UTF-8')
>> >
>> > let $tokens := fn:tokenize($multipart-responseStr,
>> > $boundary-value)
>> >
>> > let $secondPart := fn:substring-after($tokens[3],
>> 'Content-Type:
>> > application/pdf;charset=UTF-8')
>> >
>> >
>> > Thanks in advance!
>> >
>> >
>> >
>> >
>> > _______________________________________________
>> > General mailing list
>> > [email protected]
>> > http://developer.marklogic.com/mailman/listinfo/general
>> >
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://developer.marklogic.com/mailman/listinfo/general
>>
>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general