Friday 18 November 2016

ESS Error when invoking OSB WebService

When I try to schedule OSB web-service using Oracle enterprise scheduler (ESS 12.2.1.0.0), I ran into following issue;

Exception:
com.bea.wli.sb.service.handlerchain.HandlerException: The message must be an instance of: {http://www.w3.org/2003/05/soap-envelope}Envelope
com.bea.wli.sb.service.handlerchain.HandlerException: The message must be an instance of: {http://www.w3.org/2003/05/soap-envelope}Envelope
at com.bea.wli.sb.service.handlerchain.handlers.ComputeOperation$1.getPayload(ComputeOperation.java:204)
at com.bea.wli.sb.services.bindinglayer.BindingOperationMapper$QNameMapper.computeOperationName(BindingOperationMapper.java:564)
at com.bea.wli.sb.service.handlerchain.handlers.ComputeOperation.dispatch(ComputeOperation.java:93)
at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:132)

In server log file, I found out ESS posting SOAP message using SOAP 1.1 format while OSB service expect SOAP message in SOAP 1.2 format as the OSB service I'm trying to schedule only support SOAP 1.2. It seems ESS only support SOAP 1.1

Server Log:
<Nov 18, 2016 8:18:00 AM GMT> <Error> <oracle.osb.resources.service.service> <OSB-398325> <An error has occurred while parsing the payload. Payload details:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">  

SOAP 1.1 use SOAP namespace of http://schemas.xmlsoap.org/soap/envelope/ while SOAP 1.2 use http://www.w3.org/2003/05/soap-envelope.

The simple solution is to add SOAP 1.1 binding in OSB proxy service.

Monday 12 September 2016

Configure SOA 12c Compact domain for DB MDS

I have a habit of creating virtual box VM myself for oracle product rather downloading pre-build VM from OTN.  Oracle SOA suits 12.2.1 VM available to download in OTN and ships with expanded domain having admin and soa managed server. Since running both admin server and managed server in development laptop is a bit overhead, I have ended up creating a compact domain for development use. During the development I noted compact domain only support for file based MDS and OWSM. 

Following steps concentrate on compact domain and re-configure it to use DB MDS, so that DB-based repository is used instead of file based one. By doing this, it should be possible to edit rules and DVMs during run-time using composer.

Approach:
  1. Check your database already contains MSD schema (<prefix>_mds). If not create new MDS schema using RCU.
  2. Start WLST session.
    • $> cd <fmw_home>/soa/common/bin
    • ./wlst.sh
    • connect('weblogic','welcome1','t3://localhost:7001')
  3. Export current content of the file based MDS
    • exportMetadata(application='soa-infra', server='AdminServer', toLocation='/tmp/mdsexport', docs='/**')
  4. Shutdown soa-infra via weblogic console
    • Deployments -> Control Tab ->Check soa_infra -> Stop -> Force shutdown
  5. De-register file based MDS
    • Log into em console
    • Click Weblogic Domain in right hand corner -> Other Services ->Metadata Repositories
    • Select mds-soa under “File-Based Repositories” and click on De-register
  6. Register a new DB-based Repository
    • Delete existing mds-soa datasource before from WLS Console > Services -> Data Sources -> Check mds-soa -> Delete
    • Log into em console
    • Click Weblogic Domain in right hand corner -> Other Services ->Metadata Repositories
    • Click Register under 'Database-Based Repositories'
    • Enter Database connection information and click 'Query'
    • Select Query return row 'MDS' and enter repository name as 'mds-soa' and schema password for <prefix>_mds and then click 'Ok'
    • Click 'mds-soa' repository and check 'soa-infra' partition visible under 'Repository Partition'
  7. Use WLST to import exported metadata into the new MDS-Partition
    • importMetadata( application='soa-infra', server='AdminServer', fromLocation='/tmp/mdsexport', docs='/**')
  8. Restart AdminServer and double check 'soa-infra' application up and running using weblogic console.
  9. Verify SOA Composer for having “Create Session” Button
  10. Create Jdeveloper DB MDS connection and verify DB MDS artifacts visible in Jdeveloper.
  11. If above verification successful, Well-done, you are ready to use DB based MDS for soa-mds

Tuesday 12 July 2016

Invalidate Result Cache in OSB 12c

Starting from Oracle Service Bus 11g, provides built-in cache functionality that utilise Oracle Coherence. One of the common use case of built-in cache is result caching of OSB business service response that do not change often, you can configure those business services to cache results.  

Each entry in OSB built-in result cache uniquely identified by a cache key. Cache key is made up of following component;


  • Cache Token - The token configured in Business Service (e.g - Customer ID)
  • ServiceRef - Service Type (i.e - BusinessService) + Fully qualified path name of the service (e.g - <OSBProjectName>/<Business>/<BusinessServiceName>)
  • Operation - Operation nae of the business service.
Service Bus with Coherence can invalidate an individual cached result, all cached results for a business service, or the entire result cache. Built-in result cache invalidation is based on one of following events.
  • Cache TTL has expired
  • Disable result caching on a single business service.
  • Update, rename, or delete a business service.
  • Globally disable result caching
Recently, I had a requirement to invalidate result cache entry in  OSB pipeline. Unfortunately OSB 12c doesn't provide any functionality to invalidate result cache entry in OSB pipeline. I developed following custom XPath function to invalidate result cache entry. By calling this XPath function in OSB Request pipeline will flush the already cached entry and invoke external service. The XPath function tested successfully in OSB 12.2.1. 

Following Weblogic JAR files required for compilation
<FMW_HOME>/osb/lib/modules/oracle.servicebus.resources.service.jar
<FMW_HOME>/osb/lib/modules/oracle.servicebus.configfwk.jar

    /**
     * Method for invalidate single OSB result cache entry.
     * @param serviceType - Type of the server (BusinessService or ProxyService)
     * @param servicePath - Fully qualified path name of the service
     * @param operationName - Operation nae of the business service.
     * @param cacheTokenID - The token configured in Business Service (e.g - Customer ID)
     * @return true if succesfully invalidate the cache entry, otherwise false
     * @throws XPathFunctionException
     */
    public static Boolean invalidateCacheEntry(final String serviceType, final String servicePath,
                                               final String operationName,
                                               final String cacheTokenID) throws XPathFunctionException {
        Boolean invalidateResult = false;
        // Costructing Ref for business or proxy service
        Ref serviceRef = constructRef(serviceType, servicePath);
        ResultCacheKey key = new ResultCacheKey(serviceRef, operationName, cacheTokenID);

        if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.log(Level.FINE, "Checking result cache for " + key);
        }

        try {
            // Check cache having the search key
            Result cachedValue = ResultCacheManager.get().getResultCache().get(key);
            if (cachedValue != null) {
                // Remove the cached value
                ResultCacheManager.get().getResultCache().remove(key);
                invalidateResult = true;
            }

        } catch (ResultCacheException e) {
            throw new XPathFunctionException("Error invalidating result cache entry " + key + ", " + e);
        }
        return invalidateResult;
    }

    /**
     * Construct OSB service reference.
     *
     * @param refType - Type of the reference type
     * @param serviceuri - Service URI
     * @return
     */
    private static Ref constructRef(String refType, String serviceuri) {
        Ref ref = null;
        String[] uriData = serviceuri.split("/");
        ref = new Ref(refType, uriData);
        return ref;
    }

  

Friday 26 November 2010

OC4J Configurations for Deploy Apache CXF Web Services

In this post I’ll guide you to port web service developed using Apache CXF and Spring Framework into Oracle Application server. After hitting the first deployment issue, I referred to Apache CXF Application Server Specific Configuration Guide. When going through this page, I noted some of the information (e.g - Get rid of OC4J JAX-WS libraries section) risk your Oracle Application server, as it require customization of oc4j.jar file. Actually I have oc4j.jar file as per this page, however when starting my SOA 10.1.3.5 instance, I ended-up with number of exceptions. Rather trying to resolve this issue, I decided another way of deploying the web service application. Please refer to OC4J_Configuration_For_Apache_CXF for all the steps I followed during the deployment.

Summery..
  • Preparing stax-api
  • Replace the Oracle XML parser with Xerces
    • Added xercesImpl.jar, xml-apis.jar, xalan.jar and serializer.jar from Xalan distribution
    • Added geronimo-ws-metadata_2.0_spec-1.1.2.jar from CXF distribution.
  • Swapping Oracle wsdl.jar with wsdl4j.jar
    • Only nedded -Xbootclasspath/p:<path to wsdlj>/wsdl4j-1.6.1.jar
  • Deploying applications
  • Additionally I added all required CXF and Spring Framework libraries in WEB-INF/lib
  • Get rid of OC4J JAX-WS libraries
3. I used following versions of software.
  • Oracle SOA Suits 10.1.3.5.0 (I also tested on 10.1.3.3.0)
  • Apache CXF 2.2.5
  • Xalan 2.7.1
  • Spring Framework 2.5.5
**********************************************************************************************************************

Thursday 11 November 2010

"OracleASjms/ESBMonitorTopic not found"

You might find 'OracleASjms/ESBMonitorTopic not found Make sure the topic is mapped to a jndi tree' error in oc4j container log file, after you set-up a ESB cluster. I face the same issue after I install ESB-RT and ESB-DT in two different oc4j containers. My objective was to exlopre Oracle ESB clustering options. I was trying to install Oracle BPEL and Oracle ESB-RT in one oc4j_soa container and ESB-DT in another oc4j_esbdt container, but using the same ORACLE_HOME. Starting from SOA 10.1.3.3 ESB-DT can be installed into same ORACLE_HOME as ESB-RT. However ESB-DT should be in different oc4j container

The installation went successful and no errors reported during installation and on log file. However when starting oc4j_soa container where ESB-RT installed, the following error thrown in opmn log file.

11/11 12:10:31 oracle.tip.esb.server.dispatch.QueueHandlerException: Context lookup failed "OracleASjms/ESBMonitorTopic not found" Make sure the topic is mapped to a jndi tree
10/11/11 12:10:31  at oracle.tip.esb.server.dispatch.JMSEnqueuer.createConnection(JMSEnqueuer.java:203)
......
11/11 12:10:31 Caused by: javax.naming.NameNotFoundException: OracleASjms/ESBMonitorTopic not found

This is because default default JNDI tree entries in OracleASjms adapter created by ESB install are missing in $ORACLE_HOME/j2ee/oc4j_soa/config/oc4j-connectors.xml file. Add following after taking a backup of oc4j-connectors.xml file and restart the container.

<adminobject-config location="OracleASjms/ESBDeferredTopic">
    <adminobject-class>oracle.j2ee.ra.jms.generic.AdminObjectTopicImpl</adminobject-class>
    <config-property name="jndiName" value="jms/topic/WF_JAVA_DEFERRED"/>
    <config-property name="resourceProviderName" value="oc4jjms"/>

</adminobject-config>
<adminobject-config location="OracleASjms/ESBControlTopic">
    <adminobject-class>oracle.j2ee.ra.jms.generic.AdminObjectTopicImpl</adminobject-class>
    <config-property name="jndiName" value="jms/topic/WF_CONTROL"/>
    <config-property name="resourceProviderName" value="oc4jjms"/>

</adminobject-config>
<adminobject-config location="OracleASjms/ESBMonitorTopic">
    <adminobject-class>oracle.j2ee.ra.jms.generic.AdminObjectTopicImpl</adminobject-class>
    <config-property name="jndiName" value="jms/topic/ESB_MONITOR"/>
    <config-property name="resourceProviderName" value="oc4jjms"/>

</adminobject-config>
<adminobject-config location="OracleASjms/ESBErrorRetryTopic">
     <adminobject-class>oracle.j2ee.ra.jms.generic.AdminObjectTopicImpl</adminobject-class>
     <config-property name="jndiName" value="jms/topic/ESB_ERROR_RETRY"/>
     <config-property name="resourceProviderName" value="oc4jjms"/>

</adminobject-config>
<adminobject-config location="OracleASjms/ESBErrorTopic">
     <adminobject-class>oracle.j2ee.ra.jms.generic.AdminObjectTopicImpl</adminobject-class>
     <config-property name="jndiName" value="jms/topic/ESB_ERROR"/>
     <config-property name="resourceProviderName" value="oc4jjms"/>

</adminobject-config>


Oops. After restarting the container, another error in opmn log file.


11/11 13:23:22 oracle.tip.esb.server.dispatch.QueueHandlerException: Publisher not exist for system "{0}"
10/11/11 13:23:22  at oracle.tip.esb.server.dispatch.JMSEnqueuer.createConnection(JMSEnqueuer.java:200)
.......
11/11 13:23:22 Caused by: javax.jms.InvalidDestinationException: Looking up java:comp/resource/oc4jjms/jms/topic/ESB_MONITOR: javax.naming.NameNotFoundException: No resource named 'oc4jjms/jms/topic/ESB_MONITOR'found
10/11/11 13:23:22  at oracle.j2ee.ra.jms.generic.AdminObjectImpl.getAdminObject(AdminObjectImpl.java:339)


To resolve this issue, add the following in $ORACLE_HOME/j2ee/oc4j_soa/config/jms.xml file.

<topic name="ESB Monitoring Topic" location="jms/topic/ESB_MONITOR"></topic>
<topic name="ESB Control Topic" location="jms/topic/WF_CONTROL"></topic>
<topic name="ESB Deferred Topic" location="jms/topic/WF_JAVA_DEFERRED"></topic>
<topic name="ESB Error Resubmission Topic" location="jms/topic/ESB_ERROR_RETRY"></topic>


**********************************************************************************************************************************************

Wednesday 3 November 2010

ora:parseEscapedXML XPath expression failed in SOA 10.1.3.5.0

We were running on SOA 10.1.3.3.0 on Windows and recently we migrated into SOA 10.1.3.5.0 on Oracle Linux Enterprise server 5.5. After the migration we deployed all our BPEL processors in new architecture. During the first testing scenario BPEL process start to fail with error;

XPath expression failed to execute. Error while processing xpath expression, the expression is "ora:parseEscapedXML(bpws:getVariableData('getInternalMsg',
'InternalMsgOutputCollection','/ns95:InternalMsgOutputCollection/ns95:InternalMsgOutput/ns95:INTERNAL_MSG'))", the reason is Expected name instead of  .. Please verify the xpath query.

After analysis we found this is because of source xml having '&' character. Metalink note 567712.1 says ora:parseEscapedXML fail if you send '&' character. However our Windows environment with SOA 10.1.3.3.0 perfectly working with ora:parseEscapedXML and '&' character.

Solution:
If you are in or above 10.1.3.4.0, replace ora:parseEscapedXML() with ora:parseXML(). If you are in 10.1.3.3.0, apply 10.1.3.3.1 MLR#8 and then user ora:parseXML().

********************************************************************************************************************************************

Thursday 30 September 2010

XWindows for Oracle SOA Installation on Linux

Recently, I had a requirement for migrate our windows based Oracle SOA suits servers into Linux platform. Most of Oracle installers use XWindows for the installation in GNU/Linux and other Unix(-like) systems. If you install from a remote workstation, you should have X-Server running.

This posting guide you to get X-Server up and running for install Oracle SOA suits in Red Hat Enterprise Linux Server Release 5.3 (64 bit). Instructions may slightly different if you are running a different flavour of Linux.

Required Software:



Steps:

    1. Install PuTTY and Xmanager in your local system.
    2. Go to All Programs -> PuTTY -> PuTTY and open PuTTY configuration window.
    3. Provide IP address of Linux server and select SSH.
    4. Login to Linux using root account.
    5. In the shell window execute the following command. This will installed required rpm and it's dependency's for X-Server.

              [root@hostname /]# yum -y install \
                                                          libXtst.i386 \
                                                          compat-libstdc++-33.i386 \
                                                          elfutils-libelf.i386 \
                                                          libaio.i386 \
                                                          libaio-devel.i386 \
                                                          libgcc.i386 \
                                                          libstdc++.i386 \
                                                          libstdc++-devel.i386 \
                                                          unixODBC.i386 \
                                                          unixODBC-devel.i386 \
                                                          openmotif.i386 \
                                                          libXp.i386 \
                                                          libXp.x86_64 \
                                                          binutils.x86_64 \
                                                          openmotif.x86_64 \
                                                          unixODBC-devel.x86_64 \
                                                          unixODBC.x86_64 \
                                                          glibc-headers.x86_64 \
                                                          gcc-c++.x86_64 \
                                                          zsh.x86_64 \
                                                          sysstat.x86_64 \
                                                          make.x86_64 \
                                                          libstdc++-devel.x86_64 \
                                                          libstdc++.x86_64 \
                                                          libgcc.x86_64 \
                                                          libaio-devel.x86_64 \
                                                          libaio.x86_64 \
                                                          glibc-devel.x86_64 \
                                                          glibc-common.x86_64 \
                                                          glibc-devel.i386 \
                                                          elfutils-libelf.x86_64 \
                                                          elfutils-libelf-devel.x86_64 \
                                                          gcc.x86_64 \
                                                          glibc.i686 \
                                                          glibc.x86_64 \
                                                          compat-libstdc++-33.x86_64 \
                                                          libXtst.x86_64

    6. Logout from Linux and close the PuTTY window.
    7. Go to All Progrrams - Xmanager 4 -> Xmanager - Passive -  You will see small X icon in your windows task bar.
    8. Go to All Programs -> PuTTY -> PuTTY and open PuTTY configuration window.
    9. Type IP address or if you saved your previous session, simple select the saved session and click load.
    10. Navigate to Connection -> SSH -> X11 in Category tile and click 'Enable X11 forwarding' check box


    11. Click 'Open' and login using your software installer account (normally oracle user account)
    12. Type [oracle@hostname /]$ echo $DISPLAY It should show some value.
   13. If you already download and unzip SOA suits software, go to softrare directory to start the Oracle installer.
          [oracle@hostname /]$ cd /media/oracle/stage/soa10.1.3.5
          [oracle@hostname /]$ ./runInstaller -ignoreSysPreReqs


**********************************************************************************************************************************************