SOAP technology in Java

Source: Internet
Author: User
Tags soap tomcat

Before I begin, I would like to make some necessary description of the topic to be discussed in this article and the starting knowledge that the reader needs to have. The topic of this article is to discuss SOAP technology, and we'll make it as easy as possible, so we've introduced a common "Hello world" paradigm to give readers an idea of how they work and let readers know how they work. I think it's hard to start learning the new technology if you're looking at official documents, and the official document contains a lot of examples and explains all the features and benefits, but doesn't explain how they work. In this article, I'm not going to explain the definition of SOAP technology only superficially, we assume that the reader is familiar with the Java language, Web technology, XML language, and the basis of XML Namespaces,xml schema. In this case, there is no difficulty in understanding this article. However, even without this knowledge, you don't have to worry, we will explain as simply as possible, but when you start to do your own SOAP application you will encounter some problems and trouble. Therefore, it is necessary to spend a certain amount of time to learn the above knowledge.

From a technical point of view, it is necessary to mention our debugging environment. We are using the Windows XP operating system, which is installed with the Java 2 SDK 1.4.1,apache SOAP 2.3.1,jaf 1.0.2,javamail 1.3.1 and Xerces 2.6.0. All of the above mentioned can operate normally in the Tcomcat 4.1.29 jsp/servlet container. All software is free free software, so you can easily download them and install them on any platform you like, such as Windows or UNIX. Java Sdk,jaf and JavaMail are located on Sun's official website (http://java.sun.com), and other software has down on the Jakarta Project team's official website (http://jakarta.apache.org). Maybe you're a little worried and upset when you see that we need so many different bags, but you shouldn't be worrying about that package. Once you understand the basics, it will be quite easy for you. Installation is not a very difficult thing, you only need to be careful when setting environment variables, such as Catalina_home, CLASSPATH, java_home, etc., all of these steps are handmade. Since I just want to focus your attention on them again, you can quickly complete the configuration process. I just add some of the following strings to Tomcat's Bin/setclasspath.bat file:

...
set CATALINA_HOME=C:\Tomcat4.1.29
set CLASSPATH=%JAVA_HOME%\lib\tools.jar
set CLASSPATH=%JAVA_HOME%\soap-2.3.1\lib\soap.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\javamail-1.3.1\mail.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\jaf-1.0.2\activation.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\xerces-2_6_0\xercesImpl.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\xerces-2_6_0\xercesSamples.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\xerces-2_6_0\xml-apis.jar
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%\xerces-2_6_0\xmlParserAPIs.jar
set CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\common\lib\servlet.jar
set CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\common\lib\tools.jar
...

If your installation path (installation paths) differs from the one used above, you need to correct them, and then shut down and restart Tomcat to make them effective. In this way, you are ready to run soap. But now, I want to forget about the technical part, to learn a little theoretical knowledge.

Soap means a Simple Object Access Protocol (PROTOCOL). Indeed, as its name is, soap is simple. It is an xml-based protocol that allows program components and applications to communicate with each other using a standard Internet Protocol--http. SOAP is a stand-alone platform that does not rely on the programming language, which is simple, resilient, and easily extensible. At present, applications can communicate with each other using a remote procedure call (RPC) based on DCOM and CORBA technology, but HTTP is not designed for this purpose. RPC is very difficult to apply on the Internet, and there are many compatibility and security issues because firewalls and proxy servers typically block these types of traffic. The best way to communicate between applications is through the HTTP protocol, because HTTP supports all Internet browsers and servers. For this purpose, the SOAP protocol is created.

So, how do they work? For example, an application (a) needs to communicate with another application (B) with the help of soap. They will use the following frame diagram to complete this process:

This SOAP envelope (SOAP envelope) is an XML document that contains the following:

Related Article

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.