1 / 31

SOA Today with

SOA Today with. Agenda. SOA defined Introduction to XFire A JSR 181 Service Other “stuff” Questions. Service Oriented 1. to orient around services 2. buzzword 3. Service oriented is NOT (but can be). NEW XML Web Services ESBs [insert cool product here].

moke
Download Presentation

SOA Today with

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SOA Today with

  2. Agenda • SOA defined • Introduction to XFire • A JSR 181 Service • Other “stuff” • Questions

  3. Service Oriented1. to orient around services2. buzzword3. ...

  4. Service oriented is NOT(but can be) NEW XML Web Services ESBs [insert cool product here]

  5. Service oriented is an architectual style

  6. Loosely Coupled NOT

  7. Highly Interoperable Built on standardsCrosses boundaries

  8. Service oriented is business oriented

  9. XFire • Web Services for Java • Standards based: XML, SOAP, WSDL, WS-* • Open Source (MIT license) • Easy to use: • JSR181 • Spring support • Code->WSDL • WSDL->code

  10. Architecture • Streaming xml (StAX) • Pluggable bindings – POJOs, JAXB, XMLBeans, Castor, Custom types • Multiple transports – HTTP, XMPP, JMS, In-JVM transports • (and write your own easily via our Transport API!) • Embeddable

  11. Performance • Traditional Web Services Build DOM Build Objects Invoke Service Build DOM Write DOM • Requires building two object representations • Document Object Model • Business domain objects

  12. XFire Performance • Streaming Model Build objects from stream Invoke Service Write objects to stream • Builds domain objects directly from the XML stream • Low latency and high throughput model • 2-5+x the throughput of Axis and 1/2-1/5 the latency

  13. XFire and JSR 181 • Easy code first deployment • Model service via annotations • Java 5 and Java 1.4 through commons-attributes or Retroweaver

  14. The OrderService @WebService public interface OrderService { … }

  15. Our Operations @WebMethod public Collection<Order> getOrders(); @WebMethod public long addOrder(Order o); @WebMethod public void removeOrder(long id);

  16. Our Operations Take 2 @WebMethod @WebParam(name=“OrderId”) public long addOrder( @WebParam(name=“Order”) Order o);

  17. Service Implementation @WebService( endpointInterface=“OrderService”, serviceName=“OrderService”) public class OrderServiceImpl { // implement operations here }

  18. Configure the Service • A ServiceFactory creates a Service • A Service is registered in the ServiceRegistry • XFireHttpServer creates a Jetty instance configured for XFire • An XFireProxyFactory creates a proxied Client

  19. Create the Service XFire xfire = XFireFactory.newInstance().getXFire(); AnnotationServiceFactory factory = new AnnotationServiceFactory( new Jsr181WebAnnotations(), xfire.getTransportManager()); Service service = factory.create(OrderServiceImpl.class); xfire.getServiceRegistry().register(service); XFireHttpServer server = new XFireHttpServer(); server.start();

  20. Easy client XFireProxyFactory xpf = new XFireProxyFactory(); OrderService service = (OrderService) xpf.create(model, OrderService.class); service.getCustomers();

  21. The services.xml version <beans> <service> <serviceFactory>jsr181</serviceFactory> <serviceClass>OrderServiceImpl</serviceClass> </service> </beans>

  22. A “pure” Spring version <import resource=“/org/codehaus/xfire/spring/xfire.xml”/> <bean id=“orderService” class=“org.codehaus.xfire.spring.ServiceBean”> <property name=“serviceClass” value=“com.acme.OrderServiceImpl”/> <property name=“serviceFactory” ref=“jsr181”/> </bean> <bean id="webAnnotations" class="org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations"/> <bean id=“jsr181 class=“org.codehaus.xfire.anotations.AnnotationServiceFactory”> <constructor-arg ref=“webAnnotations”> <constructor-arg ref=“xfire.transportManager”/> </bean>

  23. A “pure” Spring version <import resource=“/org/codehaus/xfire/spring/xfire.xml”/> <bean id=“orderService” class=“org.codehaus.xfire.spring.ServiceBean”> <property name=“serviceClass” value=“com.acme.OrderServiceImpl”/> <property name=“serviceFactory” ref=“jsr181”/> </bean> <bean id="webAnnotations" class="org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations"/> <bean id=“jsr181 class=“org.codehaus.xfire.anotations.AnnotationServiceFactory”> <constructor-arg ref=“webAnnotations”> <constructor-arg ref=“xfire.transportManager”/> </bean>

  24. A “pure” Spring version <import resource=“/org/codehaus/xfire/spring/xfire.xml”/> <bean id=“orderService” class=“org.codehaus.xfire.spring.ServiceBean”> <property name=“serviceClass” value=“com.acme.OrderServiceImpl”/> <property name=“serviceFactory” ref=“jsr181”/> </bean> <bean id="webAnnotations" class="org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations"/> <bean id=“jsr181 class=“org.codehaus.xfire.anotations.AnnotationServiceFactory”> <constructor-arg ref=“webAnnotations”> <constructor-arg ref=“xfire.transportManager”/> </bean>

  25. A “pure” Spring version <import resource=“/org/codehaus/xfire/spring/xfire.xml”/> <bean id=“orderService” class=“org.codehaus.xfire.spring.ServiceBean”> <property name=“serviceClass” value=“com.acme.OrderServiceImpl”/> <property name=“serviceFactory” ref=“jsr181”/> </bean> <bean id="webAnnotations" class="org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations"/> <bean id=“jsr181 class=“org.codehaus.xfire.anotations.AnnotationServiceFactory”> <constructor-arg ref=“webAnnotations”> <constructor-arg ref=“xfire.transportManager”/> </bean>

  26. Testing • Test against your target platforms • .NET, PHP, Ruby, Perl, [fancy lang here] • Record messages and play back • Use AbstractXFireAegisTest • invokeService(serviceName, document)

  27. Security • Authentication – HTTP, WS-Security, Custom headers • Authorization – Acegi, Custom code • Integrity – WS-Security • Privacy – HTTPS, JMS, WS-Security • Avoid WS-Security whenever possible. Its dead slow.

  28. Custom authentication public void addOrder( @WebParam(header=true) AuthToken token, @WebParam Order order); public class AuthToken { String username; String password; …. }

  29. SOA with XFire perspective • Loosely Coupled – OrderService is independent of others • Highly interopable – All you need is the WSDL • Business oriented • Shares data across business boundaries

  30. Where to now • Use XFire Mapping files to control WSDL/XSD • Do Schema/WSDL first with JAXB, XMLBeans or Castor for more control • Hook up services to JMS or ServiceMix or Mule • Write more services! • Investigate WS-* needs

  31. Questions? More Information: • Web site: http://xfire.codehaus.org • Mailing Lists: http://xfire.codehaus.org/Support • My Blog: http://netzooid.com/blog • Commercial Support: http://envoisolutions.com • Send email to dan@netzooid.com for performance stats

More Related