Tuesday, December 27, 2016

ADF BC REST 12.2.1.2 Custom Method JDeveloper Workaround

Some of you who would try to implement custom method with ADF BC REST may face JDeveloper 12.2.1.2 wizard issue. JDeveloper 12.2.1.2 wizard is refusing to register ADF BC REST custom method, but it works perfectly on ADF runtime. Seems to be JDeveloper 12.2.1.1 - 12.2.1.2 bug. There is a workaround to modify REST service configuration manually and include custom method binding.

Sample application (available on GitHub - jetcrud). This sample implements custom method in VO implementation class - testCall:


Method is exposed through client interface:


Now if you go to REST service definition and try to enable this method to be included into REST interface - JDeveloper will report error:


Something wrong happens in RSTCustomMethodTab class:


Workaround - add method call into REST service definition manually. I recommend to do it outside of JDeveloper, as it hangs. Change definition in external editor. This is the example for custom method entry:


a

If you take a look into JDeveloper wizard for REST definition, it still shows method unchecked. But you can ignore it:


To execute custom method through REST call, make sure to use POST and specify method name along with parameters in REST request body:


Make sure not to forget to provide action Content-Type:


Check section for more info - 22.13.5 Executing a Custom Action.

9 comments:

ahmad abuayyash said...

thanks very helpful , i was suffering of this for more than 2 week :-)

Andrejus Baranovskis said...

Very good, now you have solution :)

Andrejus

jaideep said...

Hi Can we implement the same in jdev 11g

Andrejus Baranovskis said...

No, ADF BC REST is available from 12c only.

Andrejus

Tan Nguyen said...

Hi Andrejus,
Thank you for this post.
Thought I have a question that is there any way to handle the exceptions in ADF BC REST supported by ADF?
Because I'm implementing the ADF BC REST service on views with custom methods and I want to handle the exceptions then return the response (with corresponding status) to client.
Do we have anyway to do that ? I've searched the solution but found nothing.

Thank you very much.

Andrejus Baranovskis said...

Probably you need to handle exception in ADF BC REST Java code and return error message text back to the service.

Regards,
Andrejus

Subramanian Meyyappan said...

Hi Andrejus,

Will above example work on JDEV Studio Edition Version 12.2.1.0.0?
Because, I'm getting error "JBO-27511: Error occurred due to invalid attribute being passed in input payload. Attribute: "name""
in postman.

Regards,
Subramanian

Andrejus Baranovskis said...

Yes, will work. Make sure you are passing correct Content-Type mentioned in my post.

Andrejus

Subramanian Meyyappan said...

Thanks! It works.