SlideShare a Scribd company logo
1 of 16
HowTo – Wrap SOAP web
service around a database
• We recently introduced our HowTo blog series, which is designed to
present simple use-case tutorials to help you as you evaluate
Anypoint Platform. This first blog in Series 1 will show you how to
insulate your backend systems like databases by exposing a system
API using SOAP over HTTP. The principle behind this approach is our
API led connectivity methodology, which is an evolution of SOA.
• For years, most organizations have tightly coupled their front end
applications with the backend enterprise systems like ERP and
databases. The logic to access and process data from backend
systems is baked directly into these front end applications. If there is
any change in the backend system, it turns into a very costly exercise
to propagate that change to each dependent application.
• Therefore, there is a need to insulate these enterprise systems and provide
an abstraction layer using a system level API. Having a system API
decouples the front end consuming applications from interface changes in
the backend enterprise systems, exposes information in your business
specific semantics and provides flexibility to make changes with less
impact. Although some systems like SaaS applications do have vendor
provided APIs, having a system API layer still allows the user to abstract the
complexity of these vendor APIs. These APIs will be highly reusable for
different integrations, will change more infrequently and will be governed
by Central IT given the importance of the underlying systems. As a best
practice, we first define the API contract (in this case, for a SOAP interface,
so we’ll use a WSDL) before implementing the API. This approach helps to
decouple the consumers of the API from the provider to speed
development, provide reusability of assets like schemas, security schemes,
and transport resources and help with versioning of the APIs.
Pre-requisites:
• Anypoint Platform – MuleSoft Anypoint Studio.
• WSDL created with Eclipse editor. The eclipse plugin installed into
Mulesoft Anypoint Studio.
• SOAP UI for testing.
• A database where we can create and load a sample table required for
this project. In this example, we will use an instance of the MySQL
database.
• The Mule project downloadable from Anypoint Exchange.
• To follow the example in this guide, run the SQL script loan.sql to set up
the table and load it with some sample data. You will find the loan.sql file
in the project under the folder src/main/resources
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.
• Here is more information to understand Mule configuration.
• Copy the schema and WSDL for loan service in the following directory path
of the project, loan_system_api /src/main/resources
• Add HTTP endpoint to the Mule configuration file. Dropping the HTTP
endpoint on the canvas will automatically create a flow (What is a mule
flow?). In the HTTP endpoint properties tab below click on connector
configuration.
• Configure as below and click Ok.
• Add value “loan” to the path variable
in HTTP property.
• Add the CXF component to the
flow.
• (Here is more detail on the CXF
component.)
• Change the configurations for the
CXF component to match the
parameter from the WSDL. Add the
WSDL location in the advanced tab.
• 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.)
• To parse the XML, SOAP request message switch to the Configuration XML
view and add the following.
• Add the database connector to look up the table.
• 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")]
• Add a logger component. Configure the metadata of the logger
component with the schema object of the SOAP response message.
This is done to assist with data mapping in the next step.
• Add the component “Transform Message” in between the database
connector and logger (Here is more detail on Transform Message).
• To see all the fields click the button to show the scaffold output
structure.
• Map the response from the database connector to the SOAP
response message.
• Right-click the project and choose the run as “Mule Application”
option. This will run the project in Anypoint Studio embedded Mule
runtime.
• Start SOAP UI and create a new project. Add a new WSDL and enter
the link as follows: http://localhost:8081/bank/loan?wsdl
• Run the request and check the response.
• We have now successfully created a system API in front of a database,
thus decoupling it from the user requesting the data.
To create this system API we have leveraged the
following features of the Anypoint Platform:
• Open standards support i.e. full support for WS* standards and open
source services framework like Apache CXF.
• Drag and drop and configure the CXF components that speed up
development.
• Database Connector: Allows you to connect to almost any relational
database.
• DataSense uses message metadata to facilitate application design.
• Mule Expression Language (MEL): Lightweight Mule-specific expression
language that can be used to access/evaluate the data in the payload.
• Transformers/DataWeave: A simple, powerful way to query and
transform data using the platform.
• We have seen a growing need for APIs emerging from new business
processes, applications, devices, and interfaces. These requirements
from several consumers, it becomes necessary to define a lightweight
and easy to consume REST API.

More Related Content

What's hot

Mule ESB
Mule ESBMule ESB
Mule ESB
niravn
 

What's hot (19)

Mule esb 3.8
Mule esb 3.8Mule esb 3.8
Mule esb 3.8
 
Developing Oracle Connector Using Mule
Developing Oracle Connector Using MuleDeveloping Oracle Connector Using Mule
Developing Oracle Connector Using Mule
 
Mule message structure
Mule message structureMule message structure
Mule message structure
 
Get Queue List from Microsoft Azure using Mule ESB
Get Queue List from Microsoft Azure using Mule ESBGet Queue List from Microsoft Azure using Mule ESB
Get Queue List from Microsoft Azure using Mule ESB
 
Mule ESB
Mule ESBMule ESB
Mule ESB
 
Cloud hub and mule
Cloud hub and muleCloud hub and mule
Cloud hub and mule
 
Shipping your logs to elk from mule app/cloudhub part 1
Shipping  your logs to elk from mule app/cloudhub   part 1Shipping  your logs to elk from mule app/cloudhub   part 1
Shipping your logs to elk from mule app/cloudhub part 1
 
Troubleshooting mule
Troubleshooting muleTroubleshooting mule
Troubleshooting mule
 
Mule and web services
Mule and web servicesMule and web services
Mule and web services
 
Mule any pointstudio
Mule any pointstudioMule any pointstudio
Mule any pointstudio
 
Email configuration in mule esb
Email configuration in mule esbEmail configuration in mule esb
Email configuration in mule esb
 
A Workhorse Named Mule
A Workhorse Named MuleA Workhorse Named Mule
A Workhorse Named Mule
 
Mule
MuleMule
Mule
 
Mulesoft Consuming Web Service - Web Service Consumer
Mulesoft Consuming Web Service - Web Service ConsumerMulesoft Consuming Web Service - Web Service Consumer
Mulesoft Consuming Web Service - Web Service Consumer
 
MuleSoft CloudHub FAQ
MuleSoft CloudHub FAQMuleSoft CloudHub FAQ
MuleSoft CloudHub FAQ
 
Anypoint platform architecture and components
Anypoint platform architecture and componentsAnypoint platform architecture and components
Anypoint platform architecture and components
 
Mule ESB session day 1
Mule ESB session day 1Mule ESB session day 1
Mule ESB session day 1
 
Mule architecture
Mule   architectureMule   architecture
Mule architecture
 
Working of mule
Working of muleWorking of mule
Working of mule
 

Similar to How to – wrap soap web service around a database

Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptxTransform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
kmani5
 
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).pptTransform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
HusseinWassof
 
Migrating Very Large Site Collections (SPSDC)
Migrating Very Large Site Collections (SPSDC)Migrating Very Large Site Collections (SPSDC)
Migrating Very Large Site Collections (SPSDC)
kiwiboris
 

Similar to How to – wrap soap web service around a database (20)

How to – rest api proxy to soap webservice
How to – rest api proxy to soap webserviceHow to – rest api proxy to soap webservice
How to – rest api proxy to soap webservice
 
Mule connectors-session1
Mule connectors-session1Mule connectors-session1
Mule connectors-session1
 
Mule connectors-part 1
Mule connectors-part 1Mule connectors-part 1
Mule connectors-part 1
 
Muleesbcomponents1 160625154208
Muleesbcomponents1 160625154208Muleesbcomponents1 160625154208
Muleesbcomponents1 160625154208
 
MuleSoft Surat Virtual Meetup#27 - MuleSoft Runtime 4.4, Transit Gateway and ...
MuleSoft Surat Virtual Meetup#27 - MuleSoft Runtime 4.4, Transit Gateway and ...MuleSoft Surat Virtual Meetup#27 - MuleSoft Runtime 4.4, Transit Gateway and ...
MuleSoft Surat Virtual Meetup#27 - MuleSoft Runtime 4.4, Transit Gateway and ...
 
DevOps with Elastic Beanstalk - TCCC-2014
DevOps with Elastic Beanstalk - TCCC-2014DevOps with Elastic Beanstalk - TCCC-2014
DevOps with Elastic Beanstalk - TCCC-2014
 
Data Base Connector
Data Base Connector Data Base Connector
Data Base Connector
 
SOA_BPM_12c_launch_event_SOA_track_deepdive_developerproductivityandperforman...
SOA_BPM_12c_launch_event_SOA_track_deepdive_developerproductivityandperforman...SOA_BPM_12c_launch_event_SOA_track_deepdive_developerproductivityandperforman...
SOA_BPM_12c_launch_event_SOA_track_deepdive_developerproductivityandperforman...
 
Mule ESB Components
Mule ESB Components Mule ESB Components
Mule ESB Components
 
My Saminar On Php
My Saminar On PhpMy Saminar On Php
My Saminar On Php
 
Making Rational HATS a Strategic Investment
Making Rational HATS a Strategic InvestmentMaking Rational HATS a Strategic Investment
Making Rational HATS a Strategic Investment
 
Sca
ScaSca
Sca
 
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptxTransform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx
 
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).pptTransform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
Transform-to-Smart-ERP-using-Custom-Mobile-Apps.pptx (3).ppt
 
Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)
 
Web services
Web servicesWeb services
Web services
 
Full lifecycle of a microservice
Full lifecycle of a microserviceFull lifecycle of a microservice
Full lifecycle of a microservice
 
Migrating Very Large Site Collections (SPSDC)
Migrating Very Large Site Collections (SPSDC)Migrating Very Large Site Collections (SPSDC)
Migrating Very Large Site Collections (SPSDC)
 
Cloud Foundry Technical Overview
Cloud Foundry Technical OverviewCloud Foundry Technical Overview
Cloud Foundry Technical Overview
 
Integration of mule esb with microsoft azure
Integration of mule esb with microsoft azureIntegration of mule esb with microsoft azure
Integration of mule esb with microsoft azure
 

More from Son Nguyen

More from Son Nguyen (20)

Your new maven friend – the mule maven
Your new maven friend – the mule mavenYour new maven friend – the mule maven
Your new maven friend – the mule maven
 
Soa governance for the modern business
Soa governance for the modern businessSoa governance for the modern business
Soa governance for the modern business
 
Quality sdk for your apis in minutes!
Quality sdk for your apis in minutes!Quality sdk for your apis in minutes!
Quality sdk for your apis in minutes!
 
Maven tools & archetypes
Maven tools & archetypesMaven tools & archetypes
Maven tools & archetypes
 
Let api change your relationship with your doctor
Let api change your relationship with your doctorLet api change your relationship with your doctor
Let api change your relationship with your doctor
 
Increase revenue and reinvigorate your business with api
Increase revenue and reinvigorate your business with apiIncrease revenue and reinvigorate your business with api
Increase revenue and reinvigorate your business with api
 
Anypoint runtime manager v1
Anypoint runtime manager v1Anypoint runtime manager v1
Anypoint runtime manager v1
 
A good api strategy can help turn your
A good api strategy can help turn yourA good api strategy can help turn your
A good api strategy can help turn your
 
10 steps to design and build the perfect
10 steps to design and build the perfect10 steps to design and build the perfect
10 steps to design and build the perfect
 
What is the difference between using private flow
What is the difference between using private flowWhat is the difference between using private flow
What is the difference between using private flow
 
Real time data processing with anypoint connector for kafka
Real time data processing with anypoint connector for kafkaReal time data processing with anypoint connector for kafka
Real time data processing with anypoint connector for kafka
 
Performance tuning in mule
Performance tuning in mulePerformance tuning in mule
Performance tuning in mule
 
Mule intelli j tips
Mule intelli j tipsMule intelli j tips
Mule intelli j tips
 
Introducing the anypoint connector for redis
Introducing the anypoint connector for redisIntroducing the anypoint connector for redis
Introducing the anypoint connector for redis
 
How to – data integrity checks in batch processing
How to – data integrity checks in batch processingHow to – data integrity checks in batch processing
How to – data integrity checks in batch processing
 
How soa paved the way for cloud
How soa paved the way for cloudHow soa paved the way for cloud
How soa paved the way for cloud
 
Mq user and role access
Mq user and role accessMq user and role access
Mq user and role access
 
Anypoint mq queues and exchanges
Anypoint mq queues and exchangesAnypoint mq queues and exchanges
Anypoint mq queues and exchanges
 
Anypoint mq acknowledgement mode
Anypoint mq acknowledgement modeAnypoint mq acknowledgement mode
Anypoint mq acknowledgement mode
 
Deploying to cloud hub
Deploying to cloud hubDeploying to cloud hub
Deploying to cloud hub
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
API Governance and Monetization - The evolution of API governance
API Governance and Monetization -  The evolution of API governanceAPI Governance and Monetization -  The evolution of API governance
API Governance and Monetization - The evolution of API governance
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern Enterprise
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 

How to – wrap soap web service around a database

  • 1. HowTo – Wrap SOAP web service around a database
  • 2. • We recently introduced our HowTo blog series, which is designed to present simple use-case tutorials to help you as you evaluate Anypoint Platform. This first blog in Series 1 will show you how to insulate your backend systems like databases by exposing a system API using SOAP over HTTP. The principle behind this approach is our API led connectivity methodology, which is an evolution of SOA.
  • 3. • For years, most organizations have tightly coupled their front end applications with the backend enterprise systems like ERP and databases. The logic to access and process data from backend systems is baked directly into these front end applications. If there is any change in the backend system, it turns into a very costly exercise to propagate that change to each dependent application.
  • 4.
  • 5. • Therefore, there is a need to insulate these enterprise systems and provide an abstraction layer using a system level API. Having a system API decouples the front end consuming applications from interface changes in the backend enterprise systems, exposes information in your business specific semantics and provides flexibility to make changes with less impact. Although some systems like SaaS applications do have vendor provided APIs, having a system API layer still allows the user to abstract the complexity of these vendor APIs. These APIs will be highly reusable for different integrations, will change more infrequently and will be governed by Central IT given the importance of the underlying systems. As a best practice, we first define the API contract (in this case, for a SOAP interface, so we’ll use a WSDL) before implementing the API. This approach helps to decouple the consumers of the API from the provider to speed development, provide reusability of assets like schemas, security schemes, and transport resources and help with versioning of the APIs.
  • 6. Pre-requisites: • Anypoint Platform – MuleSoft Anypoint Studio. • WSDL created with Eclipse editor. The eclipse plugin installed into Mulesoft Anypoint Studio. • SOAP UI for testing. • A database where we can create and load a sample table required for this project. In this example, we will use an instance of the MySQL database. • The Mule project downloadable from Anypoint Exchange. • To follow the example in this guide, run the SQL script loan.sql to set up the table and load it with some sample data. You will find the loan.sql file in the project under the folder src/main/resources
  • 7. 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. • Here is more information to understand Mule configuration. • Copy the schema and WSDL for loan service in the following directory path of the project, loan_system_api /src/main/resources • Add HTTP endpoint to the Mule configuration file. Dropping the HTTP endpoint on the canvas will automatically create a flow (What is a mule flow?). In the HTTP endpoint properties tab below click on connector configuration.
  • 8. • Configure as below and click Ok.
  • 9. • Add value “loan” to the path variable in HTTP property.
  • 10. • Add the CXF component to the flow. • (Here is more detail on the CXF component.)
  • 11. • Change the configurations for the CXF component to match the parameter from the WSDL. Add the WSDL location in the advanced tab.
  • 12. • 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.) • To parse the XML, SOAP request message switch to the Configuration XML view and add the following. • Add the database connector to look up the table. • 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")]
  • 13. • Add a logger component. Configure the metadata of the logger component with the schema object of the SOAP response message. This is done to assist with data mapping in the next step. • Add the component “Transform Message” in between the database connector and logger (Here is more detail on Transform Message). • To see all the fields click the button to show the scaffold output structure. • Map the response from the database connector to the SOAP response message.
  • 14. • Right-click the project and choose the run as “Mule Application” option. This will run the project in Anypoint Studio embedded Mule runtime. • Start SOAP UI and create a new project. Add a new WSDL and enter the link as follows: http://localhost:8081/bank/loan?wsdl • Run the request and check the response. • We have now successfully created a system API in front of a database, thus decoupling it from the user requesting the data.
  • 15. To create this system API we have leveraged the following features of the Anypoint Platform: • Open standards support i.e. full support for WS* standards and open source services framework like Apache CXF. • Drag and drop and configure the CXF components that speed up development. • Database Connector: Allows you to connect to almost any relational database. • DataSense uses message metadata to facilitate application design. • Mule Expression Language (MEL): Lightweight Mule-specific expression language that can be used to access/evaluate the data in the payload. • Transformers/DataWeave: A simple, powerful way to query and transform data using the platform.
  • 16. • We have seen a growing need for APIs emerging from new business processes, applications, devices, and interfaces. These requirements from several consumers, it becomes necessary to define a lightweight and easy to consume REST API.