HI.

The data coming in from the form may very well be base-64 encoded.  For
that, you will need xdmp:base64-decode() in addition to what you already
have.




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 07:29, Raghu <[email protected]>
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

Reply via email to