Expose a DataBase through SOAP over HTTP Kunal Mittal Integration Expert – Integration COE Sankar Santosh kenguva Practice Manager - Integration
Expose a DataBase through SOAP over HTTP
Kunal MittalIntegration Expert – Integration COE
Sankar Santosh kenguvaPractice Manager - Integration
Agenda
❖Introduction
❖Pre-requisites
❖Apache CXF
❖CXF Component in Mule
❖Simple Use Case
❖Conclusion
Introduction
● The principle behind this approach is our API LedConnectivity Methodology , which is an evolution of SOA.
● For years, most organizations have tightly coupled their frontend applications with the backend enterprise systemslike ERP and databases. The logic to access and process datafrom backend systems is baked directly into these front endapplications. If there is any change in the backend system, itturns into a very costly exercise to propagate that change toeach dependent application
Pre-requisites
❖ MuleSoft Anypoint Studio
❖ Database like MySQL, DB2, Oracle DB
❖ Soap-UI for Testing
Apache CXF
• Apache CXF is an open source services framework. CXF helps
you build and develop services using frontend programming
APIs, like JAX-WS and JAX-RS. These services can speak a variety
of protocols such as SOAP, XML/HTTP, Restful HTTP, or CORBA
and work over a variety of transports such as HTTP, JMS or JBI.
• CXF is often used with Apache Servicemix, Apache
Camel and Apache ActiveMQ in service-oriented architecture
(SOA) infrastructure projects
CXF Component In Mule
The Mule CXF module provides support for web service integration via Apache CXF. Apache CXF is an open source services framework that helps you build and develop services using front-end programming APIs, like JAX-WS.
The CXF Component was formerly known as the SOAP Connector.
Steps :
• Start MuleSoft Anypoint Studio and point to a new workspace.
• Create a new project. File -> New -> Mule Project
• Give a name to the project and click finish. You will see the mule configuration file where we can now add the Mule flows.
• Copy the schema and WSDL for loan service in the following directory path of the project, Project-Name/src/main/resources
• Add HTTP endpoint to the Mule configuration file. Dropping the HTTP endpoint on the canvas will automatically create a flow
• In the HTTP endpoint properties tab below click on connector configuration.
Step 4 :
Change the configurations for the CXF component to match the parameter from the WSDL. Add the WSDL location in the advanced tab.
Step 5 :
Add transformer “Dom to XML”.(Note: This transformer will convert the org.w3c.dom.Document object to XML message. This way we can apply XPath expressions to extract various values from the incoming message payload.)
❖ Configure the database with all the parameters.
❖ Configure the database connector property with the following select query by using the XPath query to extract the input parameter from the request payload.select * from loan where loan_id = #[xpath3("sch:getLoanRequest/sch:loanId")]
Step 7:
Start SOAP-UI and create a new project. Add a new WSDL and enter the link as follows: http://localhost:8081/bank/loan?wsdlRun the request and check the response