Welcome!

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

Related Topics: Weblogic

Weblogic: Article

Integrating an ASP.NET Application with J2EE PART 2

Platform interoperability

To view the images, the process is also pretty straightforward. The WebLogic Web Service opens the file based on the file name passed as a parameter. The Web Service then gets the binary data from the file and returns it via a binary data type. The ASP.NET client code calls the Web Service, sets the content type for the Web page (via Response.ContentType) based on the file extension and then sends the binary stream via the Response.BinaryWrite method. The WebLogic code is shown in Listing 8 while the ASP.NET code is shown in Listing 9.

Application Navigation and Workflow
One of the areas in which many Web applications are difficult to maintain is application workflow. I define application workflow as the way in which applications validate data and handle navigation. One of the common issues we've seen in ASP and ASP.NET applications is that there's a lot of page navigation logic buried inside code - behind pages or ASP scripts - and changing the location of the name of a Web page causes broken links in the application. J2EE applications commonly take advantage of an open source framework called "Struts." Struts provides a number of useful features:

  • Struts abstracts page navigation into XML configuration files. Pages are referenced by name rather than URL so that URLs can be easily changed in the XML configuration file.
  • Struts encourages development using a MVC (Model-View-Controller) architecture.
  • Struts abstracts HTTP response data into separate classes ("ActionForm" classes) that are simple classes with attributes that match the response parameters and accessor/mutator (get/set) methods.
  • Struts provides a main controller class (servlet) to which every page will submit. The controller class abstracts the HTTP response data into ActionForm classes, delegates control to a business class (Action class) that applies complex validations, and determines the next page to access.
Having built a few successful J2EE applications, we wanted to capture the best elements of the Struts framework for our ASP.NET application. Some Struts features are already built into ASP.NET. For example, ASP.NET provides a number of validation controls (RequiredFieldValidator, CompareValidator, RangeValidator, RegularExpressionValidator, and CustomValidator) that assist in validating form on an ASP.NET page. Struts also provides page validation framework support and a validation summary control type.

While Struts offers a central controller to which all pages must submit, ASP.NET offers a different model in which pages submit back to themselves. This enables the event-driven programming model and page state (ViewState) features in ASP.NET. The two architectures are quite different. After taking a look at the options, we felt that developing a central controller similar to Struts would take a great deal of effort and the result would be a less optimal architecture. So we decided not to develop a central controller like Struts.

Several benefits of Struts are predicated on the submission of each Web page to a main controller class and wouldn't work well in an ASP.NET environment. Specifically, the abstraction of HTTP request data into separate classes and the delegation to a business processing and validation class were dependent on the submission to a main controller class. Besides, delegation to a business processing class was something we were already doing in an ASP.NET environment. One of the features of Struts that we felt we could adapt relatively easily that didn't rely on the submission of each Web page to a main controller class was the abstract page navigation available in Struts.

Abstracting Page Navigation
When developing an application under Struts, a developer defines an XML configuration file that indicates absolute URL addresses for Web pages and assigns a logical name for the page. In an ASP.NET application, the logical name "LoginPage" can be assigned to "http://myserver/myapplication/Login.aspx." Developers can code Response.Redirect statements and URL links using the logical name rather than the absolute URL address. Should the page name or location have to change in the future, a simple change to the XML configuration file is all that's needed. For example, the code to redirect to the login page would be:

Response.Redirect(getPageURL(Page.Login));

To implement this concept in ASP.NET, we implemented a class called "NavigationController." It would read and cache the page name and URL information stored in an XML configuration file (NavigationConfig.xml), offer helper methods to return the absolute page URL when passed the logical name, and provide generic methods to redirect forward and backward in the application.

The example application provides a simple example of using the NavigationController. The page navigation information is stored in the NavigationConfig.xml file:


<?xml version="1.0" encoding="utf-8" ?>
<!--The order of items determine the sequence in which they appear in the module -->
<MyApplication>
<MyModule>
<Page Name="Page1" Url="~/Navigation/Page1.aspx"/>
<Page Name="Page2" Url="~/Navigation/Page2.aspx"/>
<Page Name="Page3" Url="~/Navigation/Page3.aspx"/>
<Page Name="Page4" Url="~/Navigation/Page4.aspx"/>
</MyModule>
</MyApplication>
The NavigationController class reads the NavigationConfig.xml file and builds a collection of PageConfiguration objects. Each PageConfiguration object contains the navigation information for a page. A Hashtable collection of PageConfiguration objects is built and the Hashtable collection is stored in the ASP.NET Application object.

There are four pages, Pages 1-4, all with back and next buttons. The back button executes the RedirectBack method in the NavigationController class. The next button executes the RedirectForward method in the NavigationController class.

The code for the RedirectForward method is shown in Listing 10.

The current page for the application is stored in the ASP.NET Session object for each user. This is set to the first page of the application ("Page1") via code in the Page_Load method of the Page1.cs.aspx. Each page has a PageConfiguration object stored in the Hashtable. The PageConfiguration object is aware of the current page, the previous, and next pages in the application navigation flow. If the next page is valid, the URL for the page is obtained and the NavigationController class redirects the application to the next page.

Listing 11 contains the entire code from the NavigationController class and the PageConfiguration class.

The NavigationController class in its current incarnation works well for a simple wizard-based application in which the navigation is relatively simple. To support more complex navigation, you'd need additional processing to delegate to a business class that provides complex validations, performs business calculations, and determines the next page that the application should navigate to based on business rules.

See Sidebar "Article Information Box".

Summary
In this article I have discussed the integration of an ASP.NET client with a J2EE (WebLogic) middle-tier using Web Services. I discussed some of the issues that arise in this type of hybrid environment and how we addressed them. The application we developed using the technologies and techniques discussed here is now in production and the general feedback from the developers, the client, and users is very positive. I hope you found this article useful and, as always, I would love to hear from other developers and architects with ideas and suggestions based on their experiences.

More Stories By Blair Taylor

Blair Taylor is president of JustWebSolutions.com, a Canadian company specializing in the architecture and development of distributed systems. Blair has authored several publications covering client-server and distributed technologies and is certified in both Java and .NET technologies. Blair can be reached via e-mail at [email protected] or at www.justwebsolutions.com.

Comments (1) View Comments

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.


Most Recent Comments
mo 06/28/05 03:43:02 AM EDT

Good article.
I completely support the article approach when dealing with simple text based services. Web services is a satisfying solution . Unfortunately , I believe that binary data shouldn't be handled using Web services. It's just not up to it and the writer have proved it when dealing with .NET exceptions. There are better solutions for such cases. I can think of at least one solution that converts .NET binary into pure Java binary: http://dev.mainsoft.com/ but I'm sure there are more.

@ThingsExpo Stories
DX World EXPO, LLC, a Lighthouse Point, Florida-based startup trade show producer and the creator of "DXWorldEXPO® - Digital Transformation Conference & Expo" has announced its executive management team. The team is headed by Levent Selamoglu, who has been named CEO. "Now is the time for a truly global DX event, to bring together the leading minds from the technology world in a conversation about Digital Transformation," he said in making the announcement.
"Space Monkey by Vivent Smart Home is a product that is a distributed cloud-based edge storage network. Vivent Smart Home, our parent company, is a smart home provider that places a lot of hard drives across homes in North America," explained JT Olds, Director of Engineering, and Brandon Crowfeather, Product Manager, at Vivint Smart Home, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
SYS-CON Events announced today that Conference Guru has been named “Media Sponsor” of the 22nd International Cloud Expo, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. A valuable conference experience generates new contacts, sales leads, potential strategic partners and potential investors; helps gather competitive intelligence and even provides inspiration for new products and services. Conference Guru works with conference organizers to pass great deals to gre...
The Internet of Things will challenge the status quo of how IT and development organizations operate. Or will it? Certainly the fog layer of IoT requires special insights about data ontology, security and transactional integrity. But the developmental challenges are the same: People, Process and Platform. In his session at @ThingsExpo, Craig Sproule, CEO of Metavine, demonstrated how to move beyond today's coding paradigm and shared the must-have mindsets for removing complexity from the develop...
In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, led attendees through the exciting evolution of the cloud. He looked 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 m...
"Evatronix provides design services to companies that need to integrate the IoT technology in their products but they don't necessarily have the expertise, knowledge and design team to do so," explained Adam Morawiec, VP of Business Development at Evatronix, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. In his session at @BigDataExpo, Jack Norris, Senior Vice President, Data and Applications at MapR Technologies, reviewed best practices to ...
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.
Large industrial manufacturing organizations are adopting the agile principles of cloud software companies. The industrial manufacturing development process has not scaled over time. Now that design CAD teams are geographically distributed, centralizing their work is key. With large multi-gigabyte projects, outdated tools have stifled industrial team agility, time-to-market milestones, and impacted P&L stakeholders.
"Akvelon is a software development company and we also provide consultancy services to folks who are looking to scale or accelerate their engineering roadmaps," explained Jeremiah Mothersell, Marketing Manager at Akvelon, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
"IBM is really all in on blockchain. We take a look at sort of the history of blockchain ledger technologies. It started out with bitcoin, Ethereum, and IBM evaluated these particular blockchain technologies and found they were anonymous and permissionless and that many companies were looking for permissioned blockchain," stated René Bostic, Technical VP of the IBM Cloud Unit in North America, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Conventi...
In his session at 21st Cloud Expo, Carl J. Levine, Senior Technical Evangelist for NS1, will objectively discuss how DNS is used to solve Digital Transformation challenges in large SaaS applications, CDNs, AdTech platforms, and other demanding use cases. Carl J. Levine is the Senior Technical Evangelist for NS1. A veteran of the Internet Infrastructure space, he has over a decade of experience with startups, networking protocols and Internet infrastructure, combined with the unique ability to it...
22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud ...
"Cloud Academy is an enterprise training platform for the cloud, specifically public clouds. We offer guided learning experiences on AWS, Azure, Google Cloud and all the surrounding methodologies and technologies that you need to know and your teams need to know in order to leverage the full benefits of the cloud," explained Alex Brower, VP of Marketing at Cloud Academy, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clar...
Gemini is Yahoo’s native and search advertising platform. To ensure the quality of a complex distributed system that spans multiple products and components and across various desktop websites and mobile app and web experiences – both Yahoo owned and operated and third-party syndication (supply), with complex interaction with more than a billion users and numerous advertisers globally (demand) – it becomes imperative to automate a set of end-to-end tests 24x7 to detect bugs and regression. In th...
"MobiDev is a software development company and we do complex, custom software development for everybody from entrepreneurs to large enterprises," explained Alan Winters, U.S. Head of Business Development at MobiDev, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
Coca-Cola’s Google powered digital signage system lays the groundwork for a more valuable connection between Coke and its customers. Digital signs pair software with high-resolution displays so that a message can be changed instantly based on what the operator wants to communicate or sell. In their Day 3 Keynote at 21st Cloud Expo, Greg Chambers, Global Group Director, Digital Innovation, Coca-Cola, and Vidya Nagarajan, a Senior Product Manager at Google, discussed how from store operations and ...
"There's plenty of bandwidth out there but it's never in the right place. So what Cedexis does is uses data to work out the best pathways to get data from the origin to the person who wants to get it," explained Simon Jones, Evangelist and Head of Marketing at Cedexis, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
SYS-CON Events announced today that CrowdReviews.com has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5–7, 2018, at the Javits Center in New York City, NY. CrowdReviews.com is a transparent online platform for determining which products and services are the best based on the opinion of the crowd. The crowd consists of Internet users that have experienced products and services first-hand and have an interest in letting other potential buye...
SYS-CON Events announced today that Telecom Reseller has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. Telecom Reseller reports on Unified Communications, UCaaS, BPaaS for enterprise and SMBs. They report extensively on both customer premises based solutions such as IP-PBX as well as cloud based and hosted platforms.