I.SYNAPSEIntroduction
SYNAPSE is a simple XML and Web Service Management and integration proxy that can be used to form the basis of SOA and Enterprise Service Bus (ESB. SYNAPSE is a mature Apache activity in a Web Service Project, and is a branch of a very successful Apache axis2 project. It provides mediation, management, and the ability to convert XML messages between different applications.
Look at the Official Architecture Diagram
II.Official example
1. Prepare the environment
- A Java 2 se-JDK or JRE of version 1.5.x or higher (JDK 1.6.0 _ 21 recommended)
- Apache ant http://ant.apache.org
2. log record example
In this example, only executed calls are executed to execute the logging function.
Download synapse: http://synapse.apache.org/download.html
Decompress the package. The <synapse-Home> mentioned below is the root directory of the unzipped package. Go to <synapse-Home>/samples/axis2server/src/simplestockquoteservice.
Run ant
After successful execution, start the service in the <synapse-Home>/samples/axis2server directory.
Axis2server. bat
Start
Start SYNAPSE
Go to the <synapse-Home>/Repository/CONF/sample directory and check the file synapse_sample_0.xml.
<!-- Introduction to Synapse --><definitions xmlns="http://ws.apache.org/ns/synapse" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ws.apache.org/ns/synapse http://synapse.apache.org/ns/2010/04/configuration/synapse_config.xsd"> <sequence name="main"> <!-- log all attributes of messages passing through --> <log level="full"/> <!-- Send the message to implicit destination --> <send/> </sequence></definitions>
Define to record all passed log messages
Start synapse in the <synapse-Home>/bin directory.
Run synapse. Bat-sample 0.
As shown in, the startup is successful.
Run the client
<Synapse-Home>/samples/axis2client directory
Run ant stockquote-daddurl = http: // localhost: 9000/services/simplestockquoteservice-dtrpurl = http: // localhost: 8280-dmode = quote-dsymbol = IBM
View release results
HTTP: /localhost: 9000/services/simplestockquoteservice
Run other sample programs as above.
Publish Using proxy service
<!-- Introduction to proxy services --><definitions xmlns="http://ws.apache.org/ns/synapse" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ws.apache.org/ns/synapse http://synapse.apache.org/ns/2010/04/configuration/synapse_config.xsd"> <proxy name="StockQuoteProxy"> <target> <endpoint> <address uri="http://localhost:9000/services/SimpleStockQuoteService"/> </endpoint> <outSequence> <send/> </outSequence> </target> <publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/> </proxy></definitions>
Start the synapse Service
SYNAPSE. Bat-sample 150
Run the client
Ant stockquote-dtrpurl = http: // localhost: 8280/services/ST