<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Hi <span style="color:windowtext" lang="EN-US">Kari<o:p>,</o:p></span></p>
<p>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. :</p>
<p><code></p>
<p>code_line_1; </p>
<p>code_line_2; </p>
<p></code></p>
<p><br>
</p>
<p><span lang="EN-US">Best regards</span>,</p>
<p>Attila<br>
</p>
<br>
<div class="moz-cite-prefix">On 2017-04-23 16:12, Kari Heikkilä
wrote:<br>
</div>
<blockquote
cite="mid:AM4PR01MB1459B5DF08D2E011520BB5FAFF1C0@AM4PR01MB1459.eurprd01.prod.exchangelabs.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
color:black;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
color:black;
mso-fareast-language:EN-US;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";
color:black;
mso-fareast-language:FI;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;
color:black;
mso-fareast-language:FI;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;
color:black;}
span.EmailStyle21
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 2.0cm 70.85pt 2.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">Hi
Pavol, Ivan & Mikko<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">I
tried REST API as per
<a moz-do-not-send="true"
href="https://wiki.evolveum.com/display/midPoint/REST+API#RESTAPI-CreateorUpdateobject">https://wiki.evolveum.com/display/midPoint/REST+API#RESTAPI-CreateorUpdateobject</a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">ie.
using curl with PUT method, see transcript below (some parts
of transcript anonymized).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">Have
not tried Mikko’s idea using CDATA wrapping yet.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">Kari<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">$
curl --user administrator:TopSecretPassword "Content-Type:
application/xml" -X PUT
<a class="moz-txt-link-freetext" href="https://our.midpoint.host/ws/rest/objectTemplates/b1567733-38de-4a18-b8b8-1eb365f34025">https://our.midpoint.host/ws/rest/objectTemplates/b1567733-38de-4a18-b8b8-1eb365f34025</a>
-d @./template-new-user.xml -v<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">*
About to connect() to our.midpoint.host port 443 (#0)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">*
Trying 10.11.12.13...<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">*
Connected to our.midpoint.host (10.11.12.13) port 443 (#0)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">*
Initializing NSS with certpath: sql:/etc/pki/nssdb<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">*
CAfile: /etc/pki/tls/certs/ca-bundle.crt<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">
CApath: none<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">*
SSL connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">*
Server certificate:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">*
subject: CN=
our.midpoint.host,O=Company,L=Location,ST=LS,C=FI<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">*
start date: Feb 02 05:50:15 2017 GMT<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">*
expire date: Feb 02 05:50:15 2019 GMT<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">*
common name: our.midpoint.host<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">*
issuer: CN=Our-CA,DC=midpoint,DC=host<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">*
Server auth using Basic with user 'administrator'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">>
PUT
/ws/rest/objectTemplates/b1567733-38de-4a18-b8b8-1eb365f34025
HTTP/1.1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">>
Authorization: Basic PlaaPlaaPlaaPlaaPlaa=<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">>
User-Agent: curl/7.29.0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">>
Host: our.midpoint.host<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">>
Accept: */*<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">>
Content-Type: application/xml<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">>
Content-Length: 4986<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">>
Expect: 100-continue<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US"><
HTTP/1.1 100 Continue<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US"><
HTTP/1.1 201<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US"><
Server: nginx/1.10.3<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US"><
Date: Sun, 23 Apr 2017 13:51:18 GMT<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US"><
Content-Length: 0<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US"><
Connection: keep-alive<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US"><
Location: <a class="moz-txt-link-freetext" href="http://">http://</a> our.midpoint.host
/ws/rest/objectTemplates/b1567733-38de-4a18-b8b8-1eb365f34025/b1567733-38de-4a18-b8b8-1eb365f34025<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US"><<o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext" lang="EN-US">*
Connection #0 to host our.midpoint.host left intact<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">[<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span
style="color:windowtext;mso-fareast-language:FI"
lang="EN-US">From:</span></b><span
style="color:windowtext;mso-fareast-language:FI"
lang="EN-US"> midPoint
[<a class="moz-txt-link-freetext" href="mailto:midpoint-bounces@lists.evolveum.com">mailto:midpoint-bounces@lists.evolveum.com</a>]
<b>On Behalf Of </b>Pavol Mederly<br>
<b>Sent:</b> lauantai 22. huhtikuuta 2017 15.52<br>
<b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:midpoint@lists.evolveum.com">midpoint@lists.evolveum.com</a><br>
<b>Subject:</b> Re: [midPoint] Objects uploaded via REST
API, everything between <code></code>
mangled into single<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p>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.<span style="font-size:12.0pt;mso-fareast-language:FI"><o:p></o:p></span></p>
<pre>Pavol Mederly<o:p></o:p></pre>
<pre>Software developer<o:p></o:p></pre>
<pre>evolveum.com<o:p></o:p></pre>
<div>
<p class="MsoNormal">On 21.04.2017 10:07, Ivan Noris wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p>Hi Kari,<o:p></o:p></p>
<p>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...
<o:p></o:p></p>
<p>Regards,<o:p></o:p></p>
<p>Ivan<o:p></o:p></p>
<p><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On 04/20/2017 07:47 PM, Kari Heikkilä
wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">started to use
midPoint REST API for updating objects I noticed that
everything between <code></code> tags is
reformatted into single line.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">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.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Used PUT method and
.xml files with both nl and cr+lf line endings tried.</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Is there anything to
prevent this behavior?</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Best regards,</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Kari </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman",serif;mso-fareast-language:FI"><br>
<br>
<br>
<o:p></o:p></span></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>midPoint mailing list<o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a><o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman",serif;mso-fareast-language:FI"><br>
<br>
<o:p></o:p></span></p>
<pre>-- <o:p></o:p></pre>
<pre>Ivan Noris<o:p></o:p></pre>
<pre>Senior Identity Engineer<o:p></o:p></pre>
<pre>evolveum.com<o:p></o:p></pre>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman",serif;mso-fareast-language:FI"><br>
<br>
<br>
<o:p></o:p></span></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>midPoint mailing list<o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a><o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman",serif;mso-fareast-language:FI"><o:p> </o:p></span></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
</blockquote>
<br>
</body>
</html>