Monday, October 21, 2013

Tracking the messages in Oracle OSB

Tracking the messages in Oracle OSB

This blog will explain how to track the message for a Oracle OSB flow with unique key.

In oracle OSB we can assign a Report key to the proxy service and based on this key the messages can be tracked.

I have developed a proxy service based on business service that invokes a Employee BPEL, this blog will explain how to track the employee messages with employee id.

Steps to enable message tracking in OSB

Open project in OSB console and also create a session

Click on View Message Flow of proxy service



Wednesday, October 16, 2013

The WSDL is not semantically valid: The element or type specified for part'payload' in message cannot be found in any schemas referenced by this wsdl - Oracle OSB

The WSDL is not semantically valid: The element or type specified for part'payload' in message cannot be found in any schemas referenced by this wsdl - Oracle OSB

While creating the WSDL resource in OSB with inline schema refereed to create the message types we may receive the following exception even though the wsdl is valid

An error occurred creating the resource:
The WSDL is not semantically valid: The element or type specified for part'payload' in message '{http://www.tr.com/ns/2013/10/14/SAP/EAI/AAALM/LicenseManagement}PositionEntitlementRequestMessage' cannot be found in any schemas referenced by this wsdl.

WSDL File:


<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="SAPOM_PositionEntitlement"
                  targetNamespace="http://www.tr.com/ns/2013/10/14/SAP/EAI/AAALM/LicenseManagement"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:client="http://www.tr.com/ns/2013/10/14/SAP/EAI/AAALM/LicenseManagement"
                  xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
 <wsdl:types>
  <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <xsd:element name="MT_EntitlementStatus" type="client:DT_EntitlementStatus"/>
   <xsd:complexType name="DT_EntitlementStatus">
    <xsd:annotation>
     <xsd:documentation xml:lang="EN">Schema for Entitlement Message</xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
     <xsd:element name="Record">
      <xsd:complexType>
       <xsd:sequence>
        <xsd:element name="header">
         <xsd:complexType>
          <xsd:sequence>
           <xsd:element name="applicationId" type="xsd:string"/>
           <xsd:element name="transactionId" type="xsd:string"/>
           <xsd:element name="messageId" type="xsd:string"/>
           <xsd:element name="messageHistory" type="xsd:string"/>
           <xsd:element name="tracingId" type="xsd:string"/>
          </xsd:sequence>
         </xsd:complexType>
        </xsd:element>
        
       </xsd:sequence>
      </xsd:complexType>
     </xsd:element>
    </xsd:sequence>
   </xsd:complexType>
  </xsd:schema>
 </wsdl:types>
 <wsdl:message name="PositionEntitlementRequestMessage">
  <wsdl:part name="payload" element="client:MT_EntitlementStatus"/>
 </wsdl:message>
 <wsdl:portType name="PositionEntitlement">
  <wsdl:operation name="process">
   <wsdl:input message="client:PositionEntitlementRequestMessage"/>
  </wsdl:operation>
 </wsdl:portType>

</wsdl:definitions>

The issue is the namespace prefix client is not able to access the element MT_EntitlementStatus.

To resolve this issue add the the targetNamespace attribute in schema definition as shown below

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="SAPOM_PositionEntitlement"
                  targetNamespace="http://www.tr.com/ns/2013/10/14/SAP/EAI/AAALM/LicenseManagement"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:client="http://www.tr.com/ns/2013/10/14/SAP/EAI/AAALM/LicenseManagement"
                  xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
 <wsdl:types>
  <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"  targetNamespace="http://www.tr.com/ns/2013/10/14/SAP/EAI/AAALM/LicenseManagement">
   <xsd:element name="MT_EntitlementStatus" type="client:DT_EntitlementStatus"/>


Thursday, September 12, 2013

Common customization file to deploy OSB services to different environments

Common customization file to deploy OSB services to different environments

The customization file can be used to customize the OSB services.
This post will explain how to use the common customization file to customize the OSB services.

Steps to use common customization file to customize the OSB services

1. Create a environment specific property files with the end point details ex Dev_build.properties

# SFDC Details
sfdc.protocol=http
sfdc.host=10.23.23.11

siebel.protocol=http
siebel.host=10.23.23.12


2. Common customization file

To customize the end point details for the business service, we have to change the Service URI and Service URI Table.
we have to tokenize the endpoint details so that the values can be replaced from the environment specific file.

For each new OSB service generate the customization file and copy the required sections(mainly <cus:envValueAssignments> of Service URI and Service URI table <cus:envValueAssignments>) to the common customization file.

<?xml version="1.0" encoding="UTF-8"?>
<cus:Customizations xmlns:cus="http://www.bea.com/wli/config/customizations" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xt="http://www.bea.com/wli/config/xmltypes">
  <cus:customization xsi:type="cus:EnvValueCustomizationType">
    <cus:description/>
    <cus:envValueAssignments>
      <xt:envValueType>Service URI</xt:envValueType>
      <xt:location>0</xt:location>
      <xt:owner>
        <xt:type>BusinessService</xt:type>
        <xt:path>VenusOSB/BusinessServ/BS_ServCloudVenusInbound</xt:path>
      </xt:owner>
      <xt:value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">@sfdc.protocol@://@sfdc.host@/services/service1</xt:value>
    </cus:envValueAssignments>

    <cus:envValueAssignments>
      <xt:envValueType>Service URI Table</xt:envValueType>
      <xt:location xsi:nil="true"/>
      <xt:owner>
        <xt:type>BusinessService</xt:type>
        <xt:path>VenusOSB/BusinessServ/BS_ServCloudVenusInbound</xt:path>
      </xt:owner>
      <xt:value>
        <tableElement xmlns="http://www.bea.com/wli/sb/transports">
          <URI>@sfdc.protocol@://@sfdc.host@/services/service1</URI>
          <weight>1</weight>
        </tableElement>
      </xt:value>
    </cus:envValueAssignments>

    <cus:envValueAssignments>
      <xt:envValueType>Service URI</xt:envValueType>
      <xt:location>0</xt:location>
      <xt:owner>
        <xt:type>BusinessService</xt:type>
        <xt:path>VenusOSB/BusinessServ/BS_RCRMVenusInbound</xt:path>
      </xt:owner>
      <xt:value xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">@siebel.protocol@://@siebel.host@/eai_enu/start.swe</xt:value>
    </cus:envValueAssignments>
    <cus:envValueAssignments>
      <xt:envValueType>Service URI Table</xt:envValueType>
      <xt:location xsi:nil="true"/>
      <xt:owner>
        <xt:type>BusinessService</xt:type>
        <xt:path>VenusOSB/BusinessServ/BS_RCRMVenusInbound</xt:path>
      </xt:owner>
      <xt:value>
        <tran:tableElement xmlns:tran="http://www.bea.com/wli/sb/transports">
          <tran:URI>@siebel.protocol@://@siebel.host@/eai_enu/start.swe</tran:URI>
          <tran:weight>1</tran:weight>
        </tran:tableElement>
      </xt:value>
    </cus:envValueAssignments>

  </cus:customization>



Monday, August 19, 2013

Issues while executiing the WLST script to customize the OSB

Issues while executiing the WLST script to customize the OSB

You may be receiving some of the below issues while executing the WLST script to customize the OSB projects.

ImportError: no module named wli: Make sure $OSBHOME/lib/sb-kernel-api.jar is added into the CLASSPATH.

ImportError: no module named customization: Make sure $OSBHOME/modules /com.bea.common.configfwk_1.5.0.0.jar added into the CLASSPATH.

java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.bea.wli.sb.management.configuration.DelegatedSessionManagementMBean: Make sure $OSBHOME/lib/sb-kernel-impl.jar added into the CLASSPATH.

 CLASSPATH=$CLASSPATH:$OSBHOME/modules/com.bea.common.configfwk_1.5.0.0.jar:$OSBHOME/lib/sb-kernel-api.jar:$OSBHOME/lib/sb-kernel-impl.jar;export CLASSPATH



Customizing the OSB Service through WLST script

Customizing the OSB Service through WLST script

This post will explain how to Customize the OSB Service through WLST script

The below WLST script will help us to run the OSB customization file.

import sys
from java.io import FileInputStream
from com.bea.wli.config.customization import Customization
from com.bea.wli.sb.management.importexport import ALSBImportOperation
from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
from com.bea.wli.sb.management.configuration import SessionManagementMBean

def customizeOSBService(customizationFile):
    SessionMBean = None
    try:
        connect('weblogic', 'welcome1', 't3://localhost:8000')
        domainRuntime()
        sessionName = String("Customization"+Long(System.currentTimeMillis()).toString())
        SessionMBean = findService("SessionManagement", "com.bea.wli.sb.management.configuration.SessionManagementMBean")
        SessionMBean.createSession(sessionName)
        OSBConfigurationMBean = findService(String("ALSBConfiguration.").concat(sessionName), "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")
        print 'Loading customization File', customizationFile
        iStream = FileInputStream(customizationFile)
        customizationList = Customization.fromXML(iStream)       
        OSBConfigurationMBean.customize(customizationList)
        SessionMBean.activateSession(sessionName, "Complete customization using wlst")
        disconnect()

    except:
        print "Unexpected error:", sys.exc_info()[0]
        if SessionMBean != None:
            SessionMBean.discardSession(sessionName)
        raise

def main():
       
        customizeOSBService('D:\Albin\ALSBCustomizationFile.xml')           
        print 'Successfully Completed customization'   
main()

Customization File:

Customization file will help us to modify the environment specific values for a OSB project.
The previous post can be referred for more details on customization file.

Modify the  environment specific values in the customization file.

Running the Script:

Login to the server and copy the wlst script and the Customization file to some location.
Execute the below two commands

CLASSPATH=$CLASSPATH:$OSBHOME/modules/com.bea.common.configfwk_1.5.0.0.jar:$OSBHOME/lib/sb-kernel-api.jar:$OSBHOME/lib/sb-kernel-impl.jar;export CLASSPATH

wlst.sh /home/eaiapp/Albin/OSBCustomization.wlst

Before executing the first command change the com.bea.common.configfwk_1.5.0.0.jar file version according to your environment.

After successful execution verify the service from OSB Console

  DOWNLOAD OSBCustomization.wlst


Saturday, August 17, 2013

OSB Service customization through console

OSB Service customization through console

This post will explain how to perform OSB customization through console


OSB customization will help us to change the environment specific properties for OSB resources.
There are multiple options to customize the OSB resources.

 Find & Replace:

Find And Replace option help us to find and replace the environment specific values. For example replacing the service URI of the service.
Login to OSB console (http ://<< host name>> :<< port>>/sbconsole) and Create the session
Click on System Administration and Find & Replace under Customization


Enter the find value also provide Find in variable type, Located in project if required and click on Find button. This will display the find results in the bottom.

Enter the value to be replaced and click on Replace All.



Friday, November 2, 2012

Invoking a web service with HTTP Basic authentication – OSB 11g

Invoking a web service with HTTP Basic authentication – OSB 11g:


To invoke the webservice that is protected with basic authentication, the Service account needs to be created and attached to the outbound business service (the service that calls the webservice)
This post explains the steps required to invoke the basic authentication enabled service.

Steps to invoke the basic authentication enabled service

  • Login to sbconsole
  • Create the Service AccountA service account provides a user name and password that proxy services and business services use for outbound authentication or authentication to a local or remote resource, such as an FTP server or a JMS server. For example, if a business service is required to supply a user name and password for transport-level authentication with a Web Service, you create a service account that specifies the user name and password and then you configure the business service to include the service-account credentials in its outbound requests.
  • Select Project Explorer and then select a project or folder in which to add the service account
  •  From the Create Resource drop-down list, select Service Account to display the Create a New Service Account page


Friday, October 5, 2012

Disabling/Enabling the Oracle Service Bus Services from Java

Disabling/Enabling the Oracle Service Bus Services from Java


The status of the OSB services can be changed in different ways like through OSB console, through WLST script and through Java.

This post shows how to use the Java API to enable/disable the OSB Proxy/Business services.

Java Code:

package osbservicestatusupdate;
import com.bea.wli.config.Ref;
import com.bea.wli.sb.management.configuration.*;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Hashtable;
import javax.management.*;
import javax.management.remote.*;

import javax.naming.Context;
import weblogic.management.jmx.MBeanServerInvocationHandler;
import weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean;

public class OSBServiceStatusUpdate {
    private static JMXConnector initConnection(String hostname, int port,String username, String password) throws IOException,MalformedURLException
    {
        JMXServiceURL serviceURL = new JMXServiceURL("t3", hostname, port,"/jndi/" + DomainRuntimeServiceMBean.MBEANSERVER_JNDI_NAME);
        Hashtable<String, String> h = new Hashtable<String, String>();
        h.put(Context.SECURITY_PRINCIPAL, username);
        h.put(Context.SECURITY_CREDENTIALS, password);
        h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "weblogic.management.remote");
        return JMXConnectorFactory.connect(serviceURL, h);
    }

    private static Ref constructRef(String refType,String serviceuri){
        Ref ref = null;
        String[] uriData = serviceuri.split("/");
        ref = new Ref(refType,uriData);       
        return ref;
    }

    public static String changeProxyServiceStatus(String servicetype,boolean status,String serviceURI,String host,int port,String username,String password){
        JMXConnector conn = null;
        SessionManagementMBean sm = null;
        String sessionName = "mysession";
        String statusmsg="";
        try{
            conn = initConnection(host, port, username,password);
            MBeanServerConnection mbconn = conn.getMBeanServerConnection();
            DomainRuntimeServiceMBean domainService = (DomainRuntimeServiceMBean) MBeanServerInvocationHandler.
                newProxyInstance(mbconn, new ObjectName(DomainRuntimeServiceMBean.OBJECT_NAME));
            sm = (SessionManagementMBean) domainService.findService(SessionManagementMBean.NAME,SessionManagementMBean.TYPE, null);
            sm.createSession(sessionName);            
            ALSBConfigurationMBean alsbSession = (ALSBConfigurationMBean) domainService.
                 findService(ALSBConfigurationMBean.NAME + "." + "mysession",ALSBConfigurationMBean.TYPE, null);      
          
            if(servicetype.equals("ProxyService")) {
                Ref ref = constructRef("ProxyService",serviceURI);
                ProxyServiceConfigurationMBean proxyConfigMBean = (ProxyServiceConfigurationMBean) domainService.
                 findService(ProxyServiceConfigurationMBean.NAME + "." + sessionName,ProxyServiceConfigurationMBean.TYPE, null);
                if(status){
                   proxyConfigMBean.enableService(ref);
                   statusmsg="Enabled the Service : " + serviceURI;
                }
                else {            
                    proxyConfigMBean.disableService(ref);   
                    statusmsg="Disabled the Service : " + serviceURI;
                }  
            }else if(servicetype.equals("BusinessService")) {
                Ref ref = constructRef("BusinessService",serviceURI);               
                BusinessServiceConfigurationMBean businessConfigMBean = (BusinessServiceConfigurationMBean) domainService.
                 findService(BusinessServiceConfigurationMBean.NAME + "." + sessionName,BusinessServiceConfigurationMBean.TYPE, null);
                if(status){
                   businessConfigMBean.enableService(ref);
                   statusmsg="Enabled the Service : " + serviceURI;
                }
                else {            
                    businessConfigMBean.disableService(ref);   
                    statusmsg="Disabled the Service : " + serviceURI;
                }  
            }
           sm.activateSession(sessionName, statusmsg);           
           conn.close();
        }catch(Exception ex){
            if(null != sm) {
                try{
                    sm.discardSession(sessionName);
                }catch(Exception e) {
                    System.out.println("able to discard the session");
                  
                }
            }
            statusmsg="Not able to perform the operation";           
            ex.printStackTrace();          
        }finally{
            if(null != conn)
                try{
                    conn.close();
                }catch(Exception e) {
                    e.printStackTrace();
                }
        }
       
        return statusmsg;
    }
      
    public static void main(String[] args) {       
        //changeProxyServiceStatus(servicetype, status, serviceURI, host, port, username, password)       
        System.out.println(changeProxyServiceStatus("BusinessService", false, "OSBServiceAPI/OSBServiceAPIBusiness", "localhost", 8000, "weblogic", "welcome1"));
       
    }
}



Monday, September 17, 2012

Import/Publish the services from Oracle Service Bus to Service Registry

Import/Publish the services from Oracle Service Bus to Service Registry:


The OSB services can be published to OSR; the service consumer can consume the services from the OSR also OSB can import and consume the services from OSR.

This blog provides the step to configure and import/publish the services to OSR.

Configure the OSR:

  • Login to OSB console
  • Select System Administration and click on UDDI Registries and click Add Registry
  •  Enter the Oracle Service Registry details as shown below and click on save