Welcome!

Weblogic Authors: Yeshim Deniz, Elizabeth White, Michael Meiner, Michael Bushong, Avi Rosenthal

Related Topics: Weblogic

Weblogic: Article

Introducing WebLogic Cajun

Bringing Web Services to the Enterprise

While Web services possess the potential to completely change how applications and organizations are integrated, capitalizing on this innovative technology hasn't been easy. To truly leverage the potential of Web services, you need both an architecture that can handle enterprise integration challenges and a framework that enables developers possessed of varying skillsets to work together. BEA Systems is launching a new product designed to solve these problems - "Cajun". Cajun makes it incredibly simple for application developers to build sophisticated Web services.

This article introduces "cajun", and illustrates some of its major features and concepts. You'll see from the examples that "cajun" sets a new bar for developer productivity, ease-of-use, and Web-service sophistication.

Enterprise Class Web Services
SOAP, WSDL, and UDDI are the three major standards that form the foundation of Web services. Leveraging XML and existing Internet standards, these specifications describe how XML messages can be sent between applications (SOAP), provide a mechanism for describing the operations an individual Web service supports (WSDL), and establish a registry of Web services (UDDI).

Based on these standards, the Web services marketplace is flourishing. You can leverage Web services that let you check stock quotes, exchange profile information between Web sites, and check the traffic on your favorite highway - regardless of the platform you're using.

To date, these simple, synchronous Web services have commanded the attention of the marketplace. But Web services represent much more than just a way to exchange simple information over the Internet; their real power lies in the enterprise. Web services are a cross-platform, standards-based way to integrate systems (inside and outside a company's walls) in a way that's flexible and designed for change. Building Web services for the enterprise requires the right architecture and approach, as well as the infrastructure necessary to support it. In particular, enterprise class Web services have three main characteristics:

1. They're loosely coupled. Loosely coupled applications are flexible and can accommodate change over time. In an IT environment in which you need to integrate different applications built by different teams on different schedules using different technologies and platforms, you need a way to minimize the impact of change. With Web services, you can integrate applications based on a "public contract" that describes the XML messages applications will exchange, but leaves the underlying implementation details to each application. As long as applications continue to honor their "contract" they can change at will without breaking the integration.
2. They accommodate asynchrony. The real world doesn't consist entirely of systems that can immediately respond to any request. Any integration archicture must encompass human users, outside resources, and legacy applications - all of which are inherently better suited to asynchronous communication in most application scenarios.
3. They provide coarse-grained interfaces. By integrating at a business level - exchanging documents like POs and invoices instead of moving one piece of data from one application to another - Web services can have greater flexibility when the underlying implementation changes. This coarse-grained exchange of data is also much more network friendly, unifying the internal and external integration worlds.

The Enterprise Developer Organization
When used as an integration technology, Web services must be deployed on a trusted and secure, reliable, available, scaleable platform. "Cajun" provides the infrastructure to easily build Web services with these characteristics and deploy them on the WebLogic platform.

Bringing Web services to the enterprise also requires a platform that appeals to all constituents in the development organization. In most enterprises a small set of expert developers and architects is responsible for the overall enterprise architecture, creating reusable software components and building core business applications. For these users, the J2EE platform is the natural choice. The majority of developers, however, are focused on application and business logic rather than the architectural underpinnings of an enterprise. They're closer to the line of business, understand the requirements of an application, and are best at getting applications produced. These developers typically will write the code necessary to integrate existing components and expose new functionality through Web services.

By reducing the barriers of entry to programming with J2EE, "Cajun" brings the entire development organization onto the same platform. Moreover, "cajun" enables developers to focus on the tasks they do best. J2EE experts can focus on building enterprise components and applications with the knowledge that all developers in the organization can easily access them. The rest of the development organization can then focus on creating the Web services and procedural code necessary to build composite applications from these components. Time and energy can be directed to the real meat of the application, rather than the details of the J2EE APIs necessary to access components or the steps involved in calling an EJB.

"cajun" Architecture
"Cajun" includes two major components: a design-time tool that lets developers write Java code to implement Web services and a runtime framework that provides the Web services infrastructure, testing, debugging, and deployment environment for "cajun" applications.

The "cajun" Tool
The "Cajun" Integrated Development Environment (IDE) provides a complete environment for developing a Web service application. Standard features such as project management, syntax highlighting, code completion, and integrated debugging are all included. In addition, "Cajun" provides a unique visual approach to Web services. Figure 1 shows the "Cajun" Design View. The Web service under development appears at the center of the screen. Messages sent from the Web service client appear as events that can be handled by writing business logic code and additional resources are exposed as controls on the right.

The design view lets users graphically create new methods, set properties on controls, and specify the overall structure of a Web service and its relationship with the outside world. The goal is to enable developers to focus on writing business logic - the code that's executed in response to each incoming method - not the machinery of typical Java programming. The "Cajun" IDE supports two-way editing so any changes made through the graphical environment are reflected immediately in code and vice versa.

"Cajun" Controls
Controls are a key innovation that give developers easy access to enterprise resources and J2EE APIs. These APIs provide a tremendous amount of power and flexibility but are typically overkill for common tasks. The sophistication of J2EE is one of the main barriers to entry for most developers.

"Cajun" controls overcome this problem by simplifying APIs and reducing the amount of object-oriented programming necessary to access external resources. Instead of creating new objects or interfaces or having to learn the necessary Java to access a database or look up an EJB, controls appear as local objects with a simplified set of methods that can be called, and properties that can be set.

For example, "Cajun" has a database control that simplifies the JDBC API. Database administrators can create a reusable database control that links SQL statements with Java methods in a simple declarative fashion. Developers can then use these components to access database resources with a simple function call. These controls can be further customized or extended simply by adding a new SQL statement.

A code example of a method in a database control that executes a simple select statement follows:

/**
* @jws:sql statement::--
SELECT SCORE
FROM CUSTOMERS
WHERE SSN = {ssn}
::--
*/
int getScore (String ssn)
throws int getScore(String ssn);
A special "Cajun" javadoc annotation associates a SQL statement with a Java method. Once a method is on a control in this way, users of the control simply call the function to execute the SQL command.

"Cajun" currently provides controls to access databases, other Web services, EJBs, JMS queues, and applications exposed through the J2EE Connector Architecture. It also provides a timer control to help manage asynchronous events. You can see how both a Database and a Timer control are used in Listing 1.

Java Web Service Files
The meeting place between the design time tool and run-time framework is the Java Web Service (JWS) file. JWS files are standard Java files with annotations (expressed in the JavaDoc syntax) to express additional functionality. This format enables developers to write standard Java code, but provides a mechanism for the "Cajun" tool and framework to assist with more sophisticated tasks. Annotations are used to display the Web service and its properties graphically, and by the framework to generate the EJB and J2EE code to execute the Web service. By moving code generation out of the tool and into the framework, developers never have to manage and maintain code they didn't write.

"Cajun" uses annotations in a JWS file to encode everything from what SOAP style a Web service uses to how XML messages are converted into Java objects (see Figure 2). This approach is also a simple but powerful way to smooth the ramp between developer skill sets. Developers work in a simplified programming environment but still write standard Java code. This allows a J2EE expert to easily add value over time. Instead of rebuilding an application written in a procedural language when it hits performance or scalability limitations, expert developers can tune the original Java code.

The "Cajun" Framework
The "Cajun" framework is where the magic happens. Once a JWS file that contains all the business logic for a Web service has been created, the "Cajun" framework is responsible for generating the standard EJB code needed to implement it. Moreover, this framework exposes (through the annotations) functionality specifically designed to support building enterprise class Web services. In particular, "Cajun" assists by:

  • Managing asynchronous communication with a conversational metaphor. The "Cajun" framework automatically manages asynchronous message correlation and state management across messages in a conversation. Users can simply mark methods as starting, finishing, or continuing a conversation and the "Cajun" framework takes care of the details. A unique ID is automatically generated to identify the conversation, and any state (class member variables) defined in the Web service is managed persistently with entity Java beans. Conversations can be either two-way, in which the client sends SOAP messages to the "Cajun" Web service and that Web service executes an asynchronous callback to the client (again with a SOAP message), or one-way through a polling approach.
  • Enabling loose coupling with XML Maps and XML Script. "Cajun" uses simple, declarative XML maps to map between internal Java code and XML messages exchanged between Web services. Users simply indicate the structure of the desired method and associate XML fields with Java variables. For more sophisticated mapping tasks, developers can include ECMA script code in a map definition. "Cajun" has extended ECMA script with XML extensions to simplify access to XML data and enable complex structural or data transformations.
  • Enabling availability with JMS queues. To ensure availability under high load, Web services can take advantage of message buffers. Users simply mark a method as requiring a buffer, and the "Cajun" framework will handle creating a queue and wiring it to the Web service. This enables one-click access to sophisticated J2EE functionality.
  • Supporting the control architecture. The "Cajun" framework instantiates the implementation of any control used by the JWS. The framework also hooks up any asynchronous callbacks using a simple naming convention.

    The "Cajun" framework also enables a "write-and-run" approach to creating Web services. Much like Java Server Pages (JSP), JWS files are deployed the moment they're placed in the WebLogic Server applications directory. The framework is responsible for creating the necessary EJB and J2EE components (session beans to host application logic, entity beans to manage state, message queues to enable scalability, and so on) and deploying them. This entire process is transparent to users, giving those unfamiliar with WLS or J2EE the ability to create a Web service that takes advantage of all the major performance and scalability attributes of the WebLogic platform - connection pooling, caching, security, transaction management, and so on.

    In addition to deploying the Web service, the framework creates a Web page for each service that provides all the information necessary to use the service in another application - a Web Services Definition Language (WSDL) file - and a Java proxy that makes it easy to invoke the Web service from another Java application. Part of this Web interface is a complete test and monitoring system so that developers can immediately test a Web service for correctness and monitor messages as they are received by the service.

    Finally, the "Cajun" framework exposes a complete debugging environment that's accessible through the IDE. This lets a developer execute a Web service (that may be hosted on another machine) and step through the Web service code as it executes, watch variable values, and test expressions.

    Final Notes
    Listing 1 shows the complete source code for a very simple "Cajun" Web service.

    Investigate.jws defines a Web service at a credit bureau. This service provides both a synchronous method - investigateApplicant() - and an asynchronous method - investigateApplicantAsynch() - to determine whether an applicant should be offered credit. The synchronous method always returns a negative result immediately.

    investigateApplicationAsynch() is the more interesting version. In this method the code starts a timer (using the "Cajun" timer control) to simulate the delay in accessing a back-end system. When the timer fires 10 seconds later, the delayTimer_onTimeout()is invoked by the framework. In this function, we look up the credit score of the customer using a database control and make an asynchronous callback to the client to return the result.

    CreditReportDB.jwi includes a definition for a database control. Like the JWS files discussed above, JWI files are standard Java files with "Cajun" annotations that are used to define controls. Each method in the database control associates a Java method with an annotation used to define a SQL statement. The SQL statement can use variable names in squiggly braces to substitute parameters from the Java method.

    Conclusion
    As you've seen here, "Cajun" provides a complete tool set for building Web services in a fast and easy-to-use fashion. With the JWS format, control architecture, and write-and-run approach to deployment, "Cajun" brings the power of WebLogic to the entire development organization.

    Even more importantly, it provides developers with the infrastructure necessary to bring Web services into the enterprise - where the full potential of the technology can be realized.

  • More Stories By Carl Sjogreen

    Carl Sjogreen is senior product manager for BEA WebLogic Workshop, an integrated development framework that makes it easy for all developers – not just J2EE experts – to build enterprise class web services on the WebLogic platform. Carl has been involved with XML, Web services, and developer tools since 1998, when he founded Transformis, developers of the award-winning Stylus Studio IDE.

    Comments (0)

    Share your thoughts on this story.

    Add your comment
    You must be signed in to add a comment. Sign-in | Register

    In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


    @ThingsExpo Stories
    Amazon is pursuing new markets and disrupting industries at an incredible pace. Almost every industry seems to be in its crosshairs. Companies and industries that once thought they were safe are now worried about being “Amazoned.”. The new watch word should be “Be afraid. Be very afraid.” In his session 21st Cloud Expo, Chris Kocher, a co-founder of Grey Heron, will address questions such as: What new areas is Amazon disrupting? How are they doing this? Where are they likely to go? What are th...
    SYS-CON Events announced today that IBM has been named “Diamond Sponsor” of SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California.
    Infoblox delivers Actionable Network Intelligence to enterprise, government, and service provider customers around the world. They are the industry leader in DNS, DHCP, and IP address management, the category known as DDI. We empower thousands of organizations to control and secure their networks from the core-enabling them to increase efficiency and visibility, improve customer service, and meet compliance requirements.
    Join IBM November 1 at 21st Cloud Expo at the Santa Clara Convention Center in Santa Clara, CA, and learn how IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Cognitive analysis impacts today’s systems with unparalleled ability that were previously available only to manned, back-end operations. Thanks to cloud processing, IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Imagine a robot vacuum that becomes your personal assistant tha...
    In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, will lead you through the exciting evolution of the cloud. He'll look at this major disruption from the perspective of technology, business models, and what this means for enterprises of all sizes. John Considine is General Manager of Cloud Infrastructure Services at IBM. In that role he is responsible for leading IBM’s public cloud infrastructure including strategy, development, and offering ...
    SYS-CON Events announced today that IBM has been named “Diamond Sponsor” of SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California.
    SYS-CON Events announced today that N3N will exhibit at SYS-CON's @ThingsExpo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. N3N’s solutions increase the effectiveness of operations and control centers, increase the value of IoT investments, and facilitate real-time operational decision making. N3N enables operations teams with a four dimensional digital “big board” that consolidates real-time live video feeds alongside IoT sensor data a...
    In a recent survey, Sumo Logic surveyed 1,500 customers who employ cloud services such as Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Platform (GCP). According to the survey, a quarter of the respondents have already deployed Docker containers and nearly as many (23 percent) are employing the AWS Lambda serverless computing framework. It’s clear: serverless is here to stay. The adoption does come with some needed changes, within both application development and operations. Tha...
    SYS-CON Events announced today that Avere Systems, a leading provider of enterprise storage for the hybrid cloud, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Avere delivers a more modern architectural approach to storage that doesn't require the overprovisioning of storage capacity to achieve performance, overspending on expensive storage media for inactive data or the overbui...
    With major technology companies and startups seriously embracing Cloud strategies, now is the perfect time to attend 21st Cloud Expo October 31 - November 2, 2017, at the Santa Clara Convention Center, CA, and June 12-14, 2018, at the Javits Center in New York City, NY, and learn what is going on, contribute to the discussions, and ensure that your enterprise is on the right path to Digital Transformation.
    Digital transformation is changing the face of business. The IDC predicts that enterprises will commit to a massive new scale of digital transformation, to stake out leadership positions in the "digital transformation economy." Accordingly, attendees at the upcoming Cloud Expo | @ThingsExpo at the Santa Clara Convention Center in Santa Clara, CA, Oct 31-Nov 2, will find fresh new content in a new track called Enterprise Cloud & Digital Transformation.
    Most technology leaders, contemporary and from the hardware era, are reshaping their businesses to do software. They hope to capture value from emerging technologies such as IoT, SDN, and AI. Ultimately, irrespective of the vertical, it is about deriving value from independent software applications participating in an ecosystem as one comprehensive solution. In his session at @ThingsExpo, Kausik Sridhar, founder and CTO of Pulzze Systems, will discuss how given the magnitude of today's applicati...
    Smart cities have the potential to change our lives at so many levels for citizens: less pollution, reduced parking obstacles, better health, education and more energy savings. Real-time data streaming and the Internet of Things (IoT) possess the power to turn this vision into a reality. However, most organizations today are building their data infrastructure to focus solely on addressing immediate business needs vs. a platform capable of quickly adapting emerging technologies to address future ...
    SYS-CON Events announced today that NetApp has been named “Bronze Sponsor” of SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. NetApp is the data authority for hybrid cloud. NetApp provides a full range of hybrid cloud data services that simplify management of applications and data across cloud and on-premises environments to accelerate digital transformation. Together with their partners, NetApp emp...
    As popularity of the smart home is growing and continues to go mainstream, technological factors play a greater role. The IoT protocol houses the interoperability battery consumption, security, and configuration of a smart home device, and it can be difficult for companies to choose the right kind for their product. For both DIY and professionally installed smart homes, developers need to consider each of these elements for their product to be successful in the market and current smart homes.
    Widespread fragmentation is stalling the growth of the IIoT and making it difficult for partners to work together. The number of software platforms, apps, hardware and connectivity standards is creating paralysis among businesses that are afraid of being locked into a solution. EdgeX Foundry is unifying the community around a common IoT edge framework and an ecosystem of interoperable components.
    Join IBM November 1 at 21st Cloud Expo at the Santa Clara Convention Center in Santa Clara, CA, and learn how IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Cognitive analysis impacts today’s systems with unparalleled ability that were previously available only to manned, back-end operations. Thanks to cloud processing, IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Imagine a robot vacuum that becomes your personal assistant th...
    SYS-CON Events announced today that Avere Systems, a leading provider of hybrid cloud enablement solutions, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Avere Systems was created by file systems experts determined to reinvent storage by changing the way enterprises thought about and bought storage resources. With decades of experience behind the company’s founders, Avere got its ...
    SYS-CON Events announced today that Golden Gate University will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Since 1901, non-profit Golden Gate University (GGU) has been helping adults achieve their professional goals by providing high quality, practice-based undergraduate and graduate educational programs in law, taxation, business and related professions. Many of its courses are taug...
    SYS-CON Events announced today that SIGMA Corporation will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. uLaser flow inspection device from the Japanese top share to Global Standard! Then, make the best use of data to flip to next page. For more information, visit http://www.sigma-k.co.jp/en/.