Last active
August 29, 2015 14:20
-
-
Save albinkjellin/152de160edfb8ff04d1c to your computer and use it in GitHub Desktop.
file2soap
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
<flow name="file2soap" doc:description="Reads a file and sends that as a SOAP attachment to a SOAP service."> | |
<file:inbound-endpoint path="src/test/resources/soap/attachment/in" responseTimeout="10000" doc:name="Read File" /> | |
<processor-chain doc:name="Processor Chain"> | |
<scripting:transformer doc:name="Create SOAP Attachement"> | |
<scripting:script engine="Groovy"><![CDATA[def attachment = new org.apache.cxf.attachment.AttachmentImpl(originalFilename) | |
def source = new org.apache.axiom.attachments.ByteArrayDataSource(payload.getBytes(),'application/pdf'); | |
attachment.setDataHandler(new org.apache.axiom.attachments.ConfigurableDataHandler(source)); | |
message.setInvocationProperty('cxf_attachments',[attachment]) | |
return payload | |
]]></scripting:script> | |
</scripting:transformer> | |
<set-payload value="#[['FirstName', 'LastName', '123'].toArray()]" doc:name="Create Payload Map" /> | |
<cxf:jaxws-client operation="contact" serviceClass="org.mule.demo.soap.Contact" doc:name="SOAP Client"> | |
<cxf:outInterceptors> | |
<spring:bean class="org.mule.module.cxf.support.CopyAttachmentOutInterceptor" /> | |
</cxf:outInterceptors> | |
</cxf:jaxws-client> | |
<http:request config-ref="SOAP-Service" path="contacts" method="POST" doc:name="Call SOAP Service" /> | |
</processor-chain> | |
</flow> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment