Author: hiranya
Date: Wed Aug 7 04:30:27 2013
New Revision: 1511170
URL: http://svn.apache.org/r1511170
Log:
Improving callout mediator to support separate inbound and outbound security
policies. Applied patches from SYNAPSE-960 SYNAPSE-961 and SYNAPSE-962
Added:
synapse/trunk/java/modules/documentation/src/site/xdoc/userguide/samples/sample432.xml
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/advanced/Sample432.java
synapse/trunk/java/modules/integration/src/test/resources/extras/synapse_sample_432_altered.xml
synapse/trunk/java/modules/integration/src/test/resources/sample432.xml
synapse/trunk/java/repository/conf/sample/synapse_sample_432.xml
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CalloutMediatorFactory.java
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CalloutMediatorSerializer.java
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/CalloutMediator.java
synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/CalloutMediatorSerializationTest.java
synapse/trunk/java/modules/documentation/src/site/xdoc/userguide/samples.xml
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/TestSamplesHandlerSuite.java
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/advanced/Sample431.java
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CalloutMediatorFactory.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CalloutMediatorFactory.java?rev=1511170&r1=1511169&r2=1511170&view=diff
==============================================================================
---
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CalloutMediatorFactory.java
(original)
+++
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CalloutMediatorFactory.java
Wed Aug 7 04:30:27 2013
@@ -38,6 +38,7 @@ import java.util.Properties;
* <configuration [axis2xml="string"] [repository="string"]/>?
* <source xpath="expression" | key="string">
* <target xpath="expression" | key="string"/>
+ * <enableSec policy="string" | outboundPolicy="String" |
inboundPolicy="String" />?
* <enableSec policy="string" />?
* </callout>
* </pre>
@@ -60,7 +61,11 @@ public class CalloutMediatorFactory exte
private static final QName Q_SEC
= new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "enableSec");
private static final QName ATT_POLICY
- = new QName(XMLConfigConstants.NULL_NAMESPACE, "policy");
+ = new QName(XMLConfigConstants.NULL_NAMESPACE, "policy");
+ private static final QName ATT_OUTBOUND_SEC_POLICY
+ = new QName(XMLConfigConstants.NULL_NAMESPACE,
"outboundPolicy");
+ private static final QName ATT_INBOUND_SEC_POLICY
+ = new QName(XMLConfigConstants.NULL_NAMESPACE,
"inboundPolicy");
public Mediator createSpecificMediator(OMElement elem, Properties
properties) {
@@ -152,11 +157,21 @@ public class CalloutMediatorFactory exte
}
if (wsSec != null) {
+ callout.setSecurityOn(true);
OMAttribute policyKey = wsSec.getAttribute(ATT_POLICY);
+ OMAttribute outboundPolicyKey =
wsSec.getAttribute(ATT_OUTBOUND_SEC_POLICY);
+ OMAttribute inboundPolicyKey =
wsSec.getAttribute(ATT_INBOUND_SEC_POLICY);
if (policyKey != null) {
- callout.setSecurityOn(true);
callout.setWsSecPolicyKey(policyKey.getAttributeValue());
+ } else if (outboundPolicyKey != null || inboundPolicyKey != null) {
+ if (outboundPolicyKey != null) {
+
callout.setOutboundWsSecPolicyKey(outboundPolicyKey.getAttributeValue());
+ }
+ if (inboundPolicyKey != null) {
+
callout.setInboundWsSecPolicyKey(inboundPolicyKey.getAttributeValue());
+ }
} else {
+ callout.setSecurityOn(false);
handleException("A policy key is required to enable security");
}
}
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CalloutMediatorSerializer.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CalloutMediatorSerializer.java?rev=1511170&r1=1511169&r2=1511170&view=diff
==============================================================================
---
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CalloutMediatorSerializer.java
(original)
+++
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/CalloutMediatorSerializer.java
Wed Aug 7 04:30:27 2013
@@ -29,7 +29,7 @@ import org.apache.synapse.mediators.buil
* <configuration [axis2xml="string"] [repository="string"]/>?
* <source xpath="expression" | key="string">
* <target xpath="expression" | key="string"/>
- * <enableSec policy="string"/>?
+ * <enableSec policy="string" | outboundPolicy="String" |
inboundPolicy="String" />?
* </callout>
* </pre>
*/
@@ -84,10 +84,23 @@ public class CalloutMediatorSerializer e
"key", nullNS, mediator.getTargetKey()));
}
- if (mediator.isSecurityOn() && mediator.getWsSecPolicyKey() != null) {
- OMElement security = fac.createOMElement("enableSec", synNS,
callout);
- security.addAttribute(fac.createOMAttribute(
- "policy", nullNS, mediator.getWsSecPolicyKey()));
+ if (mediator.isSecurityOn()) {
+ OMElement security = fac.createOMElement("enableSec", synNS);
+ if (mediator.getWsSecPolicyKey() != null) {
+ security.addAttribute(fac.createOMAttribute(
+ "policy", nullNS, mediator.getWsSecPolicyKey()));
+ callout.addChild(security);
+ } else if (mediator.getOutboundWsSecPolicyKey() != null ||
mediator.getInboundWsSecPolicyKey() != null) {
+ if (mediator.getOutboundWsSecPolicyKey() != null) {
+ security.addAttribute(fac.createOMAttribute(
+ "outboundPolicy", nullNS,
mediator.getOutboundWsSecPolicyKey()));
+ }
+ if (mediator.getInboundWsSecPolicyKey() != null) {
+ security.addAttribute(fac.createOMAttribute(
+ "inboundPolicy", nullNS,
mediator.getInboundWsSecPolicyKey()));
+ }
+ callout.addChild(security);
+ }
}
return callout;
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/CalloutMediator.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/CalloutMediator.java?rev=1511170&r1=1511169&r2=1511170&view=diff
==============================================================================
---
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/CalloutMediator.java
(original)
+++
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/CalloutMediator.java
Wed Aug 7 04:30:27 2013
@@ -48,7 +48,7 @@ import java.util.List;
* <configuration [axis2xml="string"] [repository="string"]/>?
* <source xpath="expression" | key="string"> <!-- key can be a MC
property or entry key -->
* <target xpath="expression" | key="string"/>
- * <enableSec policy="string"/>?
+ * <enableSec policy="string" | outboundPolicy="String" |
inboundPolicy="String"/>?
* </callout>
*/
public class CalloutMediator extends AbstractMediator implements
ManagedLifecycle {
@@ -67,6 +67,8 @@ public class CalloutMediator extends Abs
public final static String DEFAULT_AXIS2_XML =
"./samples/axis2Client/client_repo/conf/axis2.xml";
private boolean securityOn = false; //Should messages be sent using
WS-Security?
private String wsSecPolicyKey = null;
+ private String inboundWsSecPolicyKey = null;
+ private String outboundWsSecPolicyKey = null;
public boolean mediate(MessageContext synCtx) {
@@ -92,11 +94,19 @@ public class CalloutMediator extends Abs
options.setProperty(
SynapseConstants.RAMPART_POLICY,
MessageHelper.getPolicy(synCtx, wsSecPolicyKey));
- sc.engageModule(SynapseConstants.SECURITY_MODULE_NAME);
} else {
- handleException("Security policy not found", synCtx);
+ if (inboundWsSecPolicyKey != null) {
+ options.setProperty(SynapseConstants.RAMPART_IN_POLICY,
+ MessageHelper.getPolicy(
+ synCtx,
inboundWsSecPolicyKey));
+ }
+ if (outboundWsSecPolicyKey != null) {
+
options.setProperty(SynapseConstants.RAMPART_OUT_POLICY,
+ MessageHelper.getPolicy(
+ synCtx,
outboundWsSecPolicyKey));
+ }
}
-
+ sc.engageModule(SynapseConstants.SECURITY_MODULE_NAME);
}
options.setTo(new EndpointReference(serviceURL));
@@ -375,4 +385,45 @@ public class CalloutMediator extends Abs
public void setWsSecPolicyKey(String wsSecPolicyKey) {
this.wsSecPolicyKey = wsSecPolicyKey;
}
+
+ /**
+ * Get the outbound security policy key. This is used when we specify
different policies for
+ * inbound and outbound.
+ *
+ * @return outbound security policy key
+ */
+ public String getOutboundWsSecPolicyKey() {
+ return outboundWsSecPolicyKey;
+ }
+
+ /**
+ * Set the outbound security policy key.This is used when we specify
different policies for
+ * inbound and outbound.
+ *
+ * @param outboundWsSecPolicyKey outbound security policy key.
+ */
+ public void setOutboundWsSecPolicyKey(String outboundWsSecPolicyKey) {
+ this.outboundWsSecPolicyKey = outboundWsSecPolicyKey;
+ }
+
+ /**
+ * Get the inbound security policy key. This is used when we specify
different policies for
+ * inbound and outbound.
+ *
+ * @return inbound security policy key
+ */
+ public String getInboundWsSecPolicyKey() {
+ return inboundWsSecPolicyKey;
+ }
+
+ /**
+ * Set the inbound security policy key. This is used when we specify
different policies for
+ * inbound and outbound.
+ *
+ * @param inboundWsSecPolicyKey inbound security policy key.
+ */
+ public void setInboundWsSecPolicyKey(String inboundWsSecPolicyKey) {
+ this.inboundWsSecPolicyKey = inboundWsSecPolicyKey;
+ }
+
}
Modified:
synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/CalloutMediatorSerializationTest.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/CalloutMediatorSerializationTest.java?rev=1511170&r1=1511169&r2=1511170&view=diff
==============================================================================
---
synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/CalloutMediatorSerializationTest.java
(original)
+++
synapse/trunk/java/modules/core/src/test/java/org/apache/synapse/config/xml/CalloutMediatorSerializationTest.java
Wed Aug 7 04:30:27 2013
@@ -75,5 +75,20 @@ public class CalloutMediatorSerializatio
assertTrue(serialization(inputXml, calloutMediatorFactory,
calloutMediatorSerializer));
assertTrue(serialization(inputXml, calloutMediatorSerializer));
}
+
+ public void testCalloutMediatorSerializationScenarioFour() {
+ String inputXml = "<callout
xmlns=\"http://ws.apache.org/ns/synapse\" " +
+
"serviceURL=\"http://localhost:9000/soap/SimpleStockQuoteService\" " +
+ "action=\"urn:getQuote\"><source
xmlns:s11=\"http://schemas.xmlsoap.org/" +
+ "soap/envelope/\"
xmlns:s12=\"http://www.w3.org/2003/05/soap-envelope\" " +
+ "xpath=\"s11:Body/child::*[fn:position()=1] |
s12:Body/child::*[fn:position()=1]\"/>" +
+ "<target
xmlns:s11=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
+ "xmlns:s12=\"http://www.w3.org/2003/05/soap-envelope\"
xpath=\"s11:Body/" +
+ "child::*[fn:position()=1] |
s12:Body/child::*[fn:position()=1]\"/>" +
+ "<enableSec outboundPolicy=\"out_sec_policy\"
inboundPolicy=\"in_sec_policy\"/></callout>";
+ assertTrue(serialization(inputXml, calloutMediatorFactory,
calloutMediatorSerializer));
+ assertTrue(serialization(inputXml, calloutMediatorSerializer));
+ }
+
}
Modified:
synapse/trunk/java/modules/documentation/src/site/xdoc/userguide/samples.xml
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/documentation/src/site/xdoc/userguide/samples.xml?rev=1511170&r1=1511169&r2=1511170&view=diff
==============================================================================
---
synapse/trunk/java/modules/documentation/src/site/xdoc/userguide/samples.xml
(original)
+++
synapse/trunk/java/modules/documentation/src/site/xdoc/userguide/samples.xml
Wed Aug 7 04:30:27 2013
@@ -199,6 +199,7 @@
<ul>
<li><a href="samples/sample430.html">Sample 430:
Callout mediator for synchronous web service invocations</a></li>
<li><a href="samples/sample431.html">Sample 431:
Callout Mediator with WS-Security for Outgoing Messages</a></li>
+ <li><a href="samples/sample432.html">Sample 432:
Callout Mediator - Invoke a secured service which has different policies for
inbound and outbound flows</a></li>
</ul>
</p>
<h4>URL Rewrite Mediator</h4>
Added:
synapse/trunk/java/modules/documentation/src/site/xdoc/userguide/samples/sample432.xml
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/documentation/src/site/xdoc/userguide/samples/sample432.xml?rev=1511170&view=auto
==============================================================================
---
synapse/trunk/java/modules/documentation/src/site/xdoc/userguide/samples/sample432.xml
(added)
+++
synapse/trunk/java/modules/documentation/src/site/xdoc/userguide/samples/sample432.xml
Wed Aug 7 04:30:27 2013
@@ -0,0 +1,93 @@
+<?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 432</title>
+ </properties>
+ <body>
+ <section name="Sample 432: Callout Mediator - Invoke a secured service
which has different policies for inbound and outbound flows">
+ <div class="xmlConf"><definitions
xmlns="http://ws.apache.org/ns/synapse">
+
+ <localEntry key="sec_policy_inbound"
src="file:repository/conf/sample/resources/policy/policy_3.xml"/>
+ <localEntry key="sec_policy_outbound"
src="file:repository/conf/sample/resources/policy/policy_3.xml"/>
+
+ <sequence name="main">
+ <callout
serviceURL="http://localhost:9000/services/SecureStockQuoteService"
+ action="urn:getQuote">
+ <source xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+ xpath="s11:Body/child::*[fn:position()=1] |
s12:Body/child::*[fn:position()=1]"/>
+ <target xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+ xpath="s11:Body/child::*[fn:position()=1] |
s12:Body/child::*[fn:position()=1]"/>
+ <enableSec outboundPolicy="sec_policy_outbound"
inboundPolicy="sec_policy_inbound"/>
+ </callout>
+ <property name="RESPONSE" value="true"/>
+ <header name="To" action="remove"/>
+ <send/>
+ <drop/>
+ </sequence>
+
+</definitions></div>
+ <subsection name="Objective">
+ <p>
+ Demonstrate the usage of the Callout mediator for making
synchronous (blocking)
+ Web service calls to invoke secured services, which has
different security policies
+ for inbound and outbound flows.
+
+ </p>
+ </subsection>
+ <subsection name="Pre-requisites">
+ <p>
+ <ul>
+ <li>
+ Download and install the Java Cryptography
Extension (JCE) unlimited
+ strength policy files for your JDK
+ </li>
+ <li>
+ Deploy the SecureStockQuoteService in the sample
Axis2 server and start Axis2
+ </li>
+ <li>
+ Start Synapse using the configuration numbered 432
(repository/conf/sample/synapse_sample_432.xml)
+ <div class="command">
+ Unix/Linux: sh synapse.sh -sample 432<br/>
+ Windows: synapse.bat -sample 432
+ </div>
+ </li>
+ </ul>
+ </p>
+ </subsection>
+ <subsection name="Executing the Client">
+ <p>
+ In this sample, the Callout mediator is configured with
different security policies
+ for inbound and outbound message flows. Messages sent out
from synapse is encrypted
+ using the outboundPolicy and response received from the
secured service is decrypted
+ using the inboundPolicy.
+ </p>
+ <p>
+ Invoke the client as follows.
+ </p>
+ <div class="command">ant stockquote
-Dtrpurl=http://localhost:8280/</div>
+ </subsection>
+ </section>
+ <p><a href="../samples.html">Back to Catalog</a></p>
+ </body>
+</document>
\ No newline at end of file
Modified:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/TestSamplesHandlerSuite.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/TestSamplesHandlerSuite.java?rev=1511170&r1=1511169&r2=1511170&view=diff
==============================================================================
---
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/TestSamplesHandlerSuite.java
(original)
+++
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/TestSamplesHandlerSuite.java
Wed Aug 7 04:30:27 2013
@@ -233,6 +233,7 @@ public class TestSamplesHandlerSuite ext
sampleClassRepo.put("420", Sample420.class);
sampleClassRepo.put("430", Sample430.class);
sampleClassRepo.put("431", Sample431.class);
+ sampleClassRepo.put("432", Sample432.class);
sampleClassRepo.put("450", Sample450.class);
sampleClassRepo.put("451", Sample451.class);
sampleClassRepo.put("452", Sample452.class);
Modified:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/advanced/Sample431.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/advanced/Sample431.java?rev=1511170&r1=1511169&r2=1511170&view=diff
==============================================================================
---
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/advanced/Sample431.java
(original)
+++
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/advanced/Sample431.java
Wed Aug 7 04:30:27 2013
@@ -31,7 +31,7 @@ public class Sample431 extends SynapseTe
}
public void testCallOutSecurity() {
- log.info("Running test: Callout Mediator with security");
+ log.info("Running test: Callout mediator with security");
String trpUrl = "http://localhost:8280/";
StockQuoteSampleClient client = getStockQuoteClient();
result = client.requestStandardQuote(null, trpUrl, null, "IBM" ,null);
Added:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/advanced/Sample432.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/advanced/Sample432.java?rev=1511170&view=auto
==============================================================================
---
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/advanced/Sample432.java
(added)
+++
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/advanced/Sample432.java
Wed Aug 7 04:30:27 2013
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+package org.apache.synapse.samples.framework.tests.advanced;
+
+import org.apache.synapse.samples.framework.SampleClientResult;
+import org.apache.synapse.samples.framework.SynapseTestCase;
+import org.apache.synapse.samples.framework.clients.StockQuoteSampleClient;
+
+public class Sample432 extends SynapseTestCase {
+
+ SampleClientResult result;
+
+ public Sample432() {
+ super(432);
+ }
+
+ public void
testCallOutSecurityWithDifferentPoliciesForInboundAndOutbound() {
+ log.info("Running test: Callout mediator security sample with
different policies " +
+ "for inbound and outbound flows");
+ String trpUrl = "http://localhost:8280/";
+ StockQuoteSampleClient client = getStockQuoteClient();
+ result = client.requestStandardQuote(null, trpUrl, null, "IBM" ,null);
+ assertTrue("Client did not run successfully ",
result.responseReceived());
+ }
+
+}
Added:
synapse/trunk/java/modules/integration/src/test/resources/extras/synapse_sample_432_altered.xml
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/resources/extras/synapse_sample_432_altered.xml?rev=1511170&view=auto
==============================================================================
---
synapse/trunk/java/modules/integration/src/test/resources/extras/synapse_sample_432_altered.xml
(added)
+++
synapse/trunk/java/modules/integration/src/test/resources/extras/synapse_sample_432_altered.xml
Wed Aug 7 04:30:27 2013
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<!-- Callout mediator Security Sample for different policies for inbound and
outbound-->
+<definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <localEntry key="sec_policy_inbound"
src="file:repository/conf/sample/resources/policy/policy_3.xml"/>
+ <localEntry key="sec_policy_outbound"
src="file:repository/conf/sample/resources/policy/policy_3.xml"/>
+
+ <sequence name="main">
+ <callout
serviceURL="http://localhost:9000/services/SecureStockQuoteService"
+ action="urn:getQuote">
+ <configuration
axis2xml="modules/integration/target/test_repos/axis2Client/conf/axis2_def.xml"
repository="modules/integration/target/test_repos/axis2Client"/>
+ <source xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+ xpath="s11:Body/child::*[fn:position()=1] |
s12:Body/child::*[fn:position()=1]"/>
+ <target xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+ xpath="s11:Body/child::*[fn:position()=1] |
s12:Body/child::*[fn:position()=1]"/>
+ <enableSec outboundPolicy="sec_policy_outbound"
inboundPolicy="sec_policy_inbound"/>
+ </callout>
+ <property name="RESPONSE" value="true"/>
+ <header name="To" action="remove"/>
+ <send/>
+ <drop/>
+ </sequence>
+
+</definitions>
Added: synapse/trunk/java/modules/integration/src/test/resources/sample432.xml
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/resources/sample432.xml?rev=1511170&view=auto
==============================================================================
--- synapse/trunk/java/modules/integration/src/test/resources/sample432.xml
(added)
+++ synapse/trunk/java/modules/integration/src/test/resources/sample432.xml Wed
Aug 7 04:30:27 2013
@@ -0,0 +1,18 @@
+<synapseSample>
+ <sampleID>432</sampleID>
+ <sampleName>Callout mediator Security Sample for different policies for
inbound and outbound</sampleName>
+ <synapseConfig>
+ <axis2Repo>modules/integration/target/test_repos/synapse</axis2Repo>
+
<axis2Xml>modules/integration/target/test_repos/synapse/conf/axis2_def.xml</axis2Xml>
+
<synapseXml>modules/integration/src/test/resources/extras/synapse_sample_432_altered.xml</synapseXml>
+ </synapseConfig>
+ <backEndServerConfig>
+ <axis2Server id='0'>
+
<axis2Repo>modules/integration/target/test_repos/axis2Server</axis2Repo>
+
<axis2Xml>modules/integration/target/test_repos/axis2Server/conf/axis2_def.xml</axis2Xml>
+ </axis2Server>
+ </backEndServerConfig>
+ <clientConfig>
+
<clientRepo>modules/integration/target/test_repos/axis2Client</clientRepo>
+ </clientConfig>
+</synapseSample>
Added: synapse/trunk/java/repository/conf/sample/synapse_sample_432.xml
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/synapse_sample_432.xml?rev=1511170&view=auto
==============================================================================
--- synapse/trunk/java/repository/conf/sample/synapse_sample_432.xml (added)
+++ synapse/trunk/java/repository/conf/sample/synapse_sample_432.xml Wed Aug 7
04:30:27 2013
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<!-- Callout mediator Security Sample for different policies for inbound and
outbound-->
+<definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <localEntry key="sec_policy_inbound"
src="file:repository/conf/sample/resources/policy/policy_3.xml"/>
+ <localEntry key="sec_policy_outbound"
src="file:repository/conf/sample/resources/policy/policy_3.xml"/>
+
+ <sequence name="main">
+ <callout
serviceURL="http://localhost:9000/services/SecureStockQuoteService"
+ action="urn:getQuote">
+ <source xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+ xpath="s11:Body/child::*[fn:position()=1] |
s12:Body/child::*[fn:position()=1]"/>
+ <target xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+ xpath="s11:Body/child::*[fn:position()=1] |
s12:Body/child::*[fn:position()=1]"/>
+ <enableSec outboundPolicy="sec_policy_outbound"
inboundPolicy="sec_policy_inbound"/>
+ </callout>
+ <property name="RESPONSE" value="true"/>
+ <header name="To" action="remove"/>
+ <send/>
+ <drop/>
+ </sequence>
+
+</definitions>