Gopalan Suresh Raj
Web Cornucopia
Gopalan's Profile
Archives
« November 2009
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
     
       
Today
Click me to subscribe Download Open ESB
Syndication
Search

Table of Contents
Tags
bpel choreography ejb esb http integration javacaps javaee javaone jax-ws jbi management openesb orchestration process-oriented rest sca service-oriented soa soap wsdl xml xsd
Links
 
Referrers

Today's Page Hits: 183

Map of Visitors
Locations of visitors to this page
Caveat Emptor
This is my personal weblog. The contents of this Weblog represent my personal opinion which may differ from the official views of my employer, Sun Microsystems, Inc. or any past employers. I do not speak for my employer or any past employers.
View Gopalan Suresh Raj's profile on LinkedIn
« My JavaOne 2007... | Main | JBI/SOA Tips: Expose... »
Sunday Apr 22, 2007
Apr
22
JBI/SOA Blueprints: Beware of the issues when doing Implementation-First (Bottom-up) Development

As the debate regarding the right way to service contract design has increased as can be seen from here, and here, I wanted to reiterate some of the points I made earlier regarding the same. When designing a Service Contract, you can take two major approaches - well three (if you factor in the Meet-in-the-Middle case) but in reality that is a mix of the other two. The approaches as I have already mentioned in a previous blog entry are:

As I have already mentioned, the preferred approach to Service Contract Design is the Top-Down approach, namely Contract-First Development.

You should avoid the Bottom-up approach, namely Implementation-First Development as much as possible. Granted that an Implementation-First approach allows the developer to write a lot of code that we developers are fond of writing, and tools like the NetBeans SOA pack can generate WSDL and XSD from the implemented classes. There are a lot of issues with the Implementation-First approach, but I will re-iterate a couple of them in this blog entry once again:

  1. With the Implementation-First style, it is possible that programming language specific styles, idioms, and implementation details may unintentionally creep into the service contract.
  2. This will make it extremely difficult for the consumer of the service - especially if the consumer is being implemented using a different programming language than the provider.

Therefore, try to avoid Implementation-First Development as much as possible. However, if you do have to do Implementation-First Development, you have to pay special attention to the following points:

  1. Only use Java data types that can be expressed unambiguously through an XML-Schema. This ensures that the data can be marshaled and unmarshaled in a platform and programming language-neutral manner for attributes, operation parameters and return types.
  2. Extensible type mapping should be avoided as much as possible. Keep in mind that extensible type mappings are not standard
  3. If you have a choice between using standard Java type arrays prefer them to using say an ArrayList or a Collection

 Moreover, when exposing the Interface Endpoint, you have a couple of choices to make. Your service endpoint can be exposed as:

  1. Service Endpoint exposed from an EJB WebService
  2. Service Endpoint  exposed from a Web Application

Service Endpoint exposed from an EJB WebService

In this approach, the service is generally implemented as a Stateless EJB SessionBean and therefore, multi-threaded access is handled by the EJB Container. Also, since the service interface is exposed through an EJB, the service runs in the transactional context of the EJB container. This has many advantages for example, for one, it allows you to declaratively demarcate transactions.

Service Endpoint  exposed from a Web Application

In this approach, the service is generally implemented as a servlet, and therefore, the service has to handle concurrent client access on its own. Since the service implementation is done through a servlet, the transactional context is unspecified. For the same reason, you do not have any declarative means to start a transaction.

Please be aware of these when designing your service contract.

Like this write-up? Subscribe to receive  more  like it.


 

 

 

Posted at 12:50AM Apr 22, 2007 by Suresh Gopalan in JBI and SOA  |  Listen to this article Listen to this entry  |  Comments added Comments[0]

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

Disclaimer: The contents of this Weblog represent my personal opinion which may differ from the official views of my employer, Sun Microsystems, Inc. or any past employers.



View blog top tags

Enter your email address:

Delivered by FeedBurner

[Valid RSS]