Announcement Announcement Module
Collapse
No announcement yet.
Is anyone able to define a remote endpoint in Share and Surf? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is anyone able to define a remote endpoint in Share and Surf?

    Hi every,

    According to the new Wrox Alfresco book (pp. 306 - 309), the proper way of defining a remote end-point in Alfresco is to define <authenticator />, <connector />, and <endpoint /> elements and invoke them using the Webscript 'remote' object.

    For instance, if I define the following connector objects in a configuration file:

    Code:
    	<config evaluator="string-compare" condition="Remote">
    		<remote>
    			<authenticator>
    				<id>proof-of-concept-authenticator</id>
    				<name>Proof-of-Concept Authenticator</name>
    				<description>Proof-of-Concept Authenticator</description>
    				<class>org.alfresco.connector.AlfrescoAuthenticator</class>
    			</authenticator>
    			<connector>
    				<id>proof-of-concept-connector</id>
    				<name>Proof-of-Concept Connector</name>
    				<description>Proof-of-Concept Connector</description>
    				<class>org.alfresco.connector.AlfrescoConnector</class>
    				<authenticator-id>proof-of-concept-authenticator</authenticator-id>
    			</connector>
    			<endpoint>
    				<id>proof-of-concept-endpoint</id>
    				<name>Proof-of-Concept Endpoint</name>
    				<description>Proof-of-Concept Endpoint</description>
    				<connector-id>proof-of-concept-connector</connector-id>
    				<endpoint-url>http://localhost:8080/alfresco/service</endpoint-url>
    				<identity>user</identity>
    			</endpoint>
    		</remote>
    	</config>
    I should be able to connect to the defined endpoint using the following script:

    Code:
    var connector = remote.connect("proof-of-concept-endpoint");
    model.result = connector.get("/path/to/a/remote/service");
    The default authenticators, connectors, and endpoints are defined in the 'spring-webscripts-config.xml' file of the 'spring0webscripts' project of the Spring Surf SDK.

    Problem is, the book never tells where this configuration is supposed to be placed -- especially if you're trying to add end-points to a Share application. If you take a look at '/share/WEB-INF/classes/alfresco/slingshot-application-context.xml', it appears as though endpoints are to be added to one of the following three locations:

    Code:
    <value>classpath:org/springframework/extensions/webscripts/spring-webscripts-config.xml</value>
    <value>classpath:META-INF/spring-webscripts-config-custom.xml</value>
    <value>jar:*!/META-INF/spring-webscripts-config-custom.xml</value>
    If I define my endpoints in a local copy of:

    Code:
    <value>classpath:org/springframework/extensions/webscripts/spring-webscripts-config.xml</value>
    my endpoints are read, but the default endpoints defined in the Spring Surf 'spring-webscripts' project are not. Clearly, I shouldn't be overriding these settings.

    However, if I define my endpoints in:

    Code:
    <value>classpath:META-INF/spring-webscripts-config-custom.xml</value>
    they don't seem to be picked up. In fact, the script doesn't seem to be processed at all, for if I deliberately introduce a syntax error into the XML file (in my case by adding a dangling '<' to the middle of the file), Share starts up just fine and does not choke on the error. And further, if I stop the Javascript Debugger on the script trying to open the endpoint and watch the following expression:

    Code:
    remote.allEndpoints
    I learn that my endpoint is not known to my application.

    Anyone have an idea on how to do this?

    Darryl

  • #2
    Hi darryl_staflund,

    I create a endpoint in a spring surf application, not for an alfresco connection, just for a custom webservice provider but i think it should works the same.
    I put the configuration of the endpoint, in the surf.xml file on the WEB-INF folder of my surf application. i hope this helps

    Comment


    • #3
      Hi Arkhantos,

      I saw your post on defining the end-point in surf.xml but couldn't get it working. Maybe I configured it wrong?

      In any event, I just got back from the Alfresco technical meetup in New York City and got a chance to ask Michael Farman the question directly. He showed that the endpoints are to be defined in spring-webscripts-config-custom.xml inside of:

      Code:
      /<tomcat_home>/shared/classes/alfresco/web-extension
      I will give it a shot and let you know if it works.

      Darryl

      Comment


      • #4
        Hi again,

        It works, although the config file is called webscript-framework-config-custom.xml instead of webscript-config-custom.xml. There is a sample configuration file in the Alfresco 3.3 Community edition.

        I will have to play around with this some more to see if I can place the file somewhere in:

        Code:
        /<tomcat_home>/webapps/<surf_app>/WEB-INF/**/*
        instead of:

        Code:
        <tomcat_home>/shared/classes/alfresco/web-extension
        It would seem that I should be able to do this in cases where I want to deploy my Surf app to a different Tomcat instance than the one hosting Alfresco.

        Darryl

        Comment


        • #5
          Sorry I don't have any idea hope someone else will help you........




          macbook pro cases

          Comment

          Working...
          X