<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Calling an external web service from an Alfresco Web Script in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/calling-an-external-web-service-from-an-alfresco-web-script/m-p/217910#M171040</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Greetings all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am currently working on a project that will be made MUCH easier if I can figure out a way to call a REST web service from a web script in Alfresco.&amp;nbsp; It is my understanding that Alfresco web scripts are run in Rhino.&amp;nbsp; Rhino supports a few built in functions, such as readUrl, that would be ideal for my purposes.&amp;nbsp; I'm a bit new to running JavaScript in the Rhino environment, so I may be missing something obvious.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run my script via the Rhino console, it works as expected.&amp;nbsp; However, when I try to execute the same script in the Alfresco environment, I get the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;org.mozilla.javascript.EcmaError - ReferenceError: "readUrl" is not defined. (workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts/blah/blah/blah#linenumber)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With this failing, I went for the next obvious line of attack: using Rhino to load the java.net package and using the Java URL object to hit my service.&amp;nbsp; This too was a no-go, as the importPackage provided by Rhino led to the same ReferenceError shown above.&amp;nbsp; A little digging in the forums turned up this thread:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.alfresco.com/en/viewtopic.php?f=27&amp;amp;t=7134&amp;amp;hilit=rhino" rel="nofollow noopener noreferrer"&gt;http://forums.alfresco.com/en/viewtopic.php?f=27&amp;amp;t=7134&amp;amp;hilit=rhino&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The thread referenced above clearly shows why I couldn't load any Java packages/classes into my web scripts, this functionality is disabled for (very valid) security purposes.&amp;nbsp; However, the original poster's question, how to hit an external web service from a web script, was never really addressed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, my question:&amp;nbsp; What is the best way to hit a simple external RESTful web service from an Alfresco web script?&amp;nbsp; I only need support for GET operations, nothing fancy.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Aug 2009 20:09:47 GMT</pubDate>
    <dc:creator>nmcminn</dc:creator>
    <dc:date>2009-08-03T20:09:47Z</dc:date>
    <item>
      <title>Calling an external web service from an Alfresco Web Script</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/calling-an-external-web-service-from-an-alfresco-web-script/m-p/217910#M171040</link>
      <description>Greetings all,I am currently working on a project that will be made MUCH easier if I can figure out a way to call a REST web service from a web script in Alfresco.&amp;nbsp; It is my understanding that Alfresco web scripts are run in Rhino.&amp;nbsp; Rhino supports a few built in functions, such as readUrl, that woul</description>
      <pubDate>Mon, 03 Aug 2009 20:09:47 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/calling-an-external-web-service-from-an-alfresco-web-script/m-p/217910#M171040</guid>
      <dc:creator>nmcminn</dc:creator>
      <dc:date>2009-08-03T20:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an external web service from an Alfresco Web Script</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/calling-an-external-web-service-from-an-alfresco-web-script/m-p/217911#M171041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Nathan,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Did you manage to do this in the end? I am also looking to make use of external web services from an Alfresco webscript but am having difficulty finding any concrete examples of the best way to go about this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The forum post you link to gives a hint on the Alfresco sanctioned approach, namely:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The correct way to call Java from JavaScript is to create a Repository action class and then call that using the 'actions' object from JavaScript. Since only a server admin can add new JARs to the repo this is a safe route.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;…but doesn't really go into much more detail. Is anyone aware of any more detailed guidance on going down the Repository action class route for accessing external web services (wiki examples maybe)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Dec 2009 11:15:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/calling-an-external-web-service-from-an-alfresco-web-script/m-p/217911#M171041</guid>
      <dc:creator>chrisb</dc:creator>
      <dc:date>2009-12-15T11:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an external web service from an Alfresco Web Script</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/calling-an-external-web-service-from-an-alfresco-web-script/m-p/217912#M171042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Nathan,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you're using Alfresco webscripts, you should be able to use a remote connector to call into an external service.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There's a good example of how to build a dashlet here that calls into a Yahoo service to retrieve weather information, parses the data using E4X in JS, and then displays it in Share.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://drquyong.com/myblog/?p=28" rel="nofollow noopener noreferrer"&gt;http://drquyong.com/myblog/?p=28&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is that the kind of thing you're looking for?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dick Weisinger&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Dec 2009 21:54:53 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/calling-an-external-web-service-from-an-alfresco-web-script/m-p/217912#M171042</guid>
      <dc:creator>weisinger</dc:creator>
      <dc:date>2009-12-15T21:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an external web service from an Alfresco Web Script</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/calling-an-external-web-service-from-an-alfresco-web-script/m-p/217913#M171043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thats a good link - thanks for sharing it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you know if that approach using the "remote" connector works for webscripts running outside of the share environment (i.e. as part of the main Alfresco repo install)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Dec 2009 08:54:39 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/calling-an-external-web-service-from-an-alfresco-web-script/m-p/217913#M171043</guid>
      <dc:creator>chrisb</dc:creator>
      <dc:date>2009-12-16T08:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an external web service from an Alfresco Web Script</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/calling-an-external-web-service-from-an-alfresco-web-script/m-p/217914#M171044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Chris,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"remote" is a root-scoped object in the Surf Javascript API.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't think that it is available for use from the Alfresco explorer client.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To access the alfresco repository from share/surf, you can connect using "alfresco" instead of "http".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://wiki.alfresco.com/wiki/Surf_Platform_-_Freemarker_Template_and_JavaScript_API" rel="nofollow noopener noreferrer"&gt;http://wiki.alfresco.com/wiki/Surf_Platform_-_Freemarker_Template_and_JavaScript_API&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dick Weisinger&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Dec 2009 20:55:56 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/calling-an-external-web-service-from-an-alfresco-web-script/m-p/217914#M171044</guid>
      <dc:creator>weisinger</dc:creator>
      <dc:date>2009-12-16T20:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an external web service from an Alfresco Web Script</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/calling-an-external-web-service-from-an-alfresco-web-script/m-p/217915#M171045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dick,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for clarifying that. Looks like I'll need to go down the Repository action class route.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Dec 2009 10:34:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/calling-an-external-web-service-from-an-alfresco-web-script/m-p/217915#M171045</guid>
      <dc:creator>chrisb</dc:creator>
      <dc:date>2009-12-17T10:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an external web service from an Alfresco Web Script</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/calling-an-external-web-service-from-an-alfresco-web-script/m-p/217916#M171046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;and what about when the web service requires authentication?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;is there any way to authenticate the user with connectors object?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Feb 2010 15:59:20 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/calling-an-external-web-service-from-an-alfresco-web-script/m-p/217916#M171046</guid>
      <dc:creator>a_evagelopoulos</dc:creator>
      <dc:date>2010-02-10T15:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: Calling an external web service from an Alfresco Web Script</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/calling-an-external-web-service-from-an-alfresco-web-script/m-p/217917#M171047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi guys,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if someone is already interested, here &lt;/SPAN&gt;&lt;A href="http://forums.alfresco.com/en/viewtopic.php?f=36&amp;amp;t=27962#p101418" rel="nofollow noopener noreferrer"&gt;http://forums.alfresco.com/en/viewtopic.php?f=36&amp;amp;t=27962#p101418&lt;/A&gt;&lt;SPAN&gt; there is a solution on how to expose the remote object in the web client webscript api.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;About authentication i have added the alf_ticket parameter to remote call.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Oct 2010 09:24:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/calling-an-external-web-service-from-an-alfresco-web-script/m-p/217917#M171047</guid>
      <dc:creator>dc_noze</dc:creator>
      <dc:date>2010-10-12T09:24:01Z</dc:date>
    </item>
  </channel>
</rss>

