cancel
Showing results for 
Search instead for 
Did you mean: 

sessionticket.ticket

patrikx3
Champ in-the-making
Champ in-the-making
Hello,

I cannot use the session ticket.
<strong>I have this template:</strong>
${sessionticket.ticket}

It is Alfresco 5.1.

It should give a ticket.

<strong>But this is the error:</strong>
Alfresco   Web Script Status 500 - Internal Error

The Web Script /alfresco/service/i18n has responded with a status of 500 - Internal Error.

500 Description:   An error inside the HTTP server which prevented it from fulfilling the request.

Message:   05280009 Wrapped Exception (with status template): 05280010 Error during processing of the template 'get(ticket) failed on instance of org.alfresco.repo.template.Session. See cause exception. The failing instruction: ==> ${sessionticket.ticket} [in template "i18n.get.html.ftl" at line 3, column 1]'. Please contact your system administrator.
Server:   Community v5.1.0 (r127059-b7) schema 10 001
Time:   2016.06.28. 11:21:56

Diagnostics:   Inspect Web Script (i18n.get)
10 REPLIES 10

steven_okennedy
Star Contributor
Star Contributor
Hi

What are your authentication settings on your webscript? Can you post the full content of your webscript (including the descriptor file).  If you call the webscript through a browser are you prompted for a username/password before it gives this failure?

Can you also include any changes you've made to your authentication chain or authentication subsystems e.g. global properties file etc?

Regards

Steven

<strong>i18n.get.desc.xml:</strong>
<br/>
< webscript><br/>
  < shortname>I18n Sample< /shortname><br/>
  < description>Internationalization Sample< /description><br/>
  < url>/i18n< /url><br/>
< /webscript><br/>

<strong>i18n.get.html.ftl:</strong>
${sessionticket.ticket}

<strong>The DOC I need:</strong>
http://docs.alfresco.com/5.1/references/API-JS-SessionTicket.html

steven_okennedy
Star Contributor
Star Contributor
Hi

Try specifying that you need the script to require a user to authenticate.  The sessionticket.ticket object returns a ticket for the currently authenticated user, and will throw an error if there is no authenticated user.

<webscript>
  <shortname>I18n Sample</shortname>
  <description>Internationalization Sample</description>
  <url>/i18n</url>
  <authentication>user</authentication>
</webscript>


Regards

Steven

Hello, I created a ZIP. It has all the info.
It should have the ${sessionticket.ticket} as the reference shows, but it show the error that is in the ZIP.

steven_okennedy
Star Contributor
Star Contributor
You are trying to use repository root objects in a presentation tier webscript.

Alfresco has two applications, both of which use webscripts.  the alfresco.war application (repository tier) provides the repository access and associated services, while Share (presentation tier), a Surf-based application, handles just UI activities and doesn't have access to core Alfresco information without making a call to the repository to get it.

While they both provide the ability to use webscripts, the root objects and services available to use from them are different.  This page describes the objects available on the repository tier (http://docs.alfresco.com/5.1/references/API-FreeMarker-intro.html) while this one gives the ones available in presentation tier webscripts (http://docs.alfresco.com/5.1/references/APISurf-rootscoped.html)

Regards

Steven

Hello!
I understand! But now I need authorization for my alfresco.war service.
How can I call an alfrsco.war service fom the share.war?
Like I have a .ftl in share.ware.
I have a alfresco/services/component/method in alfresco.war.

How can I call the ftl use the service with authorization?

patrikx3
Champ in-the-making
Champ in-the-making
I could use the alf_ticket, but in the Share roots I cannot get the ticket.
How can I use from share using an alfresco service?

steven_okennedy
Star Contributor
Star Contributor
When you log in via Share, Share isn't actually handling the authentication, it's delegating that back to Alfresco.  So when you login via Share, you'll also have a session in Alfresco.  To call a alfresco service from Share you would normally use HTTP, which means using an Alfresco RESTful or CMIS service.  The Share configuration provides you the ability to do this (handling all the authentication particulars for you - that's one of the key advantages of a Surf application like Share) using the remote root scoped object. So you could write something like remote.call("/api/sites/" + page.url.templateArgs.site) to get information on a specific site.

Remember the ftl file is the "View" component of the webscript so ideally, all you should be doing within an ftl file is presentation of data in the webscripts Model.  You should doing things like collecting, assembling & manipulating data (e.g. doing a remote call to Alfresco) in your webscript controller (the .js file).  To the best of my knowledge the "remote" root object is only available to controller in any case.

If the service you want to call is not exposed via any existing public API endpoint, then you can create a repository webscript that does what you need it to, and then call that from your Share webscript.  This is the standard mechanism for this type of work.

Regards

Steven

<strong>My problem is that i have a service in alfresco:</strong>
/alfresco/service/clickandlike/converjsprebin

<strong>My share scripts:</strong>
footer.get.html.ftl

<strong>The problem is that I have to give a ConvereJs a url only:</strong>

   converse.initialize({
        //debug: true,
        bosh_service_url: '//' location.hostname
+ ':5280/http-bind/', // Please use this connection manager only for testing purposes
        i18n: locales['${locale}'], // Refer to ./locale/locales.js to see which locales are supported
       allow_logout: false,
       allow_registration: false,
       auto_login: true,
       keepalive: true,
       authentication: 'prebind',
        allow_muc: false,
        auto_subscribe: true,
        auto_join_on_invite: true,
        roster_groups: true,
        //show_only_online_users: true,       
        allow_contact_removal: false,
        allow_contact_requests: false,
        allow_chat_pending_contacts: true,
        //auto_subscribe: true
        jid: '${user.id}',
        prebind_url: '/alfresco/service/clickandlike/conversejsprebind?username=${user.id}'
    });

How can I make it work using authentication without remote.call?
I think ConverseJs was using $.ajax.
<strong>That why I was trying use the session ticket, like /alfresco/service/clickandlike/conversejsprebin?alt_ticket=TICKET_23423423</strong>

But I don't know what I can do.

Can you help please?
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.