Snippets

Pontus Ullgren Web Service Consumer Connector with Mule ESB CE

Updated by Pontus Ullgren

File .gitignore Added

  • Ignore whitespace
  • Hide word diff
+# ------------------------------------------------------------------------------ #
+# Java defaults (https://github.com/github/gitignore/blob/master/Java.gitignore) #
+# ------------------------------------------------------------------------------ #
+*.class
+
+# Package Files #
+*.jar
+*.war
+*.ear
+
+# ------------------------------------------------------------------------------------------- #
+# Eclipse-specific (https://github.com/github/gitignore/blob/master/Global/Eclipse.gitignore) #
+# ------------------------------------------------------------------------------------------- #
+*.pydevproject
+.metadata
+bin/**
+tmp/**
+tmp/**/*
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.settings/
+.loadpath
+# You may want to remove the sharp symbols here if you are using Maven 
+.project
+.classpath
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# CDT-specific
+.cproject
+
+# PDT-specific
+.buildpath
+
+# --------------- #
+# Studio-specific #
+# --------------- #
+.studio/
+flows/
+target/
+**/*.mflow

File README.md Modified

  • Ignore whitespace
  • Hide word diff
-Full code example for the blog [Web Service Consumer Connector with Mule ESB CE]()
+Full code example for the blog [Web Service Consumer Connector with Mule ESB CE](http://pontus.ullgren.com/view/Web_Service_Consumer_Connector_Mule_ESB_CE)

File mule-project.xml Added

  • Ignore whitespace
  • Hide word diff
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<mule-project xmlns="http://www.mulesoft.com/tooling/project" runtimeId="org.mule.tooling.server.3.7.0" schemaVersion="3.5.0.0">
+    <name>mule-esb-ce-wsc-demo</name>
+    <description></description>
+</mule-project>

File pom.xml Added

  • Ignore whitespace
  • Hide word diff
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>com.ullgren.pontus.demo</groupId>
+	<artifactId>mule-esb-ce-wsc-demo</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>mule</packaging>
+	<name>Mule mule-esb-ce-wsc-demo Application</name>
+
+    <properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+
+		<mule.version>3.7.0</mule.version>
+    	<mule.tools.version>1.1</mule.tools.version>
+	<munit.version>3.7.0-RC2</munit.version>
+    </properties>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.mule.tools.maven</groupId>
+				<artifactId>mule-app-maven-plugin</artifactId>
+				<version>${mule.tools.version}</version>
+				<extensions>true</extensions>
+				<configuration>
+                    <copyToAppsDirectory>true</copyToAppsDirectory>
+				</configuration>
+			</plugin>
+			<plugin>
+				<artifactId>maven-assembly-plugin</artifactId>
+				<version>2.2.1</version>
+				<configuration>
+					<descriptorRefs>
+						<descriptorRef>project</descriptorRef>
+					</descriptorRefs>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.codehaus.mojo</groupId>
+				<artifactId>build-helper-maven-plugin</artifactId>
+				<version>1.7</version>
+				<executions>
+					<execution>
+						<id>add-resource</id>
+						<phase>generate-resources</phase>
+						<goals>
+							<goal>add-resource</goal>
+						</goals>
+						<configuration>
+							<resources>
+								<resource>
+									<directory>src/main/app/</directory>
+								</resource>
+								<resource>
+									<directory>mappings/</directory>
+								</resource>
+							<resource>
+                                    <directory>src/main/api/</directory>
+                                </resource>
+                            </resources>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		<plugin>
+                <groupId>org.mule.munit.tools</groupId>
+                <artifactId>munit-maven-plugin</artifactId>
+                <version>${munit.version}</version>
+                <executions>
+                    <execution>
+                        <id>test</id>
+                        <phase>test</phase>
+                        <goals>
+                            <goal>test</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+	<testResources>
+            <testResource>
+                <directory>src/test/munit</directory>
+            </testResource>
+        <testResource>
+                <directory>src/test/resources</directory>
+            </testResource>
+        </testResources>
+    </build>
+
+	<!-- Mule Dependencies -->
+	<dependencies>
+		<!-- Xml configuration -->
+		<dependency>
+			<groupId>org.mule.modules</groupId>
+			<artifactId>mule-module-spring-config</artifactId>
+			<version>${mule.version}</version>
+			<scope>provided</scope>
+		</dependency>
+		<!-- Mule Transports -->
+		<dependency>
+			<groupId>org.mule.transports</groupId>
+			<artifactId>mule-transport-file</artifactId>
+			<version>${mule.version}</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.mule.transports</groupId>
+			<artifactId>mule-transport-http</artifactId>
+			<version>${mule.version}</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.mule.transports</groupId>
+			<artifactId>mule-transport-jdbc</artifactId>
+			<version>${mule.version}</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.mule.transports</groupId>
+			<artifactId>mule-transport-jms</artifactId>
+			<version>${mule.version}</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.mule.transports</groupId>
+			<artifactId>mule-transport-vm</artifactId>
+			<version>${mule.version}</version>
+			<scope>provided</scope>
+		</dependency>
+		<!-- Mule Modules -->
+		<dependency>
+			<groupId>org.mule.modules</groupId>
+			<artifactId>mule-module-scripting</artifactId>
+			<version>${mule.version}</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.mule.modules</groupId>
+			<artifactId>mule-module-xml</artifactId>
+			<version>${mule.version}</version>
+			<scope>provided</scope>
+		</dependency>
+		<!-- for testing -->
+		<dependency>
+			<groupId>org.mule.tests</groupId>
+			<artifactId>mule-tests-functional</artifactId>
+			<version>${mule.version}</version>
+			<scope>test</scope>
+		</dependency>
+	<dependency>
+            <groupId>org.mule.munit</groupId>
+            <artifactId>munit-assert</artifactId>
+            <version>${munit.version}</version>
+            <scope>test</scope>
+        </dependency>
+    <dependency>
+            <groupId>org.mule.munit</groupId>
+            <artifactId>munit-mock</artifactId>
+            <version>${munit.version}</version>
+            <scope>test</scope>
+        </dependency>
+    <dependency>
+            <groupId>org.mule.munit</groupId>
+            <artifactId>munit-common</artifactId>
+            <version>${munit.version}</version>
+            <scope>test</scope>
+        </dependency>
+    <dependency>
+            <groupId>org.mule.munit</groupId>
+            <artifactId>munit-runner</artifactId>
+            <version>${munit.version}</version>
+            <scope>test</scope>
+        </dependency>
+    <dependency>
+            <groupId>org.mule.modules</groupId>
+            <artifactId>mule-interceptor-module</artifactId>
+            <version>${munit.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+	<repositories>
+          <repository>
+            <id>Central</id>
+            <name>Central</name>
+            <url>http://repo1.maven.org/maven2/</url>
+            <layout>default</layout>
+        </repository>
+        <repository>
+            <id>mulesoft-releases</id>
+            <name>MuleSoft Releases Repository</name>
+            <url>http://repository.mulesoft.org/releases/</url>
+            <layout>default</layout>
+        </repository>
+        <repository>
+            <id>mulesoft-snapshots</id>
+            <name>MuleSoft Snapshots Repository</name>
+            <url>http://repository.mulesoft.org/snapshots/</url>
+            <layout>default</layout>
+        </repository>
+    </repositories>
+    <pluginRepositories>
+        <pluginRepository>
+            <id>mulesoft-release</id>
+            <name>mulesoft release repository</name>
+            <layout>default</layout>
+            <url>http://repository.mulesoft.org/releases/</url>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+        </pluginRepository>
+    </pluginRepositories>
+
+</project>

File src/main/app/backend.xml Added

  • Ignore whitespace
  • Hide word diff
+<?xml version="1.0" encoding="UTF-8"?>
+
+<mule 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="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
+	xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.7.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="
+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.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
+http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
+
+	<mulexml:namespace-manager includeConfigNamespaces="true">
+    	<mulexml:namespace uri="http://echo.example.com/" prefix="echo"/>
+    </mulexml:namespace-manager>
+    
+	<flow name="echoImplFlow">
+        <http:listener config-ref="HTTP_Listener_Configuration" path="/EchoImpl" doc:name="HTTP" allowedMethods="POST"/>
+        <cxf:proxy-service namespace="http://echo.example.com/" service="EchoImplService" doc:name="CXF" enableMuleSoapHeaders="false" payload="body" wsdlLocation="echoservice.wsdl"/>
+        <mulexml:dom-to-xml-transformer />
+        <logger level="INFO" message="#[payload]" />
+        <set-payload value="&lt;echo:echoResponse xmlns:echo='http://echo.example.com/'&gt;&lt;echo:return&gt;Hello #[xpath3('//echo:arg0')]&lt;/echo:return&gt;&lt;/echo:echoResponse&gt;"/>
+    </flow>
+</mule>

File src/main/app/mule-app.properties Added

  • Ignore whitespace
  • Hide word diff
Empty file added.

File src/main/app/mule-deploy.properties Added

  • Ignore whitespace
  • Hide word diff
+#Sat Aug 01 22:25:34 CEST 2015
+redeployment.enabled=true
+encoding=UTF-8
+config.resources=mule-esb-ce-wsc-demo.xml,backend.xml
+domain=default

File src/main/app/mule-esb-ce-wsc-demo.xml Added

  • Ignore whitespace
  • Hide word diff
+<?xml version="1.0" encoding="UTF-8"?>
+
+<mule xmlns:ws="http://www.mulesoft.org/schema/mule/ws"
+	xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml"
+	xmlns:http="http://www.mulesoft.org/schema/mule/http"
+	xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
+	xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.7.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="
+http://www.mulesoft.org/schema/mule/ws http://www.mulesoft.org/schema/mule/ws/current/mule-ws.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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
+http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
+	<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
+	
+	<ws:consumer-config name="Web_Service_Consumer" wsdlLocation="echoservice.wsdl" service="EchoImplService" port="EchoImplPort" serviceAddress="http://localhost:8081/EchoImpl" doc:name="Web Service Consumer"/>
+    
+    
+    <flow name="useParseTemplateFlow">
+        <http:listener config-ref="HTTP_Listener_Configuration" path="/parsetemplate" doc:name="HTTP"/>
+        <parse-template location="request.txt" mimeType="text/xml" encoding="UTF-8"/>
+        <ws:consumer config-ref="Web_Service_Consumer" doc:name="Web Service Consumer" operation="echo"/>
+    </flow>
+    
+    <flow name="useXSLTFlow">
+        <http:listener config-ref="HTTP_Listener_Configuration" path="/xslt" doc:name="HTTP"/>
+        <set-payload value="&lt;root/&gt;" doc:name="Set Payload to a dummy XML document"/>
+        <mulexml:xslt-transformer returnClass="java.lang.String" xsl-file="request.xslt" 
+        	doc:name="XSLT to create a valid request.">
+        	<mulexml:context-property key="name" value="#[message.inboundProperties.'http.query.params'.name]"/>
+        </mulexml:xslt-transformer>
+        <ws:consumer config-ref="Web_Service_Consumer" doc:name="Web Service Consumer" operation="echo"/>
+    </flow>
+</mule>

File src/main/resources/echoservice.wsdl Added

  • Ignore whitespace
  • Hide word diff
+<definitions name='EchoService' 
+	targetNamespace='http://echo.example.com/' 
+	xmlns='http://schemas.xmlsoap.org/wsdl/' 
+	xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' 
+	xmlns:tns='http://echo.example.com/' 
+	xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ <types>
+  <xs:schema targetNamespace='http://echo.example.com/' version='1.0' xmlns:tns='http://echo.example.com/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+   <xs:element name='echo' type='tns:echo'/>
+   <xs:element name='echoResponse' type='tns:echoResponse'/>
+   <xs:complexType name='echo'>
+    <xs:sequence>
+     <xs:element minOccurs='0' name='arg0' type='xs:string'/>
+    </xs:sequence>
+   </xs:complexType>
+   <xs:complexType name='echoResponse'>
+    <xs:sequence>
+     <xs:element minOccurs='0' name='return' type='xs:string'/>
+    </xs:sequence>
+   </xs:complexType>
+  </xs:schema>
+ </types>
+ <message name='Echo_echo'>
+  <part element='tns:echo' name='echo'></part>
+ </message>
+ <message name='Echo_echoResponse'>
+  <part element='tns:echoResponse' name='echoResponse'></part>
+ </message>
+ <portType name='Echo'>
+  <operation name='echo' parameterOrder='echo'>
+   <input message='tns:Echo_echo'></input>
+   <output message='tns:Echo_echoResponse'></output>
+  </operation>
+ </portType>
+ <binding name='EchoBinding' type='tns:Echo'>
+  <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
+  <operation name='echo'>
+   <soap:operation soapAction=''/>
+   <input>
+    <soap:body use='literal'/>
+   </input>
+   <output>
+    <soap:body use='literal'/>
+   </output>
+  </operation>
+ </binding>
+ <service name='EchoImplService'>
+  <port binding='tns:EchoBinding' name='EchoImplPort'>
+   <soap:address location='http://temp.uri/EchoImpl'/>
+  </port>
+ </service>
+</definitions>

File src/main/resources/request.txt Added

  • Ignore whitespace
  • Hide word diff
+<?xml version="1.0" encoding="UTF-8"?> 
+<echo:echo xmlns:echo="http://echo.example.com/">
+  <echo:arg0>#[message.inboundProperties.'http.query.params'.name]</echo:arg0>
+</echo:echo>

File src/main/resources/request.xslt Added

  • Ignore whitespace
  • Hide word diff
+<?xml version="1.0" encoding="UTF-8"?> 
+<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:echo="http://echo.example.com/">
+  <xsl:output method="xml" encoding="UTF-8"  indent="yes" omit-xml-declaration="yes"/>
+  <xsl:param name="name"/>
+
+  <!-- Transform from outer to inner -->
+  <xsl:template match="/">
+        <echo:echo>
+                <echo:arg0>
+                        <xsl:value-of select="$name"/>
+                </echo:arg0>
+        </echo:echo>
+  </xsl:template> 
+
+</xsl:stylesheet>
Created by Pontus Ullgren

File README.md Added

  • Ignore whitespace
  • Hide word diff
+Full code example for the blog [Web Service Consumer Connector with Mule ESB CE]()
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.