Skip to content

Instantly share code, notes, and snippets.

View albinkjellin's full-sized avatar

Albin Kjellin albinkjellin

View GitHub Profile
@albinkjellin
albinkjellin / gist:1658898
Created January 22, 2012 21:26
Intacct Maven Dependency
<!-- Instructs Maven to include this module in your Mule application -->
<plugins>
<plugin>
<groupId>org.mule.tools</groupId>
<artifactId>maven-mule-plugin</artifactId>
<version>1.6</version>
<extensions>true</extensions>
<configuration>
<copyToAppsDirectory>true</copyToAppsDirectory>
<inclusions>
@albinkjellin
albinkjellin / gist:1658960
Created January 22, 2012 21:38
Intacct Connector Definition
<intacct:config senderId="${intacct.senderId}" controlPassword="${intacct.controlPassword}" controlId="${intacct.controlid}" uniqueId="${intacct.uniqueid}" userId="${intacct.userid}" userPassword="${intacct.userPassword}" companyId="${intacct.companyid}"/>
@albinkjellin
albinkjellin / gist:1690852
Created January 27, 2012 20:49
Get Customer Id:s Flow
<flow name="main">
<http:inbound-endpoint host="localhost" port="8081" path="testintacct" exchange-pattern="request-response"/>
<intacct:get-list functionControlId="#[mule:message.id]"
obj="customer">
<intacct:fields
ref="#[groovy:[ ['value':'customerid']]]"/>
</intacct:get-list>
<mule-xml:object-to-xml-transformer/>
</flow>
@albinkjellin
albinkjellin / gist:1691015
Created January 27, 2012 21:29
Intacct Create Customer
<flow name="createcustomer">
<http:inbound-endpoint host="localhost" port="8881" path="createcustomer" exchange-pattern="request-response"/>
<intacct:execute type="CreateCustomer" functionControlId="#[string:customer-#[mule:message.id]]">
<intacct:commands>
<intacct:command>
<customerid>#[groovy:['value':'mule0001']]</customerid>
<name>MuleSoft</name>
<status>active</status>
</intacct:command>
def resultString = ''
payload.each{
resultString +=('"'+it.IsWon+'", ')
resultString +=('"'+it.AccountId+'", ')
resultString +=(it.Amount+', ')
resultString +=(it.FiscalQuarter+', ')
resultString +=('"'+it.LeadSource+'", ')
resultString +=('"'+it.OwnerId+'", ')
resultString +=('"'+it.Type+'"')
resultString = resultString +'\n'
@albinkjellin
albinkjellin / Prediction-SFDC2GooglePrediction.groovy
Created August 8, 2012 18:12
Create A Google Prediction Request Object
def resultList = []
def row = payload
resultList += row.AccountId
resultList += row.Amount
resultList += row.FiscalQuarter
resultList += row.LeadSource
resultList += row.OwnerId
resultList += row.Type
return resultList
@albinkjellin
albinkjellin / https-variable-path.xml
Created October 25, 2012 00:28
https path problem
<!-- This works -->
<https:outbound-endpoint exchange-pattern="request-response"
host="apisandbox.zuora.com" port="443"
path="apps/api/file/2c92c0953a569d88013a953179647580" method="GET"
doc:name="HTTP" password="pw" user="usr" />
<!-- This works -->
<set-property propertyName="Authorization" value="#[groovy: 'Basic '+'username:password'.getBytes().encodeBase64().toString()]"/>
<https:outbound-endpoint exchange-pattern="request-response" address="https://apisandbox.zuora.com:443/apps/api/file/#[payload]" method="GET" doc:name="HTTP" />
@albinkjellin
albinkjellin / foreach-MuleMessage.xml
Created November 9, 2012 21:24
foreach-MuleMessage
<!-- This will generate org.mule.DefaultMuleMessage inside the foreach -->
<foreach doc:name="Foreach" batchSize="50" collection="#[payload]">
<logger message="#[payload.get(0).getClass()]" level="INFO" doc:name="Logger"/>
</foreach>
<!-- This will generate HashMap (payload) inside the foreach -->
<foreach doc:name="Foreach" batchSize="50">
<logger message="#[payload.get(0).getClass()]" level="INFO" doc:name="Logger"/>
</foreach>
@albinkjellin
albinkjellin / file2rest.xml
Created February 23, 2015 22:09
file2rest
<http:request-config name="HTTP_Request_Configuration" host="localhost" basePath="api" port="8884" doc:name="HTTP Request Configuration"/>
<flow name="file2rest" doc:description="Reads a file from your desktop and sends that to a rest service.">
<file:inbound-endpoint path="src/test/resources/rest/attachment/in" responseTimeout="10000" doc:name="File"/>
<file:file-to-byte-array-transformer doc:name="File to Byte Array"/>
<set-attachment attachmentName="#[originalFilename]" value="#[payload]" contentType="multipart/form-data" doc:name="Attachment"/>
<http:request config-ref="HTTP_Request_Configuration" path="contact/abc/datasheet" method="POST" doc:name="HTTP" parseResponse="false"/>
</flow>
@albinkjellin
albinkjellin / soap2file.xml
Last active August 29, 2015 14:16
soap2file
<http:listener-config name="SOAP-in" host="0.0.0.0" port="8883" doc:name="HTTP Listener Configuration" />
<flow name="soap2file">
<http:listener config-ref="SOAP-in" path="/contacts" doc:name="Receive SOAP Request" parseRequest="false" />
<cxf:jaxws-service serviceClass="org.mule.demo.soap.Contact" doc:name="Parse SOAP Request">
<cxf:inInterceptors>
<spring:bean class="org.mule.module.cxf.support.CopyAttachmentInInterceptor" />
</cxf:inInterceptors>
</cxf:jaxws-service>
<choice doc:name="Choice">