Académique Documents
Professionnel Documents
Culture Documents
Alef Arendsen
Interface21
Some questions
Who has built (SOAP) web services?
<<reserve flight>
Airline
reservation portal <<kicks off process>>
<<reserve flight>
Orchestrator
Airline / ESB
reservation portal
1 2 3 4
Frequent
Flight Meal
Billing flyers
reservations ordering
miles
Flight reservation system
public interface AirlineService {
List getFlightsInPeriod(
Calendar startOfPeriod,
Calendar endOfPeriod);
Reservation bookFlight(
String flightNumber,
long customerId);
}
Web services – exposing service objects
Service objects
List getFlightsInPeriod(
Calendar startOfPeriod,
Calendar endOfPeriod);
VERSUS
Flight[] getFlightsInPeriod(
Calendar startOfPeriod,
Calendar endOfPeriod);
Exposing services with XFire (1)
XFire
Next generation SOAP stack
Less mature than Axis
More open architecture
Integration with Spring available
Exposing services using JSR-181 & XFire
@WebMethod(operationName=“reserverFlight”)
public Flight[] getFlightsInPeriod(
Calendar start, Calendar end) {
// implementation of business method
}
}
<beans xmlns="http://xfire.codehaus.org/config/1.0">
<service>
<serviceClass>
com.airline.AirlineServiceImpl
</serviceClass>
<serviceFactory>jsr181</serviceFactory>
</service>
</beans>
Issues with remoting
and web services
Issues with remote services in general
Specifying in .NET
autoboxing, null not supported
Therefore:
Contract-first instead of contract-last
The net result
Tight coupling to our service interface
Decreases interoperability, XML-Java-hassle
Version management is a pain
RPC-based web service
Document-based is possible
(message-style), but less obvious
Contract-last development
Data is important, not the interface
Changes to interface changes to WSDL
Less interoperability
Easy to deploy simple service though
See resources slide
What are we looking for?
Access to raw message
XML marshalling
Optional
Customizable
Schema based
Contract-first development
Service objects
Exception != Fault
Customizable Exception-Fault mapping
Similar to Servlets, Spring-MVC
Maps classes of exceptions to faults
Java Standards
SAAJ
JAX-RPC (although not recommended)
JAX-WS (partly, for now)
Implementing Web Service
MessageHandler
SOAPMessage handleMessage(SOAPMessage message);
PayloadEndpoint
Source invoke(Source request);
HandlerAdapter EndpointAdapter
HandlerMapping EndpointMapping
handler endpoint
HandlerInterceptor EndpointInterceptor
HandlerExceptionResolver EndpointExceptionResolver
DispatcherServlet MessageDispatcher
Spring MVC HandlerAdapters
HandlerAdapters
Adapt to arbitrary controller hierarchy
DispatcherServlet
HandlerAdapter
<<executes>>
<<adapts>>
ThrowAway
Controller
Controller
Spring WS EndpointAdapters
EndpointAdapters
Adapt to arbitrary endpoint
MessageDispatcher
EndpointAdapter
<<executes>>
<<adapts>>
Payload Marshalling
EndpointSupport EndpointSupport
Spring MVC HandlerMappings
BeanNameUrlHandlerMapping
Bean names mapped to request paths
SimpleUrlHandlerMapping
Properties mapped to request paths
?
Resources
1. ‘Philosophical Split Hurts Web Services Adoption’ – Michael Daconta, July 2003
www.devchannel.org/webserviceschannel/03/07/11/2122220.shtml?tid=25&tid=38
2. ‘J2EE: JAX-WS Improves JAX-RPC with better O/X Mapping’ – Bobby Woolf, June 2005
www-128.ibm.com/developerworks/blogs/dw_blog_comments.jspa?blog=392&entry=83694
3. ‘Rethinking the Java SOAP Stack’ - Steven Loughran and Edmund Smith, June 2005
www.hpl.hp.com/techreports/2005/HPL-2005-83.pdf
5. Practical data binding: XPath as data binding tool – Brett McLaughlin, November 2005
http://www-128.ibm.com/developerworks/xml/library/x-pracdb8.html