Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
EXPath HTTP Client post form data – an example
let $parameter1 := "one"
let $parameter2 := "two"
let $parameter3 := "three"
let $boundary := current-dateTime() => util:hash("md5") => substring(0,17)
let $request :=
<hc:request method="POST" href="{ $webauthUrl }" http-version="1.0">
<hc:header name="Connection" value="close" />
<hc:multipart media-type="multipart/form-data" boundary="------------------------{$boundary}">
<hc:header name="Content-Disposition" value='form-data; name="parameter1"'/>
<hc:body media-type="text/plain">{$parameter1}</hc:body>
<hc:header name="Content-Disposition" value='form-data; name="parameter2"'/>
<hc:body media-type="text/plain">{$parameter2}</hc:body>
<hc:header name="Content-Disposition" value='form-data; name="parameter3"'/>
<hc:body media-type="text/plain">{$parameter3}</hc:body>
</hc:multipart>
</hc:request>
return
hc:send-request($request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment