<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
  ~  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.
  -->

<document>
    <properties>
        <title>Apache Synapse - Sample 151</title>
    </properties>
    <body>
        <section name="Sample 151: Custom Sequences and Endpoints with Proxy Services">
            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;

    &lt;localEntry key="proxy_wsdl"
                src="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/&gt;

    &lt;endpoint name="proxy_2_endpoint"&gt;
        &lt;address uri="http://localhost:9000/services/SimpleStockQuoteService"/&gt;
    &lt;/endpoint&gt;

    &lt;sequence name="proxy_1"&gt;
        &lt;send&gt;
            &lt;endpoint&gt;
                &lt;address uri="http://localhost:9000/services/SimpleStockQuoteService"/&gt;
            &lt;/endpoint&gt;
        &lt;/send&gt;
    &lt;/sequence&gt;

    &lt;sequence name="out"&gt;
        &lt;send/&gt;
    &lt;/sequence&gt;

    &lt;proxy name="StockQuoteProxy1"&gt;
        &lt;target inSequence="proxy_1" outSequence="out"/&gt;
        &lt;publishWSDL key="proxy_wsdl"/&gt;
    &lt;/proxy&gt;

    &lt;proxy name="StockQuoteProxy2"&gt;
        &lt;target endpoint="proxy_2_endpoint" outSequence="out"/&gt;
        &lt;publishWSDL key="proxy_wsdl"/&gt;
    &lt;/proxy&gt;

&lt;/definitions&gt;</div>
            <subsection name="Objective">
                <p>
                    Demonstrate how to use predefined endpoints and sequences in a proxy service
                </p>
            </subsection>
            <subsection name="Pre-requisites">
                <p>
                    <ul>
                        <li>
                            Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
                        </li>
                        <li>
                            Start Synapse using the configuration numbered 151 (repository/conf/sample/synapse_sample_151.xml)
                            <div class="command">
                                Unix/Linux: sh synapse.sh -sample 151<br/>
                                Windows: synapse.bat -sample 151
                            </div>
                        </li>
                    </ul>
                </p>
            </subsection>
            <subsection name="Executing the Client">
                <p>
                    This configuration creates two proxy services. The first proxy service
                    'StockQuoteProxy1' uses the sequence named 'proxy_1' to process incoming
                    messages and the sequence named 'out' to process outgoing responses. The second
                    proxy service, 'StockQuoteProxy2' is set to directly forward messages to the
                    endpoint named 'proxy_2_endpoint' without any mediation.
                </p>
                <p>
                    You can send a stock quote request to each of these proxy services and receive
                    the reply generated by the actual service hosted on the Axis2 server instance.
                </p>
                <div class="command">ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy1
<br/>ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy2</div>
            </subsection>
        </section>
        <p><a href="../samples.html">Back to Catalog</a></p>        
    </body>
</document>