<!-- | |
~ Licensed to the Apache Software Foundation (ASF) under one | |
~ or more contributor license agreements. See the NOTICE file | |
~ distributed with this work for additional information | |
~ regarding copyright ownership. The ASF licenses this file | |
~ to you under the Apache License, Version 2.0 (the | |
~ "License"); you may not use this file except in compliance | |
~ with the License. You may obtain a copy of the License at | |
~ | |
~ http://www.apache.org/licenses/LICENSE-2.0 | |
~ | |
~ Unless required by applicable law or agreed to in writing, | |
~ software distributed under the License is distributed on an | |
~ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
~ KIND, either express or implied. See the License for the | |
~ specific language governing permissions and limitations | |
~ under the License. | |
--> | |
<synapse xmlns="http://ws.apache.org/ns/synapse"> | |
<!-- illustration of simple properties, and reusable endpoints and sequences --> | |
<definitions> | |
<!-- define a string literal property --> | |
<set-property name="version" value="0.1"/> | |
<!-- define a reuseable endpoint definition --> | |
<endpoint name="simple" | |
address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/> | |
<!-- define a reusable sequence --> | |
<sequence name="stockquote"> | |
<!-- log the message using the custom log level. illustrates custom properties for log messages --> | |
<log level="custom"> | |
<property name="Text" value="Sending quote request"/> | |
<property name="version" expression="get-property('version')"/> | |
<property name="symbol" expression="get-property('symbol')"/> | |
</log> | |
<!-- send message to real endpoint referenced by name "stockquote" endpoint definition --> | |
<send> | |
<endpoint ref="simple"/> | |
</send> | |
</sequence> | |
</definitions> | |
<rules> | |
<!-- match the 'To' EPR to the given regex --> | |
<filter source="get-property('To')" regex=".*/SimpleStockQuoteService.*"> | |
<!-- set a custom local message property based on the stock code requested --> | |
<switch source="//m0:getQuote/m0:request/m0:symbol" | |
xmlns:m0="http://services.samples/xsd"> | |
<case regex="IBM"> | |
<set-property name="symbol" value="Great stock - IBM"/> | |
</case> | |
<case regex="MSFT"> | |
<set-property name="symbol" value="Are you sure? - MSFT"/> | |
</case> | |
<default> | |
<!-- it is possible to assign the result of an XPath expression as the value of a local message property --> | |
<set-property name="symbol" | |
expression="fn:concat('Normal Stock - ', //m0:getQuote/m0:request/m0:symbol)" | |
xmlns:m0="http://services.samples/xsd"/> | |
</default> | |
</switch> | |
<!-- invoke an already defined [reusable] sequence at this point --> | |
<sequence ref="stockquote"/> | |
</filter> | |
<!-- Log all messages passing through --> | |
<log level="full"/> | |
<!-- Send the messages where they have been sent (i.e. implicit To EPR) --> | |
<send/> | |
</rules> | |
</synapse> |