2011年10月21日星期五

UGG Sale Mule entry document

Mule entry documents 2010-12-29 10:33 Mule entry documents
zero, provided
operate in accordance with this article before, assume that your system already has the following premise:
have installed Sun's JDK1.4 or JDK5.0 version, it is recommended to use JDK5.0.
JAVA_HOME environment variable is correctly set to the JDK directory (note not the JRE directory).
ensure that the% JAVA_HOME% bin path to find the path in the system.
Eclipse3.2 or later installed development environment.
installed Apache Tomcat 5.0 or later is recommended to use 5.5. Document assumes that Tomcat installation directory to% TOMCAT_HOME%.
First, download and install
to the Mule's official website () to download the latest stable version of Mule is currently 1.3.3 (), you can use the community version 1.4.1 (). This document is version 1.3.3, for example, modify the document please refer to 1.4.1.
download to get a ZIP compressed file format mule-1.3.3.zip,UGG Sale, extract the files to any directory, assumed to be C: mule-1.3.3, this document indicates that the environment variable MULE_HOME directory .
Second, run the Echo sample
Mule comes with a lot of examples, from simple echo example to a more complete loan intermediary services loanbroker. Each sample program is divided into two versions of ant and maven, which are located in the% MULE_HOME% examples ant and% MULE_HOME% examples maven directory. Ant version of the document will be an example how to run the echo sample.
1, to the official website of apache ant project download page () to download ant1.7.0 (), will extract the files to download to any directory (assumed to be C: apache-ant-1.7.0, documentation expressed as ANT_HOME environment variable).
2, set the environment variable ANT_HOME to ant the extracted directory, such as:
ANT_HOME = C: apache-ant-1.7.0 3, the% ANT_HOME% bin to the system search path, such as:
PATH =% ANT_HOME% bin;% PATH%
4, start a command line window, enter% MULE_HOME% examples ant echo directory, execute the following command:
echo.bat
example License the program will first display a message,UGG Sale, some logging output, culminating in the following information:
INFO 2007-08-29 16:54:44,062 [WrapperSimpleAppMain] org.mule.MuleManager:
*
* Mule ESB and Integration Platform version Not Set *
* Not Set *
* For more information go to *
**
* Server started: 2007 年 8 Wednesday, 29 16:54 42 seconds CST *
* Server ID: Mule_Echo_Sample *
* JDK: 1.5.0_11 (mixed mode, sharing) *
* OS: Windows XP-Service Pack 2 (5.1, x86) *
* Host: zengfl (192.168.25.71) *
**
* Agents Running: *
* Mule Admin: accepting connections on tcp: / / localhost: 60504 *
*
INFO 2007 -08-29 16:54:44,062 [WrapperSimpleAppMain] org.mule.MuleServer: Mule S
erver initialized.
Please enter something:
said sample program runs successfully, just enter a few characters, these characters are Echo out at the same time, echo processing log information is also displayed.
Note that in this step, make sure you can access the Internet, otherwise,UGG Sale, the sample can not run.
Third, a simple Mule Java Application
Here, Echo of a similar Java Application example of how to build applications using Mule. Will explain later how to integrate Web applications Mule.
1, in Eclipse, a Java Application, the Application command MuleAppTest.
2, in the Package Explorer view, select the newly created MuleAppTest project, press Alt + Enter key to open the project's property dialog box, find the Java Build Path menu, open the right side of the Libraries tab.
3, click on bin opt directory of the jar file is not required, you can select the package you want to join, this is actually only use the Web Service associated with some libraries).
4, in the source directory (src) under a EchoService interface and implementation class EchoServiceImpl.
EchoService.java packagecom.san.mule;
publicinterfaceEchoService {
publicString echo (String s);
}
EchoServiceImpl.java packagecom.san.mule;
publicclassEchoServiceImplimplementsEchoService {
publicString echo (String s) {
returns;
}
}
5, in the source directory (src) under a mule-config.xml file for Mule configuration entry endpoint and The endpoint published as a Web service-based axis.
mule-config.xml
? xmlversion = DOCTYPEmule-configurationPUBLIC com.san.mule.EchoService
MuleAppTest.java packagecom.san.mule;
importorg.mule.config.ConfigurationException;
importorg.mule.config.builders.MuleXmlConfigurationBuilder;
importorg.mule.umo.manager.UMOManager; < br> publicclassMuleAppTest {
publicstaticvoidmain (String args) throwsConfigurationException {
MuleXmlConfigurationBuilder builder = newMuleXmlConfigurationBuilder ();
UMOManager manager = builder.configure (>}
7, in MuleAppTest.java right click and select Run As menu in Java Application running MuleAppTest class.
8, open the browser, to access, you can see the service description.
9, we have to run this Web Service to see if it can run correctly in the browser address bar:
four, in the Web Application to continue to integrate Mule
previous project, we will integrate Mule to a Web Application in Tomcat, and use a JSP page to access Mule components.
1, to create a Web Application in the project related to the directory WEB-INF, WEB-INF lib and WEB-INF classes.
2, the% MULE_HOME% lib mule directory and% MULE_HOME% lib opt directory of all files to the project's WEB-INF lib directory.
The% MULE_HOME% lib user activation.jar and% MULE_HOME% lib user mail.jar two files to the project's WEB-INF lib directory. (Note that if you do not find these two documents, it is because you do not succeed to run the test program in section II.)
3, the project's output folder set to the project's WEB-INF/classes directory.
4, the project src directory under the mule-config.xml file to the project's WEB-INF directory.
Note that when you set the project's output folder to WEB-INF/classes, the directory will disappear from the Package Explorer, it is normal now, you can find in the Navigator view this directory.
5, the establishment of WEB-INF web.xml file.
web.xml
? xmlversion = DOCTYPEweb-appPUBLIC WEB-INF/mule-config.xml, / param-value
/ context-param listener listener-class org.mule.config.builders.MuleXmlBuilderContextListener
/ listener-class
/ listener servlet servlet-namemuleServlet / servlet-name servlet-class org.mule.providers.http.servlet.MuleReceiverServlet
/ servlet-class load-on-startup /
/ servlet servlet-mapping servlet-namemuleServlet/servlet-name url-pattern / services / * / url-pattern
/ servlet-mapping
/ web-app 6, create a test page echo.jsp
% @ pagelanguage = = UTF-8 Mule Web Application Test / title
/ head body
%
String s = request.getParameter (();
UMOMessage message = client.send (
name
formmethod = = % webapp directory, start Tomcat, enter your name to access
test, OK.

没有评论:

发表评论