Wednesday 1 August 2012

How to create Custom Service Component in Oracle UCM 11g

1. Open Component Wizard from {domain_home}/ucm/cs/bin/ComponentWizard
2. Click on Add button will show up new popup window.
     a. Name the component "HelloWorld"
     b.Click Ok.
3. Click on Add on Resource Window
     a. Select Service & Click Next.
4. Give the service name "Hello_World".
     Class name - Give class path
     Template- MSG_PAGE

5. Click on ADD button
6. Click Ok.

7. Click On Finish.
8. Open Jdeveloper/ Eclipse framework Create Java class name "Custom Service"
package project1;
import intradoc.common.ServiceException;
import intradoc.common.SystemUtils;
import intradoc.data.DataException;
import intradoc.server.Service;
public class CustomService extends Service {


public void helloworld_sayHello()throws DataException,ServiceException{
SystemUtils.info("inside Method");
m_binder.putLocal("StatusMessage", "Hello World Sample ");
String statusmessage=m_binder.getLocal("StatusMessage");
SystemUtils.info("statusmessage:"+statusmessage);
}


}
 

a. Create folder structure at your custom component location & put java and Class file to appropriate location:
/ucm/cs/custom/HelloWorld/src/project1/CustomService.java
/ucm/cs/custom/HelloWorld/classes/project1/CustomService.class

9. Add class Path to {Custom_Component_Home}/HelloWorld.hda
 10. Open Component Wizard Click on "Enable" by selectin "HelloWorld" component.
 11. Restart the content server.
       Now hit the URL:http://localhost:16200/cs/idcplg?IdcService=HELLO_WORLD



16 comments:

  1. how to add a custom search template in oracle ucm 11g.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. please give more desc of error..
      Please refer "http://docs.oracle.com/cd/E21043_01/doc.1111/e10792/c03_security001.htm"
      This may help.

      Delete
    3. This comment has been removed by the author.

      Delete
    4. This comment has been removed by the author.

      Delete
  3. This comment has been removed by the author.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
  5. Getting a blank page with the html:

    No service defined for HELLO_WORLD.

    StatusCode=-1

    ReplyDelete
    Replies
    1. check custom service component is build correctly....
      http://docs.oracle.com/cd/E17904_01/doc.1111/e11011/c04_customizing_services.htm#i1084897
      Check the logs for detail information...

      Delete
  6. Thanks for getting back to me so soon.
    I rebuilt and now get the following error:
    Unable to execute service HELLO_WORLD and function helloworld_sayHello.
    The error was caused by an internally generated issue. The error has been logged.
    Log reads:
    Event generated by user 'sysadmin' at host 'localhost:16200'. Unable to execute service HELLO_WORLD and function helloworld_sayHello.
    The service method 'helloworld_sayHello' is not defined. [ Details ]

    An error has occurred. The stack trace below shows more information.

    !csUserEventMessage,sysadmin,localhost:16200!$!csServiceDataException,HELLO_WORLD,helloworld_sayHello!$!csMethodNotDefined,helloworld_sayHello
    intradoc.common.ServiceException:

    .....

    Caused by: intradoc.data.DataException: !csMethodNotDefined,helloworld_sayHello
    at intradoc.server.Service.doCodeEx(Service.java:631)
    at intradoc.server.Service.doCode(Service.java:575)
    at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1643)
    at intradoc.server.Service.doAction(Service.java:547)
    at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1458)
    at intradoc.server.Service.doActions(Service.java:543)
    ... 43 more

    ReplyDelete
  7. Working well with standard service "setLocalValues" so there is something in the compiling of the new service which I am building in JDeveloper.

    ReplyDelete
  8. Any clue as to what could be causing the following error?

    !csUserEventMessage,sysadmin,localhost:16200!$!csServiceDataException,HELLO_WORLD,helloworld_sayHello!$!csMethodNotDefined,helloworld_sayHello
    intradoc.common.ServiceException: !csServiceDataException,HELLO_WORLD,helloworld_sayHello!$
    *ScriptStack HELLO_WORLD
    3:helloworld_sayHello,**no captured values**

    ReplyDelete
  9. Where would I get the packages :
    import intradoc.common.ServiceException;
    import intradoc.common.SystemUtils;
    import intradoc.data.DataException;
    import intradoc.server.Service;

    Thanks,
    Yogita

    ReplyDelete