Extended AXIS2 Framework to support JVM-based scripting languages

Source: Internet
Author: User
Tags extend soap web services wrapper wsdl

This article describes how to extend the AXIS2 framework to support scripting languages such as Jython, JRuby, and other java-based virtual machines (JVMS). The article provides a high-level overview of this topic, including some key concepts of Apache Axis2, and how to use AXIS2 to provide extensions for the JVM-based scripting language. After reading this article, developers can extend the AXIS2 framework to support the JVM based scripting language. After the AXIS2 framework expands, you can easily do the following two points:

Develop the script as a Web service.

Writes the service client in the selected scripting language.

The Apache Axis2 is an open-source Web services engine. It thoroughly redesigned and authored a wide range of Apache Axis soap stacks. Axis2 can not only add Web service interfaces for Web applications, but also operate as stand-alone server applications. The Apache AXIS2 supports the SOAP protocol and also supports the popular rest-style Web services. With Axis2, you can expose the business logic to a ws-*-style interface, while at the same time exposing the implementation to a Rest/pox-style interface.

The JVM was designed solely to support the Java programming language. But as time goes on, more and more languages are ported to the Java platform, including many scripting languages. The JVM now supports many scripting languages, such as Jython, JRuby, ColdFusion, and so on. For simplicity, this article has chosen Jython, but the techniques described also apply to other languages.

Jython is the Java implementation of the Python programming language. It takes the best of both Java and Python, and is a mixed programming of the two languages. Since Jython is written entirely in Java, scripts written with Jython can run on any compatible JVM and can use existing Java libraries (these Java libraries are Python modules).

How to implement Web services

Web services are a set of technologies for building a service-oriented architecture (SOA). Although the relationship between SOA and Web services is often confusing, it is important to understand that Web services are an implementation technology that uses standard protocols to perform SOA. Two of the more widely used techniques for developing Web services are code first and contract precedence:

The main focus of the code-first approach is to give the code; you write the Java code First, and then generate the Web service contract (WSDL) based on the Java code. In contrast, the contract gives priority to the service contract; you first write the WSDL contract, and then use Java or the Code generation tool to implement the contract. There are some benefits to the contract-first approach, which can promote:

Loose coupling between applications

Interoperability between multiple services

Abstract use, thus hiding the underlying implementation details

Collaboration and consensus among all the parties involved

The code-first approach has the following advantages:

Simple, time-saving

The ability to expose legacy systems to Web services

Do not have to delve into the knowledge about WSDL

This means that when designing a service contract, you can choose between code first and contract priority. The final decision depends on whether you want to ensure interoperability or increase productivity. This article will show you how to extend the Apache Axis2 to support both ways.

Extends the AXIS2 framework to support code first

AXIS2 contains an Xml-based client API that is powerful. This API can be used to develop Java service clients. Now the requirement is to write the service client in scripting language, we choose Jython for demo.

To enable Jython to collaborate with the AXIS2 client library, we need to develop a wrapper library of the AXIS2 client API. The purpose of developing the wrapper library is to create an abstraction layer above the existing functional body. At this point, we want to redefine the interface of the AXIS2 client API so that it can accept Jython scripts.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.