Wednesday, September 2, 2015

ADF Service Interface SOAP Webservice Namespace Change

We can create Service Interface from ADF BC Application Module. When we are creating the Service Interfaces, service is taking default  namespaces. This is changing sometimes, when any server restart or new deployment happens. Due to this issue, webservice fails in mobile application.

Please add the below files the directory where “AppModuleService.java” resides.

hander-chain.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
   <handler-chain>
      <handler>
         <handler-name>SOAPBodyHandler</handler-name>
         <handler-class>com.abc.SOAPBodyHandler</handler-class>
      </handler>
   </handler-chain>
</handler-chains>

SOAPBodyHandler.java

package com.abc;

import java.util.Iterator;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.soap.SOAPHandler;
import javax.xml.ws.handler.soap.SOAPMessageContext;


public class SOAPBodyHandler implements SOAPHandler<SOAPMessageContext>
{
    static final String DESIRED_NS_PREFIX = "custname";
    static final String DESIRED_NS_URI = " /abc/mobile/si/model/common/types/";
    static final String UNWANTED_NS_PREFIX = "ns3";
   
    public SOAPBodyHandler() {
        super();
    }
    @Override
    public Set<QName> getHeaders() {
        return null;
    }
    @Override
    public boolean handleMessage(SOAPMessageContext context) {
        if ((Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)) { //Check here that the message being intercepted is an outbound message from your service, otherwise ignore.
                try {   
                  SOAPEnvelope envelope = context.getMessage().getSOAPPart().getEnvelope();
                    SOAPBody body = envelope.getBody();
                    Iterator iter = body.getChildElements();
                    while (iter.hasNext()) {
                        Object object = iter.next();
                        if (object instanceof SOAPElement) {
                            SOAPElement element = (SOAPElement) object;
                            element.removeNamespaceDeclaration(element.getPrefix());
                            element.setPrefix("custname");
                        }
                    }
                   
                } catch (SOAPException ex) {
                    Logger.getLogger(SOAPBodyHandler.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            return true; //indicates to the context to proceed with (normal)message processing
    }
    @Override
    public boolean handleFault(SOAPMessageContext context) {
        return false;
    }
    @Override
    public void close(javax.xml.ws.handler.MessageContext context) {
    }
}

If you want to change the namespace in multiple levels, please iterate the element and change it.

Sample Code given below.

if (object instanceof SOAPElement) {
                            SOAPElement element = (SOAPElement) object;
                            element.removeNamespaceDeclaration(element.getPrefix());
                            element.setPrefix("custname ");
                                Iterator a =element.getChildElements();
                            while(a.hasNext()) {
                                SOAPElement element1=(SOAPElement)a.next();
                                element1.removeNamespaceDeclaration(element1.getPrefix());
                                element1.setPrefix("custname ");
                                Iterator b =element1.getChildElements();
                                while(b.hasNext()) {
                                    SOAPElement element2=(SOAPElement)b.next();
                                    element2.removeNamespaceDeclaration(element1.getPrefix());
                                    element2.setPrefix("custname");
                                }
                            }
                        }

Please change the package names accordingly based on your project package for AppModuleService.java.

Please add the below lines in your webservice project class’s annotation.

@HandlerChain(name = "SOAPBodyHandler",file="handler-chain.xml")

Example:-

import javax.jws.HandlerChain;

@HandlerChain(name = "SOAPBodyHandler",file="handler-chain.xml")
Public class AppModuleService
{


Deploy the application and execute the webservices and you can see the changes. This is mainly happening when we are creating SOAP services for mobile (Titanium Applications) and Android device, need the complete namespace of response tags.

ADF SOAP Webservices Namespace change

We can see that the webservices created in ADF, is changing the response namespaces frequently when there are some new deployment happens. To avoid this particular issue, please follow the below workarounds in the ADF SOAP Webservice project.

Scenario 1:- Wrapper Webservice.

If we are creating wrapper webservice in ADF based on webservice proxy, please go to the proxy classes and locate “package-info.java”.

We can see the below line in the java class.

@javax.xml.bind.annotation.XmlSchema(namespace = "http://abc.com", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)

We can change the line to below lines for setting the static namespace name.

@javax.xml.bind.annotation.XmlSchema(namespace = "http:// abc.com ", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED,xmlns = {
@XmlNs(prefix = "customname", namespaceURI = "http:// abc.com ")})

This will change the response body tag with “customname” namespace.
Also we need to follow the below steps to change the parent nodes namespace.
Please add the below files the directory where you are creating the wrapper webservice.

hander-chain.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<handler-chains xmlns="http://java.sun.com/xml/ns/javaee">
   <handler-chain>
      <handler>
         <handler-name>SOAPBodyHandler</handler-name>
         <handler-class>com.abc.SOAPBodyHandler</handler-class>
      </handler>
   </handler-chain>
</handler-chains>

SOAPBodyHandler.java

package com.abc;

import java.util.Iterator;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.soap.SOAPHandler;
import javax.xml.ws.handler.soap.SOAPMessageContext;


public class SOAPBodyHandler implements SOAPHandler<SOAPMessageContext>
{
    static final String DESIRED_NS_PREFIX = "custname";
    static final String DESIRED_NS_URI = "http:// com.abc /";
    static final String UNWANTED_NS_PREFIX = "ns3";
   
    public SOAPBodyHandler() {
        super();
    }
    @Override
    public Set<QName> getHeaders() {
        return null;
    }
    @Override
    public boolean handleMessage(SOAPMessageContext context) {
        if ((Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)) { //Check here that the message being intercepted is an outbound message from your service, otherwise ignore.
                try {   
                  SOAPEnvelope envelope = context.getMessage().getSOAPPart().getEnvelope();
                    SOAPBody body = envelope.getBody();
                    Iterator iter = body.getChildElements();
                    while (iter.hasNext()) {
                        Object object = iter.next();
                        if (object instanceof SOAPElement) {
                            SOAPElement element = (SOAPElement) object;
                            element.removeNamespaceDeclaration(element.getPrefix());
                            element.setPrefix("custname");
                        }
                    }
                   
                } catch (SOAPException ex) {
                    Logger.getLogger(SOAPBodyHandler.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            return true; //indicates to the context to proceed with (normal)message processing
    }
    @Override
    public boolean handleFault(SOAPMessageContext context) {
        return false;
    }
    @Override
    public void close(javax.xml.ws.handler.MessageContext context) {
    }
}

Please change the package names accordingly based on your project package.

Please add the below lines in your webservice project class’s annotation.

@HandlerChain(name = "SOAPBodyHandler",file="handler-chain.xml")

Example:-

import javax.jws.HandlerChain;

@HandlerChain(name = "SOAPBodyHandler",file="handler-chain.xml")
Public class MyClass
{


Deploy the application and execute the webservices and you can see the changes. This is mainly happening when we are creating SOAP services for mobile  (Titanium Applications) and Android device, need the complete namespace of response tags.

Wednesday, July 22, 2015

VBox Images with Same IP

This is happening because of same Mac Address that both the VBox images are using. When both the images are connected to the network, both are using one IP and thus all the request will be sent to one machine.
I have tried to refresh the MAC address of all three network adaptors (Bridged Adaptor, NAT, Host Only Adaptor) and restarted the VBox Image. But, unfortunately it stopped connecting to network and showing only loop back address for ifconfig command.
I have tried to start the network and got the below error,

a.      /etc/init.d/network restart
b.      Got the exception as “Bringing up interface eth0: Device eth0 does not seem to be present, delaying initialization” [FAILED}

After a lot of trial and error, I managed to sort out the issue and I have tested in two VBox images and it is working fine.
To avoid this issue, we need to follow the below steps.
1.       If you are connected with Bridged Adapter, NAT and Host-Only Adapter etc., please disable all the network adaptors except Bridged Adaptor.
VBox Image should be shutdown to do this à Settings àNetwork.
2.       Click on ‘Advanced’ in the Adaptor-0 (Bridged Adaptor) and click on the refresh button of MAC address. Note down this MAC Address in a note pad.
3.      Start the VM and login with root user.
4.      Remove the /etc/udev/rules.d/70-persistent-net.rules
a.      cd /etc/udev/rules.d/
b.      rm -rf 70-persistent-net.rules
5.      Manuall
a.      cd /etc/sysconfig/network-scripts/
b.      vi
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet
HWADDR=08:00:27:bf:30:a7
USERCTL=no
PEERDNS=yes
IPV6INIT=no
c.       Change the HWADDR to the new One
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet
HWADDR=08:00:27:bf:94:a6
USERCTL=no
PEERDNS=yes
IPV6INIT=no
6.      Shutdown the VBox Image
a.      shutdown –h now
7.      Restart the Machine
8.      Start the VBox image with root user
9.      Check the IP address
a.      ifconfig
b.      We can see the eth0 are initiated and IPs are assigned.


Wednesday, July 15, 2015

Webcenter Content (UCM) Integration with Oracle BPM


We can integrate Oracle Webcenter Content into Oracle SOA Server for integrating the document services with BPM Human Tasks.

As a first step we need to enable “Use Document Package” in the Human Task Configuration window in the JDeveloper.

1.       Open JDeveloper and open the BPM application.
2.       Go to the “BPM Project Navigator” à<BPM Application>àBusiness Catalog àHuman Tasks, and double click on the Human Task.
3.      In the configuration pane, select the vertical tab “Documents”
4.      Select the check box –“Use Document Package” and it will display the two more options below to it
a.      Security Group – Editable
b.      Document Type – Editable

Once we add this configuration, Human Task is able to communicate with WebCenter Content (UCM). But, we need to configure WebCenter Content in the SOA/BPM server through EM console.

1.       Open em console (http://<soa-host-name>:<port>/em) Eg: http://soa:7001/em
2.       Login with WebLogic credentials.
3.      Click on the Farm_<domain> tree structure in the left pane and it will show the option ”SOA”
4.      Expand SOA folder and click on soa-infra link and we can see the configuration window for SOA server in the right pane.
5.      Top, we can see one drop down “SOA Infrastructure” à “SOA Administration” à “Workflow Properties”
6.      In the page, we can see the link “More Workflow Notification Configuration Properties...” and it will redirect to the page “System MBean Browser”
7.      In the left pane of System MBean Browser, navigate to the human-workflow node – Application Defined MBeans àoracle.as. soainfra.configàServer: soa_server1à WorkflowConfigàhuman-workflow
8.      This will refresh the right pane and see the entry for “UcmIdcUrlhttp://soa:7001/em/adf/images/t.gif
9.      Configure the Webcenter Content URL in the right value section.
URL: idc://<ucm hostname>:<idc port>
Eg:- idc://webcenter:4444
10.   Click on “Apply” button

It is advisable to keep host entries in both the machines for both webcenter and SOA, so that there won’t be any issues in the host communication. Also, edit the Security Host Entry Filter for SOA IP .

SocketHostAddressSecurityFilter=127.0.0.1|0:0:0:0:0:0:0:1|SOA IP

Now we have configured the webcenter content id curl for communication, but we have not provided any user credentials for communicating.

1.       In the same em console left pane,  expand “Weblogic Domain” folder and select the weblogic node and it will open the configuration window in the right pane.
2.       Click on the drop down “Weblogic Domain” à Security à Credentials
3.      Click on “Create Map” and add “WF-ADMIN-USER” for the map name
4.      Click on “Create Key” and select the”WF-ADMIN-USER”, since we are creating the key for this map.
5.      Enter the username and password – It is advisable to keep weblogic user for this configuration.

Restart the SOA and Webcenter Content Server in order to see the changes.

Open the human task form (ADF page) and can see Document Service option  in the Attachments section. Click on the green plus button to add the attachments and select the option “Upload File to Webcenter Content”

1.       Provide the name
2.       Choose the file for uploading by clicking “Choose File” button
3.      Select Document Type
4.      Select “Account”
5.      Select “Security Group”
6.      Click on “OK” to upload the content


We can also see the same uploaded document for other BPM roles for downloading and viewing it.

Monday, July 13, 2015

Webcenter Portal 11.1.1.9 New Features

·         We used to install each component server separately and now it is simplifies with JSK. Download all the JSK components in sinlge directory and can run for creating the JSK.
·         Supports private cloud support
·         Portal on on-premise integration with portal on-cloud.
·         New light weight and responsive templates for mobile
·         New EL Expression Support – Particular rendition of an image and particular rendition in the content presenter templates.
·         Integration with framework folders – Using for integrating Webcenter content with Webcenter Portal
o   Over 1000 files in a folder
o   Can migrate from folders_g to FrameworkFolders
·         Integration with below Microsoft products
o   Microsoft Exchange 2010 – Calendar/Personal Events
o   Microsoft Office 2013 in Desktop Integration

o   Microsoft Internet Explorer 11

Monday, July 6, 2015

Webcenter Portal Content Presenter Display Template

Content Presenter Taskflows are incorporating the content from content server in the webcenter portal and webcenter portal framework applications.

Using Site Studio connection with JDeveloper (Details) , we can create the Site Studio Files. Initially, we will analyse the page requirements and we ill create the Asset Modelling Document. Based on this, we will create the Element Definition, Region Definition and Contributor Data File in Content Server. Contributor Data File will have the content to be displayed in the portal.

We need a content presenter display template in order to render the site studio file in the Portal Pages.

A Content Presenter Display Template is a jsff (JSF Page Fragment) file. Oracle webcenter portal and portal framework application provides many pre-built content presenter display template to render the content in various formats.

The content types can map to the site studio region definitions. When we map this into content presenter display templates, we need to know the Region Definition of the CDF files and the property names to map the content property with jsff elements or components.

Follow the below steps to create the content presenter display template.

1. Create the WebCenter Portal Framework application.
2. Create a new jsff page.
3. Add the below code in the jsff file.

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
          xmlns:dt="http://xmlns.oracle.com/webcenter/content/templates"
version="2.1">
<dt:contentTemplateDef var="node">
    <af:panelGroupLayout id="pgl1">
      <af:outputText value="#{node.propertyMap['CATEGORY_TWOCL_ABTUS_RD:TEASERDESC'].asTextHtml}" id="ot1"/>
      <af:outputText value="#{node.propertyMap['CATEGORY_TWOCL_ABTUS_RD:IMAGE'].value}" id="ot3"/>
    </af:panelGroupLayout>
  </dt:contentTemplateDef>
</jsp:root>


In the above code,

CATEGORY_TWOCL_ABTUS_RD - is the Element Definition for the CDF file.

Region Definition Code:-

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<regionDefinition xmlns="http://www.oracle.com/sitestudio/Element/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oracle.com/sitestudio/Element/ http://www.oracle.com/sitestudio/ss_element_definition.xsd">
    <elements>
        <elementReference location="IMAGE_ED" name="IMAGE">
            <property name="label" value="CATEGORY_TWOCL_ABTUS_RD"/>
            <property name="description" value=""/>
        </elementReference>
        <elementReference location="TEASER_DESC_ED" name="TEASERDESC">
            <property name="label" value="TEASER_DESC_ED"/>
            <property name="description" value=""/>
        </elementReference>
        <elementReference location=URLLIST_ED" name="URLLIST">
            <property name="label" value="URLLIST_ED"/>
            <property name="description" value=""/>
        </elementReference>
    </elements>
    <property name="description" value=""/>
    <dataProperty name="metadata"></dataProperty>
    <complexProperty name="switchregioncontent">
        <property name="createnewxml" value="true"/>
        <property name="createnewnative" value="false"/>
        <property name="choosemanaged" value="true"/>
        <property name="chooselocal" value="false"/>
        <property name="choosenone" value="false"/>
        <valueList name="createnewnativedoctypes"/>
        <complexProperty name="choosemanagedquerytext">
            <property name="corecontentonly" value="false"/>
            <dataProperty name="querytext">((xWebsiteObjectType &lt;matches&gt; `Data File`) &lt;and&gt; (xRegionDefinition &lt;matches&gt; `CATEGORY_TWOCL_ABTUS_RD`)) &lt;or&gt; (xWebsiteObjectType &lt;matches&gt; `Native Document`)</dataProperty>
        </complexProperty>
        <dataProperty name="defaultmetadata"></dataProperty>
    </complexProperty>
</regionDefinition>


We will create the CDF file based on this Region Definition. below are the code for Contributor Data File.

<?xml version="1.0" encoding="UTF-8"?>
<wcm:root version="8.0.0.0" xmlns:wcm="http://www.stellent.com/wcm-data/ns/8.0.0">
<wcm:element name="IMAGE">&lt;img src="[!--$wcmUrl('resource','ABOUTUSSAMPLEIMAGE')--]" alt="ABOUTUSSAMPLEIMAGE.jpg" /&gt;</wcm:element>
<wcm:element name="TEASERDESC">Teaser Description</wcm:element>
<wcm:list name="URLLIST">

<wcm:row>
    <wcm:element name="URLTEXT">URL1</wcm:element>
    <wcm:element name="URLLINK">URL1</wcm:element>
</wcm:row>

<wcm:row>
    <wcm:element name="URLTEXT">URL2</wcm:element>
    <wcm:element name="URLLINK">URL2</wcm:element>
</wcm:row>
   
<wcm:row>
    <wcm:element name="URLTEXT">URL3</wcm:element>
    <wcm:element name="URLLINK">URL3</wcm:element>
</wcm:row>
   
<wcm:row>
    <wcm:element name="URLTEXT">URL4</wcm:element>
    <wcm:element name="URLLINK">URL4</wcm:element>
</wcm:row>

</wcm:list>

</wcm:root>


The above CDF file will be created in the content server. This CDF file can be inserted in the portal pages during design time or runtime. For that, we need a ucm connection.

Once we add the contributor data file, we need to select the content presenter display template. For that we need to add this jsff file as portal resource.

Right click on the jsff file and select 'Create Portal Resource'.

Select the Display Name and View ID. This View ID is required to set the content presenter display template in the design time.

Once the content presenter display template is added, we need to login to the portal application or portal framework application and go to the shared assets. We need to make visible this content presenter display template for the portal application in the administration window.

After that select the content presenter display template to view the content in the portal pages.


Webcenter Portal 11.1.1.8 Integration with BPM Process Spaces

Please go to the below link to access the integration details. I have done the WebCenter Portal integration with BPM process spaces in the below versions. I have kept Webcenter and SOA in separate machines and that is the most difficult part for this integration.

1. 11gPS7 - 11.1.1.8
2. 11gPS4 - 11.1.1.6
3. 11gPS3 - 11.1.1.4

Click Here

IBR Configuration in UCM Server

Start the Oracle Content and IBR Managed Servers.

We need to setup Oracle Webcenter Content Server to send jobs to IBR for conversion.

As a first step, we need to create an outgoing provider .

1. Open Content Server (http://hostname:16200/cs)
2. Go to 'Administration' menu and choose 'Providers'
3. In the create new provider section, click 'Add' in the outgoing row.
4. Enter the values for the below fields.
    Provider Name : IBROutgoingProvider
    Provider Description : IBR Outgoing Provider
    Instance Name : IBROutgoingProvider
    Server Host Name : Host Name of the IBR Machine
    HTTP Server Address : http://<webcenter>:16250
    Server port : 5555
    Relative Web Root : /ibr/
    Select the check box for 'Handles Inbound Refinery Conversion Jobs
    Do not select the checkbox for 'Refinery read-only mode'
    Manimum Jobs to Queue : 100
5.submit the form and restart the IBR Server and Content Server

Once the connection is established, we can see the entries in IBR Active agents.

Sunday, July 5, 2015

Enable Full text Search in WebCenter Content (UCM)

To enable the full text search in Webcenter Content, please follow the below steps.

1. Modify the Configuration File and append the below line.

$cd <WC Installation Path>/user_projects/domain/<domain_name>/ucm/cs/config/config.cfg

SearchIndexerEngineName=DATABASE.FULLTEXT

Restart the Content Server

We need to reindex the Content server data

Open content server --> Administration tab -->Admin Applets -->Repository Manager -->
index tab,

in the automatic update cycle--> click 'Start'

Once it is finished,

in the collection rebuild cycle --> click 'Start'

Once it is finished, it is advisable to start the content server and webcenter portal managed servers.