<?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 56</title>
    </properties>
    <body>
        <section name="Sample 56: WSDL Endpoint">
            <div class="xmlConf">&lt;definitions xmlns="http://ws.apache.org/ns/synapse"&gt;

    &lt;sequence name="main"&gt;
        &lt;in&gt;
            &lt;send&gt;
                &lt;!-- get epr from the given wsdl --&gt;
                &lt;endpoint&gt;
                    &lt;wsdl uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"
                          service="SimpleStockQuoteService"
                          port="SimpleStockQuoteServiceHttpSoap11Endpoint"/&gt;
                &lt;/endpoint&gt;
            &lt;/send&gt;
        &lt;/in&gt;

        &lt;out&gt;
            &lt;send/&gt;
        &lt;/out&gt;
    &lt;/sequence&gt;

&lt;/definitions&gt;</div>
            <subsection name="Objective">
                <p>
                    Showcase the ability of Synapse to use a WSDL as the target endpoint
                </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 56 (repository/conf/sample/synapse_sample_56.xml)
                            <div class="command">
                                Unix/Linux: sh synapse.sh -sample 56<br/>
                                Windows: synapse.bat -sample 56
                            </div>
                        </li>
                    </ul>
                </p>
            </subsection>
            <subsection name="Executing the Client">
                <p>
                    This sample uses a WSDL endpoint inside the send mediator. WSDL endpoints can
                    extract endpoint's address from the given WSDL. As WSDL documents can have many
                    services and many ports inside each service, the service and port of the
                    required endpoint has to be specified. As with address endpoints, QoS parameters
                    for the endpoint can be specified in-line in the configuration. An excerpt taken
                    from the sample_proxy_1.wsdl containing the specified service and port is
                    listed below.
                </p>
                <div class="xmlConf">&lt;wsdl:service name="SimpleStockQuoteService"&gt;
    &lt;wsdl:port name="SimpleStockQuoteServiceHttpSoap11Endpoint" binding="ns:SimpleStockQuoteServiceSoap11Binding"&gt;
        &lt;soap:address location="http://localhost:9000/services/SimpleStockQuoteService.SimpleStockQuoteServiceHttpSoap11Endpoint"/&gt;
    &lt;/wsdl:port&gt;
    &lt;wsdl:port name="SimpleStockQuoteServiceHttpSoap12Endpoint" binding="ns:SimpleStockQuoteServiceSoap12Binding"&gt;
        &lt;soap12:address location="http://localhost:9000/services/SimpleStockQuoteService.SimpleStockQuoteServiceHttpSoap12Endpoint"/&gt;
    &lt;/wsdl:port&gt;
&lt;/wsdl:service&gt;</div>
                <p>
                    Specified service and port refers to the endpoint address 'http://localhost:9000/services/SimpleStockQuoteService.SimpleStockQuoteServiceHttpSoap11Endpoint'
                    according to the above WSDL. Now run the client using the following command.
                </p>
                <div class="command">ant stockquote -Daddurl=http://localhost:8280/</div>
                <p>
                    Client will print the quote price for IBM received from the server running on
                    port 9000.
                </p>
                <div class="consoleOutput">Standard :: Stock price = $95.26454380258552</div>
            </subsection>
        </section>
        <p><a href="../samples.html">Back to Catalog</a></p>        
    </body>
</document>