cancel
Showing results for 
Search instead for 
Did you mean: 

Remote API e chiamate esterne

alnitakzeta
Champ in-the-making
Champ in-the-making
Ciao a tutti,

devo creare uno script che mi permetta di fare delle chiamate ad un servizio esterno. Cosa ho fatto:

1) nello share-config-custom.xml ho inserito un nuovo endpoit per il servizio esterno

       <endpoint>
            <id>ext-service</id>
            <name>External Service</name>
            <description>Servizio esterno</description>
            <connector-id>http</connector-id>
            <endpoint-url>http://server-ext:8080</endpoint-url>
         </endpoint>

2) ho creato uno script "test.js" che dovrebbe chiamare un servizio esterno ed ho utilizzato il seguente codice:

var userName = "test";
var message = "Test";
try {
   
   


   
   var parameterNotify = "message=" + message  +"  "&username=" + userName;
   
   connector = remote.connect("exty-service");
   connector.get("/service&" + parameterNotify );

   
}catch(ex){

   error = String(ex);
   


3) Ho associato questo scritp ad una regola di contenuto.


Quando viene eseguito lo scritp  mi ritorna un eccezzione:

11:15:47,766 User:admin ERROR [repo.transaction.AlfrescoTransactionSupport] After completion (committed) listener exception:
   listener: org.alfresco.repo.action.ActionTransactionListener@36831481
java.lang.NullPointerException
        at org.alfresco.repo.action.CreateThumbnailActionFilter.compare(CreateThumbnailActionFilter.java:38)
        at org.alfresco.repo.action.CreateThumbnailActionFilter.compare(CreateThumbnailActionFilter.java:30)
        at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl.executeAction(AsynchronousActionExecutionQueueImpl.java:275)
        at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl.executeAction(AsynchronousActionExecutionQueueImpl.java:214)
        at org.alfresco.repo.action.ActionServiceImpl.queueAction(ActionServiceImpl.java:569)
        at org.alfresco.repo.action.ActionServiceImpl.postCommit(ActionServiceImpl.java:556)
        at org.alfresco.repo.action.ActionTransactionListener.afterCommit(ActionTransactionListener.java:77)
        at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.afterCompletion(AlfrescoTransactionSupport.java:802)
        at org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCompletion(TransactionSynchronizationUtils.java:168)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.invokeAfterCompletion(AbstractPlatformTransactionManager.java:996)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerAfterCompletion(AbstractPlatformTransactionManager.java:971)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:799)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:394)
        at org.alfresco.util.transaction.SpringAwareUserTransaction.commit(SpringAwareUserTransaction.java:472)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:403)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:436)
        at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:466)
        at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:304)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)
        at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:58)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)


Qualcuno sa indicarmi dove sbaglio?
15 REPLIES 15

alnitakzeta
Champ in-the-making
Champ in-the-making
Devo semplicemente chiamare in get un url esterno.

poi quello che mi ritorna non me ne frega, devo solo chiamarlo passando dei parametri in get.

marcomanzi
Champ in-the-making
Champ in-the-making
Beh se è l'unico modo che hai prova a vedere se questo link ti aiuta http://www.unorganizedmachines.com/site/software-and-technology/34-software-development/97-calling-w...
in teoria è proprio ciò che devi fare.

alnitakzeta
Champ in-the-making
Champ in-the-making
Ho seguito tutti i passaggi…

Creo lo script lo inserisco in un Rules e poi provo.. Ma niente neanche un errore. Ma la chiamata non la fa.

Ho provato a mettere un log ma non scrive neanche…  :shock:  :shock:  :shock:  :shock:

abarisone
Star Contributor
Star Contributor
Ciao,
prova a vedere se questo post ti puo' dare uno spunto su cui lavorare https://forums.alfresco.com/en/viewtopic.php?f=53&t=38576

Saluti,
Andrea

alnitakzeta
Champ in-the-making
Champ in-the-making
Ciao ho visto il link,

in pratica devo creare un service in alfresco??

ma quei bean in quali file vanno inseriti?????

Ma praticamente è un JAR esterno da inserire in alfresco????

alnitakzeta
Champ in-the-making
Champ in-the-making
Ho risolto.

Creata una classe che utilizza un HttpClient Java che poi ho mappato nello script-services-context.xml

Questa classe può essere utilizzata dal qualsiasi script e wb-script.
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.