0

Within a Alfresco(4.1) Java based Webscript, I need to invoke another Alfresco Java based Webscript(/alfresco/service/customservice?abc...).

I don't prefer making a Apache HttpClient call as its a bad practice for many obvious reasons . I did come across remote.connect approach but I guess its for calling a JS based WS.

Appreciate your help.

Thanks, Somu

1 Answer 1

3

It would indeed be bad practice to make a call over the network when you are already in process. Extract the code you want to reuse. Make it independent of the network (webscripts). Make it a spring managed bean you inject in your Java code. In case you need to call it from JS, derive the (Spring bean) from baseJavaScriptExtension.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Andreas. The java based webscript that I want to invoke is inside a jar(that came with a plugin/addon). I dont have the source but will try for it. Given the jar file, do you have any suggestions on invoking/using the webscript?
Only (very ugly) hacks if you really have to call the webscript. Even if you don't have the source, I would not expect a lot of logic heavy in the webscript. Check whether there are other beans which you can (re-)use instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.