Friday, 10 June 2016

ATG 11.2 Rest MVC API Configuration, example of using it in profile module using Advance Rest Client Application

In general, a REST Web Services exposes data and function resources through the use of Uniform Resource Identifiers (URI). HTTP methods are used by the REST services to point to a resource like Form Handler, Droplet, Components, Methods, JSP etc.
Rest API makes the application client platform independent and mobile development ready as REST clients may be accesses from any browser, and security can be configured for each call.

ATG Rest MVC support GET and only POST method although Legacy REST Support PUT and DELETE but in ATG 11.2 it recommended to use only ATG REST Web Services.

Installing and Configuring the REST MVC
                Installation of the REST MVC module can be done using Oracle Commerce Platform Configuration and Installation Manager (CIM) or CRS mobile store selection while installing CRS 11.2 will install this folder.
Below a Screen Shot from CIM


After Installation you can check ATG REST Module in your ATG installation folder


In your Base module add REST on ATG-Required in MANIFEST file


When you build your ear you should find atg-rest-web1.0.war as below


Enabling REST Services
For security reasons, when you install the REST MVC module, none of the REST services are enabled. To enable a service, you should follow below steps.

1.       Disable enforceSessionConfirmation in atg/dynamo/service/actor/Configuration.propertes. This is require to enable the development mode.



You can find this file inside your atg 11.2 installation.


Second important file is ActorChainRestRegistry.properties. We can call only registered service in this file


You can find this file in your ATG 11.2 installation folder


Third important file is beanFilteringConfiguration.xml which used to map and render your output.


We can find this file in ATG 11.2 folder a below.


Lets now add Profile Actor to enable basic functionality of Login, Logout, Create, Edit

Add the ProfileActor.properties to your working codebase to enable future customization.


You can find this file at


Add the profileActor.xml in to your working codebase for future customization. Like repositories the xml append should work but I did not tested yet.


You can find in your Installation folder as below


Configure your ProfileFormHandler.properties as per your requirement




How it work and example    
Through Advance Rest Client (ARC) extension you send XML or JSON to the profile Actor it actually call the profile form handler’s handle methods and send result success URL or errors and Error URL.


Example
Lets log in using the rest API



Tuesday, 7 June 2016

Weblogic Server Production to Development Mode and Debug configuration with Eclipse

·         Checking your weblogic server mode:

When the server is running in production mode than you should be missing security folder in the location. It contains the weblogic server username and password (boot.properties) file and because this file is missing whenever you start the server it asks you to enter username and password for weblogic.


C:\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain\servers\AdminServer\security


·         Usually the content of the file are encrypted as below


·         To convert your server to development mode follow the below steps.
·         Start you admin server and access the admin console


·         Go to base domain from left menu and click Lock and Edit and in general tab unchecked Production Mode, save than Activate Changes from top left menu.


·         Create the security folder and create the boot.properties file inside all your servers (admin and Managed Server). In password and username field you can write your server password and username in plain text. On the server start it will be encrypted.


·         Now when you start your server it should not ask for username and password.
·         Now configure Debug mode with eclipse. To do that follow the below steps.
·         First thing to do, is to enable Debugging with Oracle Weblogic Server. Look out for the startWeblogic.cmd.


·         Add below lines at the beginning of the file. Here I am selecting port 4000, you can give your own port no.
Windows:
set JAVA_OPTIONS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n

Linux:
      JAVA_OPTIONS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=4000,server


        The –Xdebug parameter enables debugging . The –Xnoagent parameter disables the default sun.tools.debug agent. The –Xrunjdwp parameter loads the JPDA reference implementation of JDWP.

·         After this start the Weblogic Server using startWebLogic.cmd or sh script.
·         Now configure the remote Debug in the eclipse debug mode.


·         And you are done J

  SyntaxError : (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape Solution:...