Expand my Community achievements bar.

SOLVED

Preview of content using jssp

Avatar

Level 3

I am attempting to build a jssp page for content preview to be used inside a webapp for content creation. The goal is to have an iframe show the transformed content, just as the preview shown in the client content editor.

I got this:

 

<%
logonEscalation("webapp");
response.setContentType("text/html;charset=utf-8");
var preview =[]
var contentId = 86800;
if(contentId>0){
  preview = ncm.publishing.TransformJavaScript("rbe:blockContent","HTML", 86800 )
}
document.write( preview[1]!=undefined ?  preview[1].toSource() : "No content found")
%>

 

And get error:

SOP-330011 Error while executing the method 'TransformJavaScript' of service 'ncm:publishing'.

Can anyone suggest what I should be doing?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello Jonas,

Are you able to preview these content in the console, via the publishing ?

 

Can you try to use the ncm.publishing.TransformFromId method ? In this case, you"ll have to give the ncm:publishing name (ns:name format) but also, the model name from the publishing (the one you gave in the Transformation models part, when you setup the type of tranformation (xsl or jst), the output format and then the XSL or JST to use) and for the third parameter, you have to give the content in a particular format : the content schema name (the one you created for your content, like 'ncm:content'), a pipe '|' and the id of the content.

It should be something like this :

<%
var content = ncm.publishing.TransformFromId('cus:myPublishing','HTML','cus:myContent|123456');
%>
<%==content[1]%>

 

This is what the console does when it displays preview from the content view.

 

Cédric

View solution in original post

7 Replies

Avatar

Correct answer by
Community Advisor

Hello Jonas,

Are you able to preview these content in the console, via the publishing ?

 

Can you try to use the ncm.publishing.TransformFromId method ? In this case, you"ll have to give the ncm:publishing name (ns:name format) but also, the model name from the publishing (the one you gave in the Transformation models part, when you setup the type of tranformation (xsl or jst), the output format and then the XSL or JST to use) and for the third parameter, you have to give the content in a particular format : the content schema name (the one you created for your content, like 'ncm:content'), a pipe '|' and the id of the content.

It should be something like this :

<%
var content = ncm.publishing.TransformFromId('cus:myPublishing','HTML','cus:myContent|123456');
%>
<%==content[1]%>

 

This is what the console does when it displays preview from the content view.

 

Cédric

Avatar

Level 3

Dear Cédric, thank you for you answer.

The template is working and I can preview the client content editor, as well as in a delivery.

 

Given the following datapoints:

content

id: 86530

schema Namespace: rbe

Scema Name: blockContent

 

publication model

name: rbe:blockContent

schema: rbe:blockContent

check satus before generating content: true

template name: HTML

rendering type: javascript

format: HTML

Javascript template: rbe:blockContent

DOM interface: false

 

the following jssp: 

 

 

<%
logonEscalation("webapp");
response.setContentType("text/html;charset=utf-8");
var content = ncm.publishing.TransformFromId('rbe:blockContent','HTML','rbe:blockContent|89480');
%>
<%==content[1]%>

 

 

gives error: XFR-180000 The file 'C:\Program Files\Adobe\Adobe Campaign Classic v7\datakit\eng\schema\.xml' does not exist on the server. Unable to load the document of identifier '' and type 'xtk:schema'. SOP-330011 Error while executing the method 'TransformFromId' of service 'ncm:publishing'.

 

Changing the first and second parameter results in a different error message refferning the publication model, so it comes down to the "|" format of the third parameter. I can not find any documentation of this format (but I have used similar format when duplicating content elsewhere), do you have any further input?

 

I know the logical explanation would be that the content-id is wrong, but that is why I have included the information above, and also tested several different just to be sure. Thank you for your kind help!

Avatar

Community Advisor

Hello Jonas,

I'm sorry, but when I check the same code is OK for me.

 

The only problem I had was the 'webapp' account were not allowed to use the method, but if I add the "content" right to the 'webapp' operator, it works.

 

First, you can check if the webapp has the 'content' right.

 

The error 'XFR-180000' you have only appears when I put a wrong schema in the third parameter (for example, I put 'rbe:bloContent|89480') but it shows the wrong name in the path "XFR-180000 The file '/usr/local/neolane/nl6/datakit/rbe/eng/schema/bloContent.xml' does not exist".

 

 

Also, I confirm the (undocumented...) format of the third parameter is "ns:schema|id" (tryied with id only and it failed with XFR-180000 error). To get this information, I caught how the console request the server via SOAP and saw that format (and I agree, there is very few documentation about it).

 

If you have access to a Windows Adobe Campaign Server version (be sure the build is the same of your console), you will find  "bin/tools/traceview.exe" program. This local tools allows you to see the request/response between your console and the server (you have to enable the trace by pressing SHIFT+F3 in the console, 'Traces ON/OFF' will swicth on the bottom bar).

Cedric

Avatar

Level 3

Thank you for confirmning. I tried to change the access group with same result. I also get the same error if I enter non existent schema name. I will try on another installation and see if i can repeat the error there. Thanks!

Avatar

Level 3

I added the right "Delivery operators" to the webapp user and now it works! Thank you Cédric for your help!

No, changing to logonEscalation("admin") works though....

Avatar

Community Advisor
You're welcome, glad to help you. Beware to not use admin account in production mode, and try to solve the problem using another (dedicated?) account than 'admin'. Cédric

Avatar

Community Advisor
Jonas, I just see that you try to add the "Delivery operators" (name=delivery) right to the "webapp" operator. This is not this one I added, but the one with technical @name="content" (don't know the english label sorry).