You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by ru...@apache.org on 2007/03/01 13:35:15 UTC
svn commit: r513295 - in /webservices/synapse/trunk/java:
modules/core/src/main/java/org/apache/synapse/config/xml/
modules/core/src/main/java/org/apache/synapse/core/axis2/
repository/conf/sample/ src/site/resources/
Author: ruwan
Date: Thu Mar 1 04:35:14 2007
New Revision: 513295
URL: http://svn.apache.org/viewvc?view=rev&rev=513295
Log:
samples and documents updated acording to the new proxy behaviour and config
Modified:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java
webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_100.xml
webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_101.xml
webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_102.xml
webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_103.xml
webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_104.xml
webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_105.xml
webservices/synapse/trunk/java/src/site/resources/Synapse_Configuration_Language.html
webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java?view=diff&rev=513295&r1=513294&r2=513295
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ProxyServiceFactory.java Thu Mar 1 04:35:14 2007
@@ -133,14 +133,17 @@
OMElement target = elem.getFirstChildWithName(
new QName(Constants.SYNAPSE_NAMESPACE, "target"));
if (target != null) {
+ boolean isTargetOk = false;
SequenceMediatorFactory mediatorFactory = new SequenceMediatorFactory();
OMAttribute inSequence = target.getAttribute(new QName(Constants.NULL_NAMESPACE, "inSequence"));
if (inSequence != null) {
proxy.setTargetInSequence(inSequence.getAttributeValue());
+ isTargetOk = true;
} else {
OMElement inSequenceElement = target.getFirstChildWithName(new QName(Constants.SYNAPSE_NAMESPACE, "inSequence"));
if (inSequenceElement != null) {
proxy.setTargetInLineInSequence(mediatorFactory.createAnonymousSequence(inSequenceElement));
+ isTargetOk = true;
}
}
OMAttribute outSequence = target.getAttribute(new QName(Constants.NULL_NAMESPACE, "outSequence"));
@@ -164,12 +167,19 @@
OMAttribute tgtEndpt = target.getAttribute(new QName(Constants.NULL_NAMESPACE, "endpoint"));
if (tgtEndpt != null) {
proxy.setTargetEndpoint(tgtEndpt.getAttributeValue());
+ isTargetOk = true;
} else {
OMElement endpointElement = target.getFirstChildWithName(new QName(Constants.SYNAPSE_NAMESPACE, "endpoint"));
if (endpointElement != null) {
proxy.setTargetInLineEndpoint(EndpointFactory.createEndpoint(endpointElement, true));
+ isTargetOk = true;
}
}
+ if(!isTargetOk) {
+ handleException("Target of the proxy service must declare either an inSequence or endpoint or both");
+ }
+ } else {
+ handleException("Target is required for a Proxy service definition");
}
// read the WSDL, Schemas and Policies and set to the proxy service
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java?view=diff&rev=513295&r1=513294&r2=513295
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/ProxyServiceMessageReceiver.java Thu Mar 1 04:35:14 2007
@@ -108,16 +108,6 @@
Axis2FlexibleMEPClient.send(proxy.getTargetInLineEndpoint(), synCtx);
}
- // if neither the in sequence nor endpoint is specified send the message using the implicit parameters
- if (proxy.getTargetInSequence() == null && proxy.getTargetInLineInSequence() == null
- && proxy.getTargetEndpoint() == null && proxy.getTargetInLineEndpoint() == null) {
-
- org.apache.axis2.context.MessageContext messageContext
- = ((Axis2MessageContext) synCtx).getAxis2MessageContext();
- AxisEngine ae = new AxisEngine(messageContext.getConfigurationContext());
- ae.send(messageContext);
-
- }
} else {
log.error("Proxy Service with the name " + name + " does not exists - [Message dropped]");
throw new AxisFault("Proxy Service with the name " + name + " does not exists");
Modified: webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_100.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_100.xml?view=diff&rev=513295&r1=513294&r2=513295
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_100.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_100.xml Thu Mar 1 04:35:14 2007
@@ -23,25 +23,21 @@
hosted on Synapse based on the given WSDL and exposed over all available
transports for Synapse. If a proxy service should be exposed over only a sub set
of the available transports, use the transports attribute -->
- <definitions>
- <set-property name="proxy_wsdl" src="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
- </definitions>
<proxies>
<proxy name="StockQuoteProxy">
- <wsdl key="proxy_wsdl"/>
+ <target>
+ <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
+ </target>
+ <publishWSDL uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
</proxies>
<rules>
- <in>
- <send>
- <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
- </send>
- </in>
- <out>
- <send/>
- </out>
+ <log>
+ <property name="position" value="Main rules In mediator"/>
+ </log>
+ <send/>
</rules>
</synapse>
Modified: webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_101.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_101.xml?view=diff&rev=513295&r1=513294&r2=513295
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_101.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_101.xml Thu Mar 1 04:35:14 2007
@@ -40,7 +40,7 @@
</proxy>
<proxy name="StockQuoteProxy2">
- <wsdl key="proxy_wsdl"/>
+ <publishWSDL key="proxy_wsdl"/>
<target endpoint="proxy_2_endpoint"/>
</proxy>
</proxies>
Modified: webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_102.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_102.xml?view=diff&rev=513295&r1=513294&r2=513295
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_102.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_102.xml Thu Mar 1 04:35:14 2007
@@ -29,9 +29,17 @@
<proxies>
<proxy name="StockQuoteProxy">
- <wsdl key="proxy_wsdl"/>
+ <target>
+ <inSequence>
+ <header name="wsse:Security" action="remove"
+ xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"/>
+ <send>
+ <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
+ </send>
+ </inSequence>
+ </target>
+ <publishWSDL key="proxy_wsdl"/>
<policy key="sec_policy"/>
- <enableSec/>
</proxy>
</proxies>
Modified: webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_103.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_103.xml?view=diff&rev=513295&r1=513294&r2=513295
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_103.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_103.xml Thu Mar 1 04:35:14 2007
@@ -29,9 +29,17 @@
<proxies>
<proxy name="StockQuoteProxy">
- <wsdl key="proxy_wsdl"/>
+ <target>
+ <inSequence>
+ <header name="wsse:Security" action="remove"
+ xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"/>
+ <send>
+ <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
+ </send>
+ </inSequence>
+ </target>
+ <publishWSDL key="proxy_wsdl"/>
<policy key="sec_policy"/>
- <enableSec/>
</proxy>
</proxies>
Modified: webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_104.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_104.xml?view=diff&rev=513295&r1=513294&r2=513295
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_104.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_104.xml Thu Mar 1 04:35:14 2007
@@ -40,7 +40,7 @@
<proxies>
<proxy name="StockQuoteProxy">
- <wsdl key="proxy_wsdl"/>
+ <publishWSDL key="proxy_wsdl"/>
<target inSequence="proxy_in" outSequence="proxy_out"/>
</proxy>
</proxies>
Modified: webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_105.xml
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_105.xml?view=diff&rev=513295&r1=513294&r2=513295
==============================================================================
--- webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_105.xml (original)
+++ webservices/synapse/trunk/java/repository/conf/sample/synapse_sample_105.xml Thu Mar 1 04:35:14 2007
@@ -57,11 +57,11 @@
<proxies>
<proxy name="JMSFileUploadProxy" transports="jms">
<target inSequence="mtom_proxy"/>
- <property name="transport.jms.Wrapper" value="{http://services.samples/xsd}element"/>
+ <parameter name="transport.jms.Wrapper">{http://services.samples/xsd}element</parameter>
</proxy>
<proxy name="JMSTextProxy" transports="jms">
<target inSequence="text_proxy"/>
- <property name="transport.jms.Wrapper" value="{http://services.samples/xsd}text"/>
+ <parameter name="transport.jms.Wrapper">{http://services.samples/xsd}text</parameter>
</proxy>
<proxy name="JMSPoxProxy" transports="jms">
<target inSequence="pox_proxy"/>
Modified: webservices/synapse/trunk/java/src/site/resources/Synapse_Configuration_Language.html
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/src/site/resources/Synapse_Configuration_Language.html?view=diff&rev=513295&r1=513294&r2=513295
==============================================================================
--- webservices/synapse/trunk/java/src/site/resources/Synapse_Configuration_Language.html (original)
+++ webservices/synapse/trunk/java/src/site/resources/Synapse_Configuration_Language.html Thu Mar 1 04:35:14 2007
@@ -119,7 +119,7 @@
<pre> <endpoint name="string" [address="url"] [key="string"] [force="soap|pox"] [optimize="mtom|swa"]>
<enableRM/>?
<enableSec [policy="key"]/>?
- <enableAddressing separateListener="true|false"/>?
+ <enableAddressing�separateListener="true|false"/>?
.. extensibility ..
</endpoint></pre>
@@ -145,15 +145,23 @@
<p>A proxyservice token represents a <proxy> element which is used to
define a Synapse Proxy service.</p>
-<pre> <proxy name="string" [description="string"] [transports="(http |https |jms )+|all"]>
- <target (inSequence="name" outSequence="name") | endpoint="name"/>? // defaults to the synapse main sequence
- <wsdl key="string">?
- <enableRM/>?
- <enableSec/>?
- <policy key="string">* // optional service level policies
- // (e.g. WS-Security and/or WS-RM policies)
- <property name="string" value="string"/>* // optional service parameters
- // (e.g. transport.jms.ConnectionFactory)
+<pre> <proxy name="string" [transports="(http |https |jms )+|all"]>
+ <description>...</description>?
+ <target [inSequence="name"] [outSequence="name"] [faultSequence="name"] [endpoint="name"]>
+ <inSequence>...</inSequence>?
+ <outSequence>...</outSequence>?
+ <faultSequence>...</faultSequence>?
+ <endpoint>...</endpoint>?
+ </target>?
+ <publishWSDL key="string">
+ <endpoint>...</endpoint>?
+ <endpoint>...</endpoint>?
+ <publishWSDL>?
+ <policy key="string">...</policy>? // optional service level policies
+ // (e.g. WS-Security and/or WS-RM policies)
+ <parameter name="string"> // optional service parameters
+ string | xml // (e.g. transport.jms.ConnectionFactory)
+ </parameter>
</proxy></pre>
<p>A proxy service is created and exposed on the specified transports through
Modified: webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html?view=diff&rev=513295&r1=513294&r2=513295
==============================================================================
--- webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html (original)
+++ webservices/synapse/trunk/java/src/site/resources/Synapse_Samples.html Thu Mar 1 04:35:14 2007
@@ -1161,19 +1161,16 @@
<proxies>
<proxy name="StockQuoteProxy">
- <wsdl key="proxy_wsdl"/>
+ <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
+ <publishWSDL key="proxy_wsdl"/>
</proxy>
</proxies>
<rules>
- <in>
- <send>
- <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
- </send>
- </in>
- <out>
- <send/>
- </out>
+ <send/>
+ <log>
+ <property name="position" value="Inside Main Mediator"/>
+ </log>
</rules>
</synapse></pre>
@@ -1189,21 +1186,19 @@
http://localhost:8080/axis2/services/StockQuoteProxy?wsdl and view the WSDL
for the proxy service defined in the configuration. This WSDL is based on the
source WSDL supplied in the proxy service definition, and is updated to
-reflect the proxy service EPR. If a proxy service definition does not specify
-a target for its messages, the Synapse mediation rules are applied to route
-messages.</p>
+reflect the proxy service EPR.</p>
<p>Execute the stock quote client by requesting for a stock quote on the
proxy service as follows:</p>
<pre>ant stockquote -Durl=http://localhost:8080/axis2/services/StockQuoteProxy</pre>
-<p>You will now notice that the Synapse mediation rules were applied and the
-request was routed to the SimpleStockQuoteService service on the local Axis2
-instance. The response message is mediated using the same rules, as an
-outgoing sequence is not specified in this example either. The client should
-receive a stock quote reply from the proxy service. Also the client could get
-the WSDL for the proxy service by requesting for
-http://localhost:8080/axis2/services/StockQuoteProxy?wsdl</p>
+<p>You will now notice that the message is forwarded to the specified target
+endpoint and the request was routed to the SimpleStockQuoteService service on
+the local Axis2 instance. The response message is forwarded to the client with
+the help of the implicit parameters, as an outgoing sequence is not specified
+in this example either. The client should receive a stock quote reply from the
+proxy service. Also the client could get the WSDL for the proxy service by
+requesting for http://localhost:8080/axis2/services/StockQuoteProxy?wsdl</p>
<h2><a name="Sample101">Sample 101:</a></h2>
<pre><synapse xmlns="http://ws.apache.org/ns/synapse">
@@ -1224,12 +1219,12 @@
<proxies>
<proxy name="StockQuoteProxy1">
- <wsdl key="proxy_wsdl"/>
+ <publishWSDL key="proxy_wsdl"/>
<target inSequence="proxy_1"/>
</proxy>
<proxy name="StockQuoteProxy2">
- <wsdl key="proxy_wsdl"/>
+ <publishWSDL key="proxy_wsdl"/>
<target endpoint="proxy_2_endpoint"/>
</proxy>
</proxies>
@@ -1272,9 +1267,17 @@
<proxies>
<proxy name="StockQuoteProxy">
- <wsdl key="proxy_wsdl"/>
+ <target>
+ <inSequence>
+ <header name="wsse:Security" action="remove"
+ xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"/>
+ <send>
+ <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
+ </send>
+ </inSequence>
+ </target>
+ <publishWSDL key="proxy_wsdl"/>
<policy key="sec_policy"/>
- <enableSec/>
</proxy>
</proxies>
@@ -1337,11 +1340,6 @@
EPR is without any WS-Security headers as can be seen from the log
messages.</p>
-<p>Note: If you wish to engage the default WS-Security policy of Rampart on a
-proxy service, you could use the <enableSec/> option on a proxy service
-alone. This will be similar in function to 'engaging' Rampart on an Axis2
-service.</p>
-
<h2><a name="Sample103">Sample 103:</a></h2>
<pre><synapse xmlns="http://ws.apache.org/ns/synapse">
@@ -1355,9 +1353,17 @@
<proxies>
<proxy name="StockQuoteProxy">
- <wsdl key="proxy_wsdl"/>
+ <target>
+ <inSequence>
+ <header name="wsse:Security" action="remove"
+ xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"/>
+ <send>
+ <endpoint address="http://localhost:9000/axis2/services/SimpleStockQuoteService"/>
+ </send>
+ </inSequence>
+ </target>
+ <publishWSDL key="proxy_wsdl"/>
<policy key="sec_policy"/>
- <enableSec/>
</proxy>
</proxies>
@@ -1380,9 +1386,9 @@
services through WS-Policy</strong></p>
<p><strong>Pre-Requisites:</strong><br>
-Download and copy the BouncyCastle JAR file into your Synapse lib directory.
-(Note: the exact JAR you need to install depends on your JDK - for JDK 1.4 I
-have used bcprov-jdk13-132.jar)<br>
+Download and copy the BouncyCastle JAR and the Xalan JAR file into your Synapse lib directory.
+(Note: the exact BouncyCastle JAR you need to install depends on your JDK - for JDK 1.4 I
+have used bcprov-jdk13-132.jar and the xalan-2.7.0.jar)<br>
Start the Synapse configuration numbered 103: i.e. synapse -sample 103<br>
Copy the Apache Rampart module (e.g. rampart-1.1-SNAPSHOT.mar) into the
modules directory of the sample Axis2 client
@@ -1416,12 +1422,12 @@
<p>Using TCPMon, a sample request sent from the client to the WS-Security
enabled proxy service has been captured as follows: <a
-href="sample_103_1.txt">sample_103_1.txt</a></p>
+href="sample_103_1.txt?content-type=text&view=co">sample_103_1.txt</a></p>
<p>Synapse removes the wsse:Security header from this message and forwards it
to the endpoint. The response received is now signed and encrypted and sent
back to the client as follows: <a
-href="sample_103_2.txt">sample_103_2.txt</a></p>
+href="sample_103_2.txt?content-type=text&view=co">sample_103_2.txt</a></p>
<h2><a name="Sample104">Sample 104:</a></h2>
<pre><synapse xmlns="http://ws.apache.org/ns/synapse">
@@ -1447,7 +1453,7 @@
<proxies>
<proxy name="StockQuoteProxy">
- <wsdl key="proxy_wsdl"/>
+ <publishWSDL key="proxy_wsdl"/>
<target inSequence="proxy_in" outSequence="proxy_out"/>
</proxy>
</proxies>
@@ -1469,10 +1475,7 @@
<p>This configuration creates a proxy service with the name StockQuoteProxy.
This proxy service specifies both inSequence and the outSequence for that
service. This will add a proxy level out sequence to be used for the response
-message mediation of that particular proxy service. You could leave the whole
-target element not specified or one of the sequences of in and out
-unspecified, so that the corresponding message will be mediated using main
-mediator.</p>
+message mediation of that particular proxy service.</p>
<p>You could send a stock quote request to this proxy services and receive
the reply generated by the actual service hosted on the Axis2 instance. Use
@@ -1528,11 +1531,11 @@
<proxies>
<proxy name="JMSFileUploadProxy" transports="jms">
<target inSequence="mtom_proxy"/>
- <property name="transport.jms.Wrapper" value="{http://services.samples/xsd}element"/>
+ <parameter name="transport.jms.Wrapper">{http://services.samples/xsd}element</parameter>
</proxy>
<proxy name="JMSTextProxy" transports="jms">
<target inSequence="text_proxy"/>
- <property name="transport.jms.Wrapper" value="{http://services.samples/xsd}text"/>
+ <parameter name="transport.jms.Wrapper">{http://services.samples/xsd}text</parameter>
</proxy>
<proxy name="JMSPoxProxy" transports="jms">
<target inSequence="pox_proxy"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org