Skip to content

Instantly share code, notes, and snippets.

@ddossot
Created July 25, 2012 21:50
Show Gist options
  • Save ddossot/3178904 to your computer and use it in GitHub Desktop.
Save ddossot/3178904 to your computer and use it in GitHub Desktop.
FedACH CXF Advanced Proxy - Full Config
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml"
xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:ss="http://www.springframework.org/schema/security"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/current/mule-pattern.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/spring-security http://www.mulesoft.org/schema/mule/spring-security/current/mule-spring-security.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
">
<mule-ss:security-manager>
<mule-ss:delegate-security-provider
name="memory-provider" delegate-ref="authenticationManager" />
</mule-ss:security-manager>
<mulexml:namespace-manager>
<mulexml:namespace prefix="webx"
uri="http://www.webservicex.net/" />
</mulexml:namespace-manager>
<flow name="enrichingSecureProxyService">
<http:inbound-endpoint
address="http://localhost:8080/fed-ach"
exchange-pattern="request-response">
<cxf:proxy-service
wsdlLocation="classpath:FedACH-Extended.wsdl"
namespace="http://www.webservicex.net/"
service="FedACH"
payload="body">
<cxf:ws-security>
<cxf:mule-security-manager />
<cxf:ws-config>
<cxf:property key="action" value="UsernameToken" />
</cxf:ws-config>
</cxf:ws-security>
</cxf:proxy-service>
</http:inbound-endpoint>
<choice>
<when
expression="message.inboundProperties.SOAPAction == '&quot;http://www.webservicex.net/getACHByClientId&quot;'">
<mulexml:xml-to-dom-transformer />
<set-property propertyName="clientId"
value="#[xpath('//webx:ClientId').text]" />
<enricher source="#[payload.zipCode]"
target="#[flowVars['zipCode']]">
<vm:outbound-endpoint path="client-lookup" exchange-pattern="request-response" />
</enricher>
<expression-component><![CDATA[
argumentNode = xpath('//webx:ClientId');
namespace = argumentNode.qName.namespace;
argumentNode.qName = new org.dom4j.QName('ZipCode', namespace);
argumentNode.text = zipCode;
methodNode = argumentNode.parent;
methodNode.qName = new org.dom4j.QName('getACHByZipCode', namespace);
payload = methodNode.document;
]]>
</expression-component>
<set-property propertyName="SOAPAction"
value="&quot;http://www.webservicex.net/getACHByZipCode&quot;" />
</when>
<otherwise>
<copy-properties propertyName="SOAPAction" />
</otherwise>
</choice>
<http:outbound-endpoint
address="http://www.webservicex.net/FedACH.asmx"
exchange-pattern="request-response">
<cxf:proxy-client payload="body" />
</http:outbound-endpoint>
</flow>
<!-- STUBS FOR DEMO -->
<spring:beans>
<ss:authentication-manager alias="authenticationManager">
<ss:authentication-provider>
<ss:user-service id="userService">
<ss:user name="user" password="pa$$"
authorities="ROLE_USER" />
</ss:user-service>
</ss:authentication-provider>
</ss:authentication-manager>
</spring:beans>
<flow name="clientLookupStub">
<vm:inbound-endpoint path="client-lookup" exchange-pattern="request-response" />
<response>
<expression-component>payload = ['zipCode':'95050']</expression-component>
</response>
</flow>
</mule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment