| <?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 50</title> |
| </properties> |
| <body> |
| <section name="Sample 50: POX to SOAP Conversion"> |
| <div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse"> |
| |
| <sequence name="main"> |
| <!-- filtering of messages with XPath and regex matches --> |
| <filter source="get-property('To')" regex=".*/StockQuote.*"> |
| <then> |
| <send> |
| <endpoint> |
| <address uri="http://localhost:9000/services/SimpleStockQuoteService" format="soap11"/> |
| </endpoint> |
| </send> |
| <drop/> |
| </then> |
| </filter> |
| <send/> |
| </sequence> |
| |
| </definitions></div> |
| <subsection name="Objective"> |
| <p> |
| Demonstrating how to convert a POX (Plain Old XML) message to a standard SOAP 1.1 |
| request. |
| </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 50 (repository/conf/sample/synapse_sample_50.xml) |
| <div class="command"> |
| Unix/Linux: sh synapse.sh -sample 50<br/> |
| Windows: synapse.bat -sample 50 |
| </div> |
| </li> |
| </ul> |
| </p> |
| </subsection> |
| <subsection name="Executing the Client"> |
| <p> |
| Execute the sample client as follows and send a plain XML getQuote request to |
| Synapse. |
| </p> |
| <div class="command">ant stockquote -Dtrpurl=http://localhost:8280/services/StockQuote -Drest=true</div> |
| |
| <p> |
| The request sent by the client will look something like this. |
| </p> |
| <div class="consoleOutput">POST /services/StockQuote HTTP/1.1 |
| Content-Type: application/xml; charset=UTF-8;action="urn:getQuote"; |
| SOAPAction: urn:getQuote |
| User-Agent: Axis2 |
| Host: 127.0.0.1 |
| Transfer-Encoding: chunked |
| |
| 75 |
| <m0:getQuote xmlns:m0="http://services.samples"> |
| <m0:request> |
| <m0:symbol>IBM</m0:symbol> |
| </m0:request> |
| </m0:getQuote>0</div> |
| <p> |
| Note that this is simply an XML payload going over the HTTP connection. It is |
| not a SOAP envelope and hence the content type is set to application/xml. Synapse |
| will convert the above message to a valid SOAP 1.1 request and send to the sample |
| Axis2 server. The response from Axis2 will also be a SOAP message, which will |
| be converted back to POX format before sending back to the client. |
| </p> |
| </subsection> |
| </section> |
| <p><a href="../samples.html">Back to Catalog</a></p> |
| </body> |
| </document> |