Showing posts with label OSB. Show all posts
Showing posts with label OSB. Show all posts

Monday, September 16, 2019

Send MIME emails (HTML Email body + Attachments) from OSB using UMS Adapter

Hi Guys,

Here I am trying to explain how to send MIME (Multipurpose Internet Mail Extensions) emails from Oracle Service Bus 12c using UMS adapter having HTML email body Content and one or more Attachments.

I am assuming you are able to send simple emails from OSB, this requires some configurations. There are many blogs available on this topic. You can refer below blogs if Needed for basic setup:



The main purpose of this blog is to highlight usage of MIME or multipart/mixed emails which can have email body with attachments.
A Sample emails like below:

STEPS to Achieve this in OSB:

This assumes, you have a working OSB project which is able to send emails. (You can Refer above blogs for this purpose)

Assuming you have transformed the message required for your scenario, which is available in below format before request reaches the Routing node in OSB Pipeline.

<tns:EmailPayload xmlns:tns="">
<tns:Subject>POC| POC| NOTIFICATION | 2019-09-14T06:14:35.266-04:00</tns:Subject>
<table border="1" bordercolor="grey">
<td colspan="2" style="background-color:#33339F;color:white">
<td style="background-color:#33339F;color:white">INTERFACE NAME</td>
<td style="background-color:#33339F;color:white">ERROR DESCRIPTION</td>
<td>This is custom fault</td>

1. Below actions are required in OSB pipeline to achieve this. There may be other actions in your pipeline as well for purpose of audit/logging/invocations etc.

Transport Header Action:

Java Callout Action:

Content-type: text/html; charset="utf-8" 

Content-type: text/html; charset="utf-8" 
Content-Disposition: attachment; filename=payload.txt;


' )

Replace Action:

<ref:message xmlns:opaq="" 


Business Service tracing Logs for debugging:

[2019-09-16T06:44:18.466-04:00] [osb_server1] [NOTIFICATION] [OSB-398202] [oracle.osb.resources.service.service] [tid: [ACTIVE].ExecuteThread: '9' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 76bae70b-d533-4893-adda-a0d78240273b-0005e2b6,1:40787] [APP: Service Bus Routing] [FlowId: 0000Motf5J0Fw025zrH7iW1TU^G70004HD] [[
 [OSB Tracing] Outbound request was sent.

 Service Ref = DheerajOSB/BusinessServices/ref_UMS_Notification
 URI = jca://eis/ums/UMSAdapterOutbound
 Request metadata =
      <tran:headers xsi:type="jca:JCARequestHeadersXML" xmlns:jca="" xmlns:tran="" xmlns:xsi="">
        <jca:Content-Type>text/xml; charset=utf-8</jca:Content-Type>
        <jca:jca.ums.subject>POC | OSBSample2 | NOTIFICATION | 2019-09-16T06:44:18.236-04:00</jca:jca.ums.subject>
      <tran:encoding xmlns:tran="">utf-8</tran:encoding>
 Payload =
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv=""><soapenv:Body><ref:message xmlns:opaq="" xmlns:ref=""><opaq:opaqueElement>LS1NSU1FX0JvdW5kYXJ5IApDb250ZW50LXR5cGU6IHRleHQvaHRtbDsgY2hhcnNldD0idXRmLTgi+Ci0tTUlNRV9Cb3VuZGFyeS0tIAoKCg==</opaq:opaqueElement></ref:message></soapenv:Body></soapenv:Envelope>

[2019-09-16T06:44:18.506-04:00] [osb_server1] [NOTIFICATION] [OSB-398203] [oracle.osb.resources.service.service] [tid: [ACTIVE].ExecuteThread: '21' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 76bae70b-d533-4893-adda-a0d78240273b-0005e2b6,1:40787:14] [APP: Service Bus JCA Transport Provider] [FlowId: 0000Motf5J0Fw025zrH7iW1TU^G70004HD] [[
 [OSB Tracing] Outbound response was received.

 Service Ref = DheerajOSB/BusinessServices/ref_UMS_Notification
 URI = jca://eis/ums/UMSAdapterOutbound
 Message ID = a008016.2736342f.5.16d25a4109a.N7a1b
 Response metadata =
   <tran:headers xsi:type="jca:JCAResponseHeadersXML" xmlns:jca="" xmlns:tran="" xmlns:xsi=""/>
   <tran:response-code xmlns:tran="">0</tran:response-code>
 Payload =


Thursday, July 13, 2017

CSV to XML or Native to XML Transformation using MFL

Hi Guys,

Recently one of associate asked me about the MFL, so here I am writing this post on the usage of the MFL.
What I have experienced so far is, there are very few SOA experts who uses the Message Format Language or MFL.
There are others, who underestimates the MFL capability as compared to Oracle Technology adapters.

Lets get started..

Use case :
Reading a .csv file from file location, transforming to XML, and writing the XML file to another location.
Sample Input CSV Message -

3242;Ajay Kumar;Singh;43

Background -
The MFL can be used to transform a Native format to XML and vice versa. The biggest advantage MFL provides is, It can be done in OSB message flow. So you have option to log or audit both the formats as well as you can use it anywhere in Message flow as per your need.
Whereas Oracle technology adapters can only be used as a start point or end point of service.

Another advantage, MFL requires only one artifact (MFL transform file, .mfl file) for message transformation and no extra configuration is needed. Whereas Oracle Technology adapters will generate multiple artifacts like .wsdl file, .xsd file, .jca file etc.
Due to this Oracle Technology adapters can make the service complex when you have to cater for multiple formats conversion.


Step 1 - Create Proxy to read .csv file.

 Step 2 - Create a Pipeline (Not applicable in 11g)

Step 3 - Add pipeline in Message flow

Step 4 - Now create a MFL transform file. 

New MFL will look like below- 

Step 5 - Add GROUP by right click on message icon in MFL. This is needed only if your Message or File has repeated records.
There are few properties on this page.
tick OPTIONAL if file can have only one record.
tick UNLIMITED if file can have more than one record.
Enter DELIMITER, usually \n for next line. Sometimes, it could be anything else like ; or " or | etc.
Tick DELIMITER IS OPTIONAL if this is possible to be used as delimiter for the last field in a record. As in our example, Last field uses \n as delimiter

Step 6 - Now add fields names as child elements in order of occurrence under Group.
Mention there Delimiters. Here delimiter is ;

Notice Last field has '\n' as delimiter

Step 7 - Test you MFL in Jdevloper itself

Step 8 - Now go back to Message flow, Add MFL transform Action. Specify the properties as shown.
Here MFL output is assigned to VarXML variable

Step 9 - Add replace action to put XML in Body content

Step 10  - Create Business Service to write XMl file.

Step 11 - Add Route, Browse Business Service

Thats it guys. You have completed the Service.
Now go on deploy it to server, and Test the Service

Here's the Sample output file

<?xml version="1.0" encoding="UTF-8"?>
    <firstName>Ajay Kumar</firstName>

Download the sample osb jar file from below link

Thursday, May 04, 2017

Securing OSB Proxy Service using OWSM : Simple guide

Service Bus is integrated with Oracle Webservices Manager (OWSM) that provides several out of the box security policies. You can use any of these OWSM policies to secure your Proxy Services based on requirements. Here in this post, you will use oracle/wss_username_token_service_policy policy to secure Proxy Service.
Steps Summary :
1.    Create Users who needs access
2.    Add policy to Service
3.    Test and Validate

Login to Admin Console and click Security Realms in Domain Structure.

Click myrealm as shown below.

Navigate to Users by clicking on Users and Groups tab.

Click New and enter credentials as shown below.

Click OK. 
Observe that new user has been created which can be used to invoke Proxy Service.

Go to sbconsole. Create a new session. Navigate to All Projects –> <<your project>> and open the Proxy service to bring up a new tab as shown below.

Click Security and choose the option as shown below.

Click Attach Policies icon (highlighted above) and select the policy as shown below and click Attach.

Click OK and observe that selected policy is shown up as shown below.

Save your changes in current tab and activate the session.

You can use SOAPUI or SBConsole Test service for testing.
Open request editor for any of your Proxy Service operations and paste the following in SOAP header. This represents the WS-Security header and is expected by OWSM policy i.e. attached to Proxy Service.

Test using wrong credentials or without security header and observe the output showing security error.

Test using credentials created in first section and observe the output.
Add below header to your request, You can see username and password fields below.
                <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="" xmlns:wsu="">
                                <wsse:UsernameToken wsu:Id="UsernameToken-F7A4A73DA710AE195C14938940405155">
                                                <wsse:Password Type="">webic123</wsse:Password>
                                                <wsse:Nonce EncodingType="">T36cJsRsgb5IzQyyy/Yskw==</wsse:Nonce>

That’s all.

Friday, December 09, 2016

OSB-382032: The message must be an instance of: {}Envelope

The error could be as seen below :

<soap:Text xml:lang="en">
OSB-382032: The message must be an instance of: {}Envelope
<con:stack-trace xmlns:con=""> The message must be an instance of: {}Envelope

This issue comes when you are invoking a SOAP 1.2 web service.
The request you sent, to service must have namespace declaration with

I see 3 differences in SOAP 1.1 & SOAP 1.2 :
  • SOAP 1.2 uses "application/soap+xml" as Content-Type and SOAP 1.1 uses "text/xml".
  • SOAP 1.2 does not use SOAPAction header line.
  • SOAP 1.2 uses "" as the envolope namespace and SOAP 1.1 uses "".

Solution :
Make sure the payload you are sending to Target SOAP 1.2 service is having correct namespace declaration.
Your payload should be something like below :

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="">

<soapenv:Header xmlns:soapenv="">
<soapenv:Body xmlns:soapenv="">
<get:string xmlns:get=""></get:string>

Tuesday, November 08, 2016

Error Cluster BEA-000140 Failed to deserialize statedump from server

The Error could look something similar to below on managed server log file:

<Error> <Cluster> <BEA-000140> <Failed to deserialize statedump from server 2880051432324383502S:[8503,8503,-1,-1,-1,-1,-1]:soa_domain:soa_server1 with java.lang.ClassNotFoundException: oracle.bpm.bpmn.engine.instancemanagement.ejb.IInternalInstanceManagementServiceRemote.
java.lang.ClassNotFoundException: oracle.bpm.bpmn.engine.instancemanagement.ejb.IInternalInstanceManagementServiceRemote
        at weblogic.application.internal.AppClassLoaderManagerImpl.loadApplicationClass(
        at weblogic.common.internal.ProxyClassResolver.resolveProxyClass(
        at weblogic.common.internal.WLObjectInputStream.resolveProxyClass(
        Truncated. see log file for complete stacktrace

Corrupted files due to temporary communication failure between WebLogic admin and managed server instances. This also happens if one of the server node was down for longer time.

1. Shut Down Weblogic Managed/Admin Server
2.Delete the directory under $DOMAIN_HOME/servers/<SOA_SERVER1>/tmp/ and $DOMAIN_HOME/servers/<SOA_SERVER1>/cache/ 
3.Restart Admin/Managed servers. The file will create automatically.

Wednesday, June 22, 2016

File based MDS configuration SOA Jdevloper

Hi Guys, Today we are going with Steps for File Based MDS configurations.

STEP 1 :
Login to EM console.Expand SOA and right click on soa-infra and selcet Adminstration -->MDS configuration.


Click on Export button on MDS configuration screen and save it your local disk

unzip the folder soa_infra_metadata, 
you will see the 
apps folder. 
All your project related WSDlS,XSD,fault-policy.xml,fault-binding.xml etc will be inside the apps folder.


Now go to your C:\Oracle\Middleware\jdeveloper\integration\seed folder in your system, or it could be any other location as well, based on your Installation directory.
The above path created automatically while you installed JDeveloper studio.


Copy and Paste apps folder, which you have got in from STEP 2.
Now its look like C:\Oracle\Middleware\jdeveloper\integration\seed\

To use these schemas/wsdl etc in Jdeveloper we need to add some parameters in adf-config.xml under Application Resources.

Click on the adf-config.xml
Note:For each and every application it has his own adf-config.xml file persist.

Once opened the file need to add metadata-storage-usage_2 

          <namespace metadata-store-usage="mstore-usage_1" path="/soa/shared"/>
          <namespace metadata-store-usage="mstore-usage_2" path="/apps"/>
        <metadata-store-usage id="mstore-usage_1">
              <metadata-store class-name="oracle.mds.persistence.stores.file.FileMetadataStore">
              <property  name="metadata-path" value="${oracle.home}/integration"/>
              <property name="partition-name" value="seed"/>
        <metadata-store-usage id="mstore-usage_2">
             <metadata-store class-name="oracle.mds.persistence.stores.file.FileMetadataStore">
             <property name="metadata-path" value="C:\Oracle\Middleware\jdeveloper\integration"/>
             <property name="partition-name" value="seed"/>

1. I have specify mstore_usage_2 path="/apps"-------because my all schemas   under that folder only.Incase ur schemas under apps folder only u can specify path like path="/apps"
     :Oher case if your schemas folder name is SOASchemas then u can specify path like

2.Metadata-Path value  must be C:\Oracle\Middleware\jdeveloper\integration in real time scenarios
3.Patition-name valuse must be seed in real time scenarios.


STEP 6: 
To use a wsdl or any resource in your project use below reference. 

      <schema xmlns="">
         <import namespace="" schemaLocation="oramds:/apps/ApplicationComponents/BAM/LoggingBAM.xsd"/>


    Thats it guys.