WebReference.com - Part 1 of chapter 3 from Professional Java Web Services, Wrox Press Ltd. (1/3)
[next] |
Professional Java Web Services
History of Apache SOAP
Apache SOAP was originally developed by IBM and was known as IBM-SOAP. It was donated to the Apache Software Foundation's Apache XML initiative. What were the market forces that prompted IBM to take this action? The Microsoft SOAP toolkit was going very strong and IBM realized that it would be in the best interest of IBM-SOAP to provide it as an open source implementation for the Java Developer community. In June 2000, the first release of Apache SOAP was created based on the IBM-SOAP code base. The version number was 1.2.
The Apache Software Foundation is a nonprofit organization best known for facilitating the development of the most widely used web server on the Internet called the Apache Web Server. The organization has a number of projects with majority of the projects being focused on creating API's and applications for the development of web-based applications. The Apache XML Project is one of those projects. The goals of the project consists of:
- Providing commercial-quality standards-based XML solutions that are developed using the open source programming paradigm.
- Providing feedback to standards bodies (for example, IETF and W3C) from an implementation perspective.
The Apache XML Project currently consists of seven sub-projects, each focused on a different aspect of XML, including a parser, a stylesheet processor, a web-publishing framework, and an implementation of the formatting objects specifications, among others.
More information about the Apache XML Project can be found at its web site, which is located at https://xml.apache.org/.
Future of Apache SOAP
The next release of Apache SOAP will be called Axis. Axis is the third generation of the Apache SOAP API, IBM-SOAP being the first, Apache SOAP the second, and Axis the third. Axis is a total rewrite. One of the major changes to the architecture consists of using a Simple API for XML (SAX) parser to manipulate XML data streams internally instead of a Document Object Model (DOM) parser, which is used by Apache SOAP. This will improve performance since SAX parsers normally have reduced memory overhead compared to DOM parsers. The goals of the release are to create a SOAP implementation that is more modular, flexible, and provides higher-performance compared to Apache SOAP.
Apache SOAP can be used as a client to a SOAP server. It requires return values from RPC method calls to have explicit type information. The following SOAP message depicts this:
<SOAP-ENV:Envelope xmlns:xsd="https://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENV="https://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:getMessageResponse xmlns:ns1="https://www.wrox.com/helloworld">
<return xsi:type="xsd:string">Hello World!</return>
</ns1:getMessageResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Notice that type information is declared using an attribute--this attribute is a XML schema
declaration, which is used by Apache SOAP to figure out how to interpret the return values. In
this case, the values will be interpreted as a Java String
object. On the other hand,
some SOAP toolkits such as the Microsoft SOAP toolkit don't provide this information (per the
SOAP 1.1 specification they are not required to). The following SOAP message depicts this:
<SOAP-ENV:Envelope xmlns:xsd="https://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENV="https://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:getMessageResponse xmlns:ns1="https://www.wrox.com/helloworld">
<return>Hello World!</return>
</ns1:getMessageResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Notice that there's no type information in the above message, so how do we know how to interpret the return value? We don't! Hence, this causes an interoperability issue. Apache SOAP has some workarounds to handle this situation, but Axis improves upon this by providing a mechanism for defining a default return type if the SOAP server doesn't return one.
Axis also provides support for more current standards such as WSDL. A WSDL document that
describes a deployed service can be automatically generated by simply appending a "?WSDL"
to the end of the URL that's defined as the endpoint for the service. For example, the WSDL document
for a HelloWorld
web service could be generated using the following URL:
https://localhost:8080/axis/services/HelloWorld?wsdl
. A WSDL to Java tool is also
provided. This tool has the ability to create stubs. A stub is a Java class that has the same
interface as a remote web service. It allows the service to be invoked exactly as if it were
a local object.
More information on AXIS is available in Chapter 14. The third alpha release of Axis is available at https://xml.apache.org/axis/dist/alpha3/. [As of this posting, Axis is now in its second beta release: https://xml.apache.org/axis/dist/beta2/. -Ed.] Information about the project can be found at https://xml.apache.org/axis/.
[next] |
Created: May 15, 2002
Revised: May 15, 2002
URL: https://webreference.com/programming/java/webservices/chap3/1/