cancel
Showing results for 
Search instead for 
Did you mean: 

Creation of new share site susing 'create-site'

orichaud
Champ in-the-making
Champ in-the-making
Hi,

I'm trying to programmatically create a new Alfresco Share site using calls to REST services.

I have initially tried to simply call the ALfresco REST API (not the Share API) but I rapidly discovered that although the site is created, a second step was necessary to get an active site (the documentLibray was missing and not created, preventing any content upload).

I found that the create-site Share script is doing the job, which is to first call the Alfresco REST service and then perform the second step to activate the site.
Naturally, and as recommended by some posts on this forum, the create-site webscript sounds to be the best candidate.

However, my problem is that although I can authenticate against the Alfresco login service and obtain a ticket, perform calls against any Alfresco service, when dealing with Share rest services, I get a HTTP 500 error:

HTTP Status 500 -  Exception report
The server encountered an internal error () that prevented it from fulfilling this request.

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:659)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:195)
    org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:159)
    org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
    org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
    org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:417)

Root cause:
java.lang.NullPointerException
    org.apache.catalina.util.CharsetMapper.getCharset(CharsetMapper.java:106)
    org.apache.catalina.connector.Response.setLocale(Response.java:851)
    org.apache.catalina.connector.ResponseFacade.setLocale(ResponseFacade.java:323)
    javax.servlet.ServletResponseWrapper.setLocale(ServletResponseWrapper.java:201)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1035)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:798)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:195)
    org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:159)
    org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
    org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
    org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:417)

Clearly, I don't understand what the difference between Share and Alfresco is.
Is there a different / additional login scenario that I misses.

Thanks for your help

Olivier
4 REPLIES 4

jpotts
World-Class Innovator
World-Class Innovator
Part of the problem is that Share expects different headers in its REST requests than the repository tier. Something like this will work:

curl "http://localhost:8081/share/service/someWebScript" –header "Accept-Charset:ISO-8859-1,utf-8" –header "Accept-Language:en"

But what I'm still trying to figure out is the authentication piece with Share web scripts. When you pass in username/password or tickets to a Share web script, when it makes remote connections back to the repository tier, it does so as Guest. Not sure what's up with that.

Jeff

erikwinlof
Confirmed Champ
Confirmed Champ
Hi,

Would you mind send the code you are executing and describe from where you're executing it.

Cheers,

:: Erik

barbara
Champ in-the-making
Champ in-the-making
Hi,

did you manage to solve this? I am having the same problem…

joemc3
Champ in-the-making
Champ in-the-making
I recently had the same problem.  I posted my solution here:

https://forums.alfresco.com/en/viewtopic.php?f=48&t=46259&p=138469#p138469
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.