[midPoint] Objects uploaded via REST API, everything between <code></code> mangled into single

Kari Heikkilä kari.heikkila at qvantel.com
Mon Apr 24 08:40:17 CEST 2017


Hi again,

not tested suggested options, all failed:

Attila’s  
 solution: no effect for functionality, still mangled into single line
Mikko’s  CDATA solution: no effect to functionality, still mangled into single line (and CDATA filtered out on some point ie. not visible when opening template object via Configuration -> Repository objects )

Regards,
Kari


From: midPoint [mailto:midpoint-bounces at lists.evolveum.com] On Behalf Of Attila Szlovak
Sent: sunnuntai 23. huhtikuuta 2017 17.35
To: midpoint at lists.evolveum.com
Subject: Re: [midPoint] Objects uploaded via REST API, everything between <code></code> mangled into single


Hi Kari,

as a workaround I'm adding line feed code (
) to the end of each lines in <code></code> section sent via REST API, e.g. :

<code>

code_line_1; 


code_line_2; 


</code>



Best regards,

Attila

On 2017-04-23 16:12, Kari Heikkilä wrote:
Hi Pavol, Ivan & Mikko

I tried REST API as per https://wiki.evolveum.com/display/midPoint/REST+API#RESTAPI-CreateorUpdateobject
ie. using curl with PUT method, see transcript below (some parts of transcript anonymized).

Have not tried Mikko’s idea using CDATA wrapping yet.

Regards,
Kari

$ curl --user administrator:TopSecretPassword  "Content-Type: application/xml" -X PUT https://our.midpoint.host/ws/rest/objectTemplates/b1567733-38de-4a18-b8b8-1eb365f34025 -d @./template-new-user.xml -v
* About to connect() to our.midpoint.host port 443 (#0)
*   Trying 10.11.12.13...
* Connected to our.midpoint.host (10.11.12.13) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate:
*       subject: CN= our.midpoint.host,O=Company,L=Location,ST=LS,C=FI
*       start date: Feb 02 05:50:15 2017 GMT
*       expire date: Feb 02 05:50:15 2019 GMT
*       common name: our.midpoint.host
*       issuer: CN=Our-CA,DC=midpoint,DC=host
* Server auth using Basic with user 'administrator'
> PUT /ws/rest/objectTemplates/b1567733-38de-4a18-b8b8-1eb365f34025 HTTP/1.1
> Authorization: Basic PlaaPlaaPlaaPlaaPlaa=
> User-Agent: curl/7.29.0
> Host: our.midpoint.host
> Accept: */*
> Content-Type: application/xml
> Content-Length: 4986
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< HTTP/1.1 201
< Server: nginx/1.10.3
< Date: Sun, 23 Apr 2017 13:51:18 GMT
< Content-Length: 0
< Connection: keep-alive
< Location: http:// our.midpoint.host /ws/rest/objectTemplates/b1567733-38de-4a18-b8b8-1eb365f34025/b1567733-38de-4a18-b8b8-1eb365f34025
<
* Connection #0 to host our.midpoint.host left intact
[

From: midPoint [mailto:midpoint-bounces at lists.evolveum.com] On Behalf Of Pavol Mederly
Sent: lauantai 22. huhtikuuta 2017 15.52
To: midpoint at lists.evolveum.com<mailto:midpoint at lists.evolveum.com>
Subject: Re: [midPoint] Objects uploaded via REST API, everything between <code></code> mangled into single


I have the same experience (uploading XML files with groovy code via plugin without problems). Plugin uses PUT if the object has an OID and POST if it has none. Maybe if you could post here more details, like how exactly you try to upload the objects: e.g. the transcript of HTTP communication, or information on commands/libraries used, etc. Or maybe you could set up some logging to see where the newlines are being eaten.

Pavol Mederly

Software developer

evolveum.com
On 21.04.2017 10:07, Ivan Noris wrote:

Hi Kari,

this is interesting, as I'm using midPoint 3.5.1 with Eclipse plugin (which uses REST) and after uploading resource, I certainly see multiline code in Repository pages... Maybe that's different operation...

Regards,

Ivan



On 04/20/2017 07:47 PM, Kari Heikkilä wrote:
Hi,

started to use midPoint REST API for updating objects I noticed that everything between <code></code> tags is reformatted into single line.
This means multiline groovy scripts will become very difficult to read (for human) in midPoint and if semicolons are missing, groovy code execution will most probably fail.

Used PUT method and .xml files with both nl and cr+lf line endings tried.

Is there anything to prevent this behavior?

Best regards,
Kari






_______________________________________________

midPoint mailing list

midPoint at lists.evolveum.com<mailto:midPoint at lists.evolveum.com>

http://lists.evolveum.com/mailman/listinfo/midpoint




--

Ivan Noris

Senior Identity Engineer

evolveum.com





_______________________________________________

midPoint mailing list

midPoint at lists.evolveum.com<mailto:midPoint at lists.evolveum.com>

http://lists.evolveum.com/mailman/listinfo/midpoint





_______________________________________________

midPoint mailing list

midPoint at lists.evolveum.com<mailto:midPoint at lists.evolveum.com>

http://lists.evolveum.com/mailman/listinfo/midpoint

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170424/40e61f01/attachment.htm>


More information about the midPoint mailing list