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

Thursday, 13 July 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 -

CustomerID;Firstname;Lastname;Age
1212;Dheeraj;Mishra;25
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.

Implementation:

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"?>
<CSVToXML>
  <Customer>
    <customerId>CustomerID</customerId>
    <firstName>Firstname</firstName>
    <lastName>Lastname</lastName>
    <age>Age</age>
  </Customer>
  <Customer>
    <customerId>1212</customerId>
    <firstName>Dheeraj</firstName>
    <lastName>Mishra</lastName>
    <age>25</age>
  </Customer>
  <Customer>
    <customerId>3242</customerId>
    <firstName>Ajay Kumar</firstName>
    <lastName>Singh</lastName>
    <age>43</age>
  </Customer>
</CSVToXML>



Download the sample osb jar file from below link
https://drive.google.com/open?id=0BxHj0h0tnxxObDkzT2FCNUN6aEE




Thursday, 4 May 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.
                                                              
<soap:Header>
                <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                                <wsse:UsernameToken wsu:Id="UsernameToken-F7A4A73DA710AE195C14938940405155">
                                                <wsse:Username>dheeraj</wsse:Username>
                                                <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">webic123</wsse:Password>
                                                <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">T36cJsRsgb5IzQyyy/Yskw==</wsse:Nonce>
                                                <wsu:Created>2017-05-04T10:34:00.515Z</wsu:Created>
                                </wsse:UsernameToken>
                </wsse:Security>
</soap:Header>






That’s all.




Friday, 9 December 2016

OSB-382032: The message must be an instance of: {http://www.w3.org/2003/05/soap-envelope}Envelope

The error could be as seen below :

<soap:Text  xml:lang="en">
OSB-382032: The message must be an instance of: {http://www.w3.org/2003/05/soap-envelope}Envelope
</soap:Text>
</soap:Reason>
<soap:Detail>
<con:stack-trace  xmlns:con="http://www.bea.com/wli/sb/context">
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)


Analysis:
This issue comes when you are invoking a SOAP 1.2 web service.
The request you sent, to service must have namespace declaration with
http://www.w3.org/2003/05/soap-envelope

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 "http://www.w3.org/2003/05/soap-envelope" as the envolope namespace and SOAP 1.1 uses "http://schemas.xmlsoap.org/soap/envelope/".

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="http://www.w3.org/2003/05/soap-envelope">

<soapenv:Header  xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
</soapenv:Header>
<soapenv:Body  xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<get:string  xmlns:get="http://xmlns.oracle.com/OSB_App_Jaguar/Santa/GetSantaDetails"></get:string>
</soapenv:Body>
</soapenv:Envelope>

Tuesday, 8 November 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:158.151.155.53:[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(AppClassLoaderManagerImpl.java:154)
        at weblogic.common.internal.ProxyClassResolver.resolveProxyClass(ProxyClassResolver.java:68)
        at weblogic.common.internal.WLObjectInputStream.resolveProxyClass(WLObjectInputStream.java:76)
        at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1531)
        at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1493)
        Truncated. see log file for complete stacktrace


Reason:
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.


Solution:
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, 22 June 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.



STEP 2:

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.

STEP 3:


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.


STEP 4:

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

STEP 5:
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 

 <metadata-namespaces>
          <namespace metadata-store-usage="mstore-usage_1" path="/soa/shared"/>
          <namespace metadata-store-usage="mstore-usage_2" path="/apps"/>
 </metadata-namespaces>
    <metadata-store-usages>
        <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>
        </metadata-store-usage>
        <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"/>
             </metadata-store>
        </metadata-store-usage>
    </metadata-store-usages>
    



    Note:
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
       path="/apps/SOASchema" 

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. 

<wsdl:types>
      <schema xmlns="http://www.w3.org/2001/XMLSchema">
         <import namespace="http://xmlns.example.com/unique/default/namespace/1103228635369" schemaLocation="oramds:/apps/ApplicationComponents/BAM/LoggingBAM.xsd"/>
      </schema>

   </wsdl:types>





    Thats it guys. 

Sunday, 21 July 2013

Oracle Service Bus 11g - Domain Configuration for Windows

Here I am gonna discuss Domain Configuration for Oracle Service Bus 11g for windows PC.

As we have already installed Oracle Service Bus 11g
For Details visit

Oracle Service Bus 11g - Installation for Windows 32 bit

http://osb-dheeraj.blogspot.in/2013/07/oracle-service-bus-11g-installation-for.html

now we will be moving forward with Domain Configuration.

Step 1 : 

Locate the OSB Home directory Inside Middleware Home, and move to directory:  \Oracle\Middleware\OSB_Home\common\bin

Inside the Bin Directory, you will find config.cmd file. Open it either by Double clicking on or by using command Prompt.

Choose the Option "Create new WebLogic Domain" Then click next


Step 2 :

Choose Oracle service Bus , it will also select few other required products.
You can also select other products as per your requirement.


Click next

Step 3 :

Provide name of Domain and Location of Domain Directory.
Oracle Recommend a separate Domain Directory from Fusion Middleware installation Directory.


Click next

Step 4 :

Provide Username and Password for Domain administrator


Click next


Step 5 :

Choose your JDK version available. For production environment JRockit is reccomended.


Click next

Step 6 : 

Select the "OSB JMS Reporting Provider "
It will choose default derby evaluation Database included with Weblogic.


if you want your separate database, then you need to install any Oracle DB compatible database and create schemas using Repository Creation utility (RCU), and Provide those details here.
I will Discuss the steps for running RCU in separate Post.

Click next

Step 7 :

Configuration utility will verify Connection with Schema as provided in next screen and will show the status here.
Since we have chosen Derby Evaulation DB and it is not running now, So the test result will be Failed.
When we start the Admin server later it will automatically start the Derby DB.


Click next, it will show you an error Popup, click Ok to byepass the test.

Step 8 :

Now choose Adinistration Server and Managed server, in this screen.


Click next

Step 9 :

Give name to Admin server and Port no. (Please check the port is not assigned to any other service in your PC).


Click next

Step 10 :

Provide name and port no. for the Managed server here


Click next

Step 11 :

Since our installtion is on single physical machine, so we need not to configure cluster.
Leave default and click next




Step 12 :

Click on 'add machine'
Provide details of machine eg name and address.


Click next


Step 13 :

Assign servers to Machine by clicking arrow button available on centre column. This will be used by NodeManager to start and stop servers remotedly.


Click next


Step 14 :

Verify the summary details for this new Domain. Then click Create.


 This will start domain configuration.


Make note of admin server URL and click Done.





This will finish the Domain Configuration of OSB 11g.
Now in order to start development, we need to start the Admin and managed server, which we have created here.

The process of starting and stopping Admin and Managed server, I will discuss in my next Post.


Wednesday, 3 July 2013

Oracle Service Bus 11g - Installation for Windows 32 bit

Hi All,

Here I am discussing Installation of Oracle Service Bus 11g, in windows 32 bit machine.
First quesstion comes to mind is, What all do we need ?
Answer is pretty simple:

A windows 32 Bit PC with
1. 300 Mhz or Faster Processor(I'm sure , you have it)
2. 2 GB of RAM
3. 5 GB of Hard Disk Space
4. 500 MB or More SWAP and TEMP space.



In order to install, we need to download few packages :
1. Oracle WebLogic Server 11gR1 (10.3.6) + Coherence + OEPE - Package Installer
2. Oracle Service Bus
 from location  http://www.oracle.com/technetwork/middleware/service-bus/downloads/index.html


Download and Extract these files into a directory.



Now, First of all we need to install Weblogic server 11g.
Step 1: Now start the weblogic installer by double clicking on it. Since setup is large, keep patience, it will take some time to start.


After this screen a new screen will appear,


Click next, new screen will appear like,



 Here choose the Middleware Home Directory and Click Next


Deselect security update if installing for learning purposes, or provide oracle support password if you have purchased the oracle support..
 Then click Next

Choose Custom, and click next


Choose Server Example, if you are installing for learning purpose. Else leave the default values.
Then Click next

Leave Default for this Page.
Click Next

Review the Installation Directories, Make a note of these.
Click Next

Click on Yes, to install Node Manager. It will help in Remote start and Stop and health monitoring of Managed servers.


Choose the users here as per your requirement.
Click Next

Review the Installtion summary here.
Then click Next

Installation will begin, and you can see the progress in terms of percentage.


Deselect Run Quickstart. Then Click on Done.
Step 1 is Completed.
Now we have to install OSB 11g.

Step 2: 
Go to the Directory where you have Extracted the OSB setup.
 it will be something like - "ofm_osb_generic_11.1.1.7.0_disk1_1of1"
go inside Disk1 Directory. There you will find a setup.exe file
Copy the Path of setup.exe file.

Now open the command prompt. and move to directory of setup.exe


now write the command
"setup.exe -jreLoc E:\Oracle\Middleware\jdk160_29\jre"
press Enter.
Where "E:\Oracle\Middleware\jdk160_29\jre" is the path of JRE installed with the Weblogic, which we have done in step 1.



Now, setup will start. You will show a window like


 Click on Next



Click on 'skip software update'. If you have purchased the Oracle licences then provide username and password to search for update.

Click Next

Now browse The Middleware  Home directory, which was created in step 1, while installing Weblogic server.
Then Click Next

Choose Custom.
Click next



Select 'Oracle service bus IDE' to use the OEPE(Eclipse IDE for developement).
Select 'Oracle service bus example' if you are a new learner of OSB.

Click Next
 Setup will check some prerequisites here.
click Next

Browse the path for Weblogic server and OEPE, which we have installed in step 1.
 Then click next

Review the Summary of installation here. You can also save the response file here.
The response file are used for silent installation of product.
 Click Install

Now your Installation is started.You can see the progress here. Click Next

Click Next


Click on Finish.

The Installation of Oracle Service Bus is Finished.

In order to use the OSB, you will need to configure the OSB Domain.
I will describe the process of Domain configuration in my next Post "Oracle Service Bus 11g - Domain Configuration". You can find it here

Oracle Service Bus 11g - Domain Configuration for Windows

http://osb-dheeraj.blogspot.in/2013/07/oracle-service-bus-11g-domain.html