Wednesday, September 2, 2015

Oracle Webcenter Capture Client is not loading

Oracle WebCenter Capture is used to scan the document and it can be uploaded to Webcenter Content. It provides a web interface where user can scan the document and can release the document to WebCenter Content.

When we are opening the capture client URL, http://hostname:16400/dc-client

If it throws java url, please reinstall the java and load the url


Please open below URL, and check the Java Installation status.



If it opens and  shows empty page, please check the Document Capture Version. If it is 11.1.1.8, please reinstall the patch by contacting Oracle Support  or install 11.1.1.9.

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.