Created
April 8, 2013 06:45
-
-
Save mmdemirbas/5334722 to your computer and use it in GitHub Desktop.
WSO2 ESB + ClientAccesPolicy.xml + CrossDomain.xml Link: http://www.mmdemirbas.com/2013/04/wso2-esb-clientaccespolicyxml.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<sequence xmlns="http://ws.apache.org/ns/synapse" name="main" trace="disable"> | |
<in> | |
<log level="headers"> | |
<property name="?" value="[main] in: started"/> | |
<property xmlns:ns="http://org.apache.synapse/xsd" | |
name="To" | |
expression="get-property('To')"/> | |
<property xmlns:ns="http://org.apache.synapse/xsd" name="PAYLOAD" expression="/*"/> | |
</log> | |
<switch xmlns:ns="http://org.apache.synapse/xsd" source="get-property('To')"> | |
<case regex="(/services)?/[A-Za-z]+.xml"> | |
<log level="headers"> | |
<property name="?" value="[main] in: File from root requested"/> | |
<property name="To" expression="get-property('To')"/> | |
</log> | |
<switch source="get-property('To')"> | |
<case regex="/services/[A-Za-z]+.xml"> | |
<property name="FileName" | |
expression="substring-after(get-property('To'), 'services/')" | |
scope="default" | |
type="STRING"/> | |
</case> | |
<case regex="/[A-Za-z]+.xml"> | |
<property name="FileName" | |
expression="substring-after(get-property('To'), '/')" | |
scope="default" | |
type="STRING"/> | |
</case> | |
<default> | |
<log level="headers"> | |
<property name="?" value="[main] in: unexpected request!"/> | |
<property name="To" expression="get-property('To')"/> | |
</log> | |
<drop/> | |
</default> | |
</switch> | |
<log level="headers"> | |
<property name="?" value="[main] in: File from root requested"/> | |
<property name="FileName" expression="get-property('FileName')"/> | |
</log> | |
<switch source="get-property('FileName')"> | |
<case regex="clientaccesspolicy\.xml"> | |
<script language="js">mc.setPayloadXML( | |
<?xml version="1.0" encoding="utf-8"?> | |
<access-policy> | |
<cross-domain-access> | |
<policy> | |
<allow-from http-request-headers="SOAPAction"> | |
<domain uri="*"/> | |
</allow-from> | |
<grant-to> | |
<resource path="/" include-subpaths="true"/> | |
</grant-to> | |
</policy> | |
</cross-domain-access> | |
</access-policy>);</script> | |
</case> | |
<case regex="crossdomain\.xml"> | |
<script language="js">mc.setPayloadXML( | |
<?xml version="1.0"?> | |
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"> | |
<cross-domain-policy> | |
<allow-http-request-headers-from domain="*" headers="SOAPAction,Content-Type"></allow> | |
</cross-domain-policy>);</script> | |
</case> | |
<default> | |
<log level="headers"> | |
<property name="?" value="[main] in: (?) unknown file requested"/> | |
<property name="Filename" expression="get-property('FileName')"/> | |
</log> | |
<drop/> | |
</default> | |
</switch> | |
<header name="To" action="remove"/> | |
<property name="NO_ENTITY_BODY" scope="axis2" action="remove"/> | |
<property name="RESPONSE" value="true"/> | |
<send/> | |
</case> | |
<default> | |
<log level="headers"> | |
<property name="?" value="[main] in: (?) unknown request"/> | |
</log> | |
</default> | |
</switch> | |
</in> | |
<out> | |
<log level="headers"> | |
<property name="?" value="[main] out: started"/> | |
<property name="PAYLOAD" expression="//*"/> | |
</log> | |
<send/> | |
<log level="headers"> | |
<property name="?" value="[main] out: ended"/> | |
</log> | |
</out> | |
</sequence> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment