SlideShare a Scribd company logo
Mule Web Services
About Me
 Open Source: Mule, CXF/XFire,Abdera,Apache-*
 Exploring how to make building distributed services more
powerful/approachable/scalable/etc
 MuleSource http://mulesoft.com
Agenda
 Mule Overview
 Mule & web services
 Building web services integration
 The future
Overview
SOA Swiss Army Knife
 Supports a variety of service topologies including ESB
 Highly Scalable; using SEDA event model
 Asynchronous, Synchronous and Request/Response Messaging
 J2EE Support: JBI, JMS, EJB, JCA, JTA, Servlet
 Powerful event routing capabilities (based on EIP book)
 Breadth of connectivity; 60+ technologies
 Transparent Distribution
 Transactions; Local and Distributed (XA)
 Fault tolerance; Exception management
 Secure;Authentication/Authorization
Why do developers choose Mule?
No prescribed message format
 XML, CSV, Binary, Streams, Record, Java Objects
 Mix and match
Zero code intrusion
 Mule does not impose an API on service objects
 Objects are fully portable
Existing objects can be managed
 POJOs, IoC Objects, EJB Session Beans, Remote Objects
 REST / Web Services
Easy to test
 Mule can be run easily from a JUnit test case
 Framework provides a Test compatibility kit
 Scales down as well as up
Mule Node Architecture
Mule Topologies
Mule can be configured to implement any topology:
Enterprise Service Bus
Client/Server and Hub n' Spoke
Peer Network
Pipeline
Enterprise Service Network
Core Concepts: UMO Service
 UMO Services in Mule can be any object -
 POJOs, EJBs, Remote Objects,WS/REST Services
 A service will perform a business function and may rely on other
sources to obtain additional information
 Configured in Xml, or programmatically
 Mule Manages Threading, Pooling and resource management
 Managed via JMX at runtime
Core Concepts: Endpoints
 Used to connect components and external
systems together
 Endpoints use a URI for Addressing
 Can have transformer, transaction, filter, security
and meta-information associated
 Two types of URI
 scheme://[username][:password]@[host]
[:port]?[params]
 smtp://ross:pass@localhost:25
 scheme://[address]?[params]
 jms://my.queue?persistent=true
Core Concepts: Routers
 Control how events are sent and received
 Can model all routing patterns defined in the EIP Book
 Inbound Routers
 Idempotency
 Selective Consumers
 Re-sequencing
 Message aggregation
 Outbound Routers
 Message splitting / Chunking
 Content-based Routing
 Broadcasting
 Rules-based routing
 Load Balancing
Core Concepts: Transformers
Transformers
 Converts data from one format to another
 Can be chained together to form transformation pipelines
<jms:object-to-jms name="XmlToJms"/>
<custom-transformer name="CobolXmlToBusXml"
class="com.myco.trans.CobolXmlToBusXml"/>
<endpoint address="jms://trades"
transformers="CobolXmlToBusXml, XmlToJms"/>
Mule and Web Services
Bookstore
Publisher
Our scenario
Bookstore
Service
+ addBooks
+ getBooks
Bookstore
ClientBook list
(CSV)
Buyer
Bookstore
Client
Email order
confirmation
How?
 Mule provides
 File connector
 Email connector
 CXF connector
 What’s CXF?
 Successor to XFire
 Apache web services framework
 JAX-WS compliant
 SOAP, WSDL,WS-I Basic Profile
 WS-Addressing,WS-Security,WS-Policy,WS-
ReliableMessaging
How?
1. Build web service
2. Configure Mule server
3. Generate web service client
4. Build CSV->Book converter
5. Configure Mule with File inbound router and CXF
outbound router
6. Configure Mule with Email endpoint to confirm
orders
7. Send messages to email service from bookstore
Quick Intro to JAX-WS
 The standard way to build SOAP web services
 Supports code first web service building through
annotations
 Supports WSDL first through ant/maven/command
line tools
Building the Web Service
public interface Bookstore {
long addBook(Book book);
Collection<Long> addBooks(Collection<Book> books);
Collection<Book> getBooks();
}
Annotating the service
@WebService
public interface Bookstore {
long addBook(@WebParam(name="book") Book book);
@WebResult(name="bookIds")
Collection<Long> addBooks(
@WebParam(name="books") Collection<Book> books);
@WebResult(name="books")
Collection<Book> getBooks();
void placeOrder(@WebParam(name=“bookId”) long bookId,
@WebParam(name=“address”)String address,
@WebParam(name=“email”)String email)
}
Data Transfer Objects
public class Book {
get/setId
get/setTitle
get/setAuthor
}
Implementation
@WebService(serviceName="BookstoreService",
portName="BookstorePort“,
endpointInterface="org.mule.example.bookstore.Bookstore"
)
public class BookstoreImpl implements Bookstore {
…
}
Configuring Mule
<mule-descriptor name="echoService"
implementation="org.mule.example.bookstore.BookstoreImpl
">
<inbound-router>
<endpoint
address="cxf:http://localhost:8080/services/bookstore"/>
</inbound-router>
</mule-descriptor>
Starting Mule
 Web applications
 Embedded
 Spring
 Anywhere!
Main.main() – simplicity
 MuleXmlConfigurationBuilder builder = new
MuleXmlConfigurationBuilder();
 UMOManager manager =
builder.configure("bookstore.xml");
What happened?
Some notes about web services
 Be careful about your contracts!!!
 Don’t couple your web service too tightly (like this
example), allow a degree of separation
 This allows
 Maitainability
 Evolvability
 Versioning
 WSDL first helps this
The Publisher
 Wants to read in CSV and publish to web service
 Use a CXF generated client as the “outbound router”
 CsvBookPublisher converts File to List<Book>
 Books then get sent to outbound router
Our implementation
public class CsvBookPublisher {
public Collection<Book> publish(File file)
throws IOException {
…
}
}
Domain objects are the Messages
 File
 Book
 Title
 Author
 Access can be gained to raw UMOMessage as well
Generating a client
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.0.2-incubator</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>
${basedir}/target/generated/src/main/java
</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>
http://localhost:8080/services/bookstore?wsdl
</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
Our configuration
<mule-descriptor name="csvPublisher"
implementation="org.mule.example.bookstore.publisher.CsvBookPublisher"
singleton="true">
<inbound-router>
<endpoint address="file://./books?
pollingFrequency=100000&amp;autoDelete=false"/>
</inbound-router>
<outbound-router>
<router className="org.mule.routing.outbound.OutboundPassThroughRouter">
…
</router>
</outbound-router>
</mule-descriptor>
Outbound router configuration
<router className="org.mule.routing.outbound.OutboundPassThroughRouter">
<endpoint address="cxf:http://localhost:8080/services/bookstore">
<properties>
<property name="clientClass"
value="org.mule.example.bookstore.BookstoreService"/>
<property name="wsdlLocation"
value="http://localhost:8080/services/bookstore?wsdl"/>
<property name="port" value="BookstorePort"/>
<property name="operation" value="addBooks"/>
</properties>
</endpoint>
</router>
Start it up!
Email Integration
BookstorePlace
Order
Order (Book,
Email,
Address)
Order to email
transformer
Object to Message
transformer
SMTP endpoint
Endpoint Configuration
<global-endpoints>
<endpoint name="orderEmailService"
address="smtps://username:password@hostname"
transformers="OrderToEmail ObjectToMimeMessage">
<properties>
<property name="fromAddress"
value="bookstore@mulesource.com" />
<property name="subject“
value="Your order has been placed!" />
</properties>
</endpoint>
</global-endpoints>
Transformers
<transformers>
<transformer name="OrderToEmail"
className="org.mule.example.bookstore.OrderToEmailTransformer"/>
<transformer name="ObjectToMimeMessage"
className="org.mule.providers.email.transformers.ObjectToMimeMessage"/>
</transformers>
Sending the Message
public void orderBook(long bookId, String address, String email) {
// In the real world we'd want this hidden behind
// an OrderService interface
try {
Book book = books.get(bookId);
MuleMessage msg = new MuleMessage(
new Object[] { book, address, email} );
RequestContext.getEventContext().dispatchEvent(
msg, "orderEmailService");
System.out.println("Dispatched message to orderService.");
} catch (UMOException e) {
// If this was real, we'd want better error handling
throw new RuntimeException(e);
}
}
Questions?

More Related Content

PPT
Mule enterprise service bus
PPT
Mule overview
 
PPTX
WSDL in Mule Esb
PPTX
Muletransformers
PPTX
Mule JMS Transport
PPT
Mule overview
PPTX
Anypoint mq queues and exchanges
Mule enterprise service bus
Mule overview
 
WSDL in Mule Esb
Muletransformers
Mule JMS Transport
Mule overview
Anypoint mq queues and exchanges

What's hot (18)

PPT
Mule and web services
PPT
Mule overview
PPTX
Mule enricher component
PPT
Mule esb introduction
PPT
Mulesoft ppt
PPTX
Rabbit mq in mule
PPTX
Mule esb
PPTX
Mule TCP Component
PPTX
Mule Message Chunk Aggregator
PDF
Spring integration
PPT
Mule overview-ppt
PPTX
Mule splitters
PPTX
Mule concepts components
PPTX
Mule rabbitmq
PPTX
Mule threading profile & processing strategy
PPTX
PPTX
Message processor in mule
PPTX
Mule: Java Component
Mule and web services
Mule overview
Mule enricher component
Mule esb introduction
Mulesoft ppt
Rabbit mq in mule
Mule esb
Mule TCP Component
Mule Message Chunk Aggregator
Spring integration
Mule overview-ppt
Mule splitters
Mule concepts components
Mule rabbitmq
Mule threading profile & processing strategy
Message processor in mule
Mule: Java Component
Ad

Similar to Mule web services (20)

PPT
Mule and web services
PDF
Mule ESB
PPTX
Mule esb
PPT
Service Oriented Development With Windows Communication Foundation 2003
PPT
ESB introduction using Mule
PPTX
Real world #microservices with Apache Camel, Fabric8, and OpenShift
PPTX
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
PPT
Mule overview
PDF
EIP In Practice
PPT
Presentation
PDF
Service-Oriented Integration With Apache ServiceMix
ODP
Mule Complete Training
PDF
Webservices in SalesForce (part 1)
PPT
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
PPT
Introduction to es bs mule
PPT
Introduction to mule esb's
 
PPT
Introduction to esbs mule
PPTX
The Middleware technology that connects the enterprise
PPTX
Mule getting started
PPTX
Web services101
Mule and web services
Mule ESB
Mule esb
Service Oriented Development With Windows Communication Foundation 2003
ESB introduction using Mule
Real world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Mule overview
EIP In Practice
Presentation
Service-Oriented Integration With Apache ServiceMix
Mule Complete Training
Webservices in SalesForce (part 1)
Messaging - RabbitMQ, Azure (Service Bus), Docker and Azure Functions
Introduction to es bs mule
Introduction to mule esb's
 
Introduction to esbs mule
The Middleware technology that connects the enterprise
Mule getting started
Web services101
Ad

More from Thang Loi (20)

PPTX
File connector
PPTX
Box connector
PPTX
Amazon S3 connector
PPTX
Mule flows and subflows
PPTX
Http connector
PPTX
Tcat server
PPTX
File Connector
PPTX
Mule transform
PPTX
Fpt connector
PPTX
Mule transformers
PPTX
Http connector
PPTX
Mule mongodb connector
PPTX
Mule message state
PPTX
Mule transformers
PPTX
Elements in a muleflow
PPTX
Mule maven
PPTX
Mule soap
PPT
Mule schedule
PPTX
Mule flows
PPTX
Mule concepts
File connector
Box connector
Amazon S3 connector
Mule flows and subflows
Http connector
Tcat server
File Connector
Mule transform
Fpt connector
Mule transformers
Http connector
Mule mongodb connector
Mule message state
Mule transformers
Elements in a muleflow
Mule maven
Mule soap
Mule schedule
Mule flows
Mule concepts

Recently uploaded (20)

PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Approach and Philosophy of On baking technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
cuic standard and advanced reporting.pdf
PPT
Teaching material agriculture food technology
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Electronic commerce courselecture one. Pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Machine learning based COVID-19 study performance prediction
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Network Security Unit 5.pdf for BCA BBA.
Approach and Philosophy of On baking technology
Encapsulation_ Review paper, used for researhc scholars
Diabetes mellitus diagnosis method based random forest with bat algorithm
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
20250228 LYD VKU AI Blended-Learning.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
cuic standard and advanced reporting.pdf
Teaching material agriculture food technology
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Electronic commerce courselecture one. Pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Machine learning based COVID-19 study performance prediction
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
MYSQL Presentation for SQL database connectivity
The Rise and Fall of 3GPP – Time for a Sabbatical?
Building Integrated photovoltaic BIPV_UPV.pdf

Mule web services

Editor's Notes

  • #10: Components, Endpoints, Lets look at the Xml for a component