Friday, November 15, 2013

In Part-1 , we created MFL file using format builder. In this post, I will show you how we can use  MFL in osb project to transform Non-XML data to XMl data.

First of all we will create xquery file which will map Non-XML data and XML data. Follow below steps to create Xquery file.

- Create XSD(Schema) file according to that XML structure that we need finally.



- In Xquery source side choose "Non-XML" radio button and choose Customer.mfl file.




- In Target Side choose "XML" radio button and choose above created schema.




- Perform the required mapping.




Now we will create a Business service to write XML file. You can follow my previous post to create the required business service.

Now we will create a proxy service that will read/poll the tab delimited file and pass this to above created business service. Follow below steps to create it.

- Choose "Messaging Service" as Service Type. Click Next.

- Choose "MFL" as Request Message type and browse Customer.mfl file.



- Fill all other required information, you can refer my previous post to see how to create proxy service to read/poll file.

- Now we will call Business service from proxy service, to do that go Message flow of proxy service and add route node. In the routing browse business service.




-Now in Request Action of Message Flow add assign activity, which will assign output of Xquery to a variable, we can not assign output of Xquery to Body variable, if we try to do then we will get below error.

Error: “Failed to set the value of context variable "body". Value must be an instance of {http://schemas.xmlsoap.org/soap/envelope/}Body.”

To assign xquery response to a variable, go to "XQuery Resources" tab and refer Xquery path and variable binding.






- Now we need to intilize the body variable to pass it to business servive, to do that add another assign activity and go to "Expression" tab and assign empty body to body variable.



- Now we will insert test variable to body variable, to do that ass Insert activity.




- Below is the final Message Flow of proxy service.




Test this by putting tab delimited file in read folder from where proxy service will read/poll that file. and we will final xml file in required format.


You may face below error while transforming Non-XML data to XML data, follow my next post to resolve that error.



3 comments :

  1. hello,
    could you please share the XSD file used?

    ReplyDelete
  2. how to do the same in jdeveloper 12c. If any one finds this please mail me on victoryhari at gmail dot com

    ReplyDelete
  3. Hi,

    Anyone got idea how to implement the same in 12c? please share.

    ReplyDelete