[ABUSE] By: h_john / Board: forum-ECM-software (16474)

cancel
Showing results for 
Search instead for 
Did you mean: 
h_john
Active Member

[ABUSE] By: h_john / Board: forum-ECM-software (16474)

Hello, why my post was marked as a spam. What I need to change to solve this problem?


Link to post: (Problem with processing POST JSON request)
by h_john


https://hub.alfresco.com/t5/alfresco-content-services-forum/problem-with-processing-post-json-reques...


<p>Hello.</p><p>I`m trying to make a webscript which will be able to:</p><p>1. receive json request;<br />2. get and transform argument from json request to java format;<br />3. find node in a specific folder using json argument as a search request;<br />4. get properties from found node;<br />5. transform found properties back to json string;<br />6. send answer in json;</p><p>Example of json request that I want to process&nbsp;</p><pre>$postData = array( 'didNumber' =&gt; '0443334000', 'srcNumber' =&gt; '0670219424', 'companyID' =&gt; '3041', 'requestType' =&gt; 'gettingCallSettings' );</pre><p>I`ve created next files after reading about json processing in Alfresco:</p><p>.get.desc.xml</p><pre>&lt;webscript&gt; &lt;shortname&gt;negotiate&lt;/shortname&gt; &lt;description&gt;negotiate JSON&lt;/description&gt; &lt;url&gt;/negotiate&lt;/url&gt; &lt;authentication&gt;guest&lt;/authentication&gt; &lt;negotiate accept="application/json"&gt;json&lt;/negotiate&gt; &lt;/webscript&gt;</pre><p>.get.json.ftl</p><pre>{"response": "myObjAsString"}</pre><p>.get.js</p><pre> var tel = json.get("srcNumber"); var node = search.luceneSearch("@cm\\:name:\"" + nodeName+ "\" AND PARENT:\"workspace://SpacesStore/61d28f13-24e0-434a-8b90-5ea54d2fafa2\""); var name = node.properties["zkz:Name"]; var myObj = {'name':'name'}; var myObjAsString = jsonUtils.toJSONString(myObj); model.myObjAsString = myObjAsString;</pre><p>But every time I try to execute my srcipt I receive something like this:</p><pre>{ "status" : { "code" : 500, "name" : "Internal Error", "description" : "An error inside the HTTP server which prevented it from fulfilling the request." }, "message" : "09220628 Cannot locate template processor for template org\/alfresco\/negotiate.get.json", "exception" : "org.springframework.extensions.webscripts.WebScriptException - 09220628 Cannot locate template processor for template org\/alfresco\/negotiate.get.json",</pre><p>or if I clean all data from&nbsp;.get.js I receive text from .ftl file.</p><p>In the end I need to send back something like this:</p><pre>die(json_encode(array( 'customerData' =&gt; array( 'name' =&gt; '1111111', 'description' =&gt; '11111111111', ) )));</pre><p>Please, can someone help me with js file? Can it be on Java or it must be in Json format?</p><p>&nbsp;</p>


This message has 0 replies