Subscribed unsubscribe Subscribe Subscribe


igarashitm, a Japanese software engineer writes something in English here.

Playing around with SwitchYard on OpenShift Express

Install OpenShift Express Client Tools

yum install rubygem-rhc

Create an application with jbossas-7 cartridge

Used HelloSwitchYard as the application name.

rhc app create -l <openshift-account> -a HelloSwitchYard -t jbossas-7

Add SwitchYard Subsystem to the JBoss AS7

switchyard-openshift repository provides a way of that. Let's swipe it :)

cd HelloSwitchYard
git remote add switchyard-template git://
git fetch switchyard-template
git checkout switchyard-template/master -- pom.xml
git checkout switchyard-template/master -- standalone.diff
git apply standalone.diff
git rm -f standalone.diff

Edit pom.xml

Fix the artifact name as you like and profile id in the OpenShift manner

diff --git a/pom.xml b/pom.xml
index 845c81c..44e8b12 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,11 +1,11 @@
 <project xmlns="" xmlns:xsi=""
-  <groupId>org.switchyard.sample</groupId>
-  <artifactId>swydapp</artifactId>
+  <groupId>mynamespace.helloswitchyard</groupId>
+  <artifactId>HelloSwitchYard</artifactId>
-  <name>swydapp</name>
+  <name>HelloSwitchYard</name>
@@ -43,9 +43,9 @@
   <build />
-      <id>switchyard</id>
+      <id>openshift</id>
-        <finalName>swydapp</finalName>
+        <finalName>HelloSwitchYard</finalName>

Commit those changes

git add .
git commit -m "Added SwitchYard Subsystem"

Import the bean-service quickstart

Import the bean-service quickstart from SwitchYard distribution. bean-service is simple enough to use as template application

cp -r ${quickstarts}/bean-service/src/main/java/org src/main/java
cp -r ${quickstarts}/bean-service/src/main/resources/wsdl src/main/resources/
cp -r ${quickstarts}/bean-service/src/main/resources/META-INF src/main/resources/
cp -r ${quickstarts}/bean-service/src/test src/

Edit pom.xml

Edit pom.xml to add dependency on switchyard-component-bean, switchyard-component-soap, switchyard-test

diff --git a/pom.xml b/pom.xml
index 44e8b12..210a101 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,6 +21,18 @@
+    <dependency>
+      <groupId>org.switchyard.components</groupId>
+      <artifactId>switchyard-component-bean</artifactId>
+      <version>${switchyard.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.switchyard.components</groupId>
+      <artifactId>switchyard-component-soap</artifactId>
+      <version>${switchyard.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.switchyard</groupId>
+      <artifactId>switchyard-test</artifactId>
+      <version>${switchyard.version}</version>
+    </dependency>

Edit src/main/resources/META-INF/switchyard.xml

comment out the socketAddr & contextPath elements in the binding.soap element

diff --git a/src/main/resources/META-INF/switchyard.xml b/src/main/resources/META-INF/switchyard.xml
index 3d24bed..cb193bc 100644
--- a/src/main/resources/META-INF/switchyard.xml
+++ b/src/main/resources/META-INF/switchyard.xml
@@ -5,8 +5,8 @@
             <interface.wsdl interface="wsdl/OrderService.wsdl#wsdl.porttype(OrderService)"/>
             <binding.soap xmlns="urn:switchyard-component-soap:config:1.0">
-                <socketAddr>:18001</socketAddr>
-                <contextPath>quickstart-bean</contextPath>
+                <!-- <socketAddr>:18001</socketAddr> -->
+                <!-- <contextPath>quickstart-bean</contextPath> -->

Edit src/test/java/org/switchyard/quickstarts/bean/service/

Change the web service address in the testcase

diff --git a/src/test/java/org/switchyard/quickstarts/bean/service/ b/src/test/java/org/switchyard/quickstarts/bean/service/WebServiceTest.ja
index 4c6ac9e..ccdc7d0 100644
--- a/src/test/java/org/switchyard/quickstarts/bean/service/
+++ b/src/test/java/org/switchyard/quickstarts/bean/service/
@@ -41,7 +41,7 @@ public class WebServiceTest {
     public void invokeOrderWebService() throws Exception {
         // Use the HttpMixIn to invoke the SOAP binding endpoint with a SOAP input (from the test classpath)
         // and compare the SOAP response to a SOAP response resource (from the test classpath)...
-        httpMixIn.postResourceAndTestXML("http://localhost:18001/quickstart-bean/OrderService", "/xml/soap-request.xml", "/xml/soap-response.xml");
+        httpMixIn.postResourceAndTestXML("http://localhost:8080/OrderService", "/xml/soap-request.xml", "/xml/soap-response.xml");

Build and deploy

mvn -Popenshift clean package
git add .
git commit -m "Added bean-service"
git push

Check the status of application

rhc app status -l <openshift-account> -a HelloSwitchYard

Logs looks like this. Don't mind about some Japanese characters in my log, and an error as well. The important thing here is that HelloSwitchYard.jar has been Deployed successfully.

2012/03/14 14:55:38,258 INFO  [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016008: Starting weld service for deployment HelloSwitchYard.jar
2012/03/14 14:55:38,993 INFO  [org.switchyard] (MSC service thread 1-3) Starting SwitchYard service
2012/03/14 14:55:39,099 INFO  [org.apache.camel.impl.converter.AnnotationTypeConverterLoader] (MSC service thread 1-3) Found 3 packages with 14 @Converter classes to load
2012/03/14 14:55:39,109 INFO  [org.apache.camel.impl.converter.DefaultTypeConverter] (MSC service thread 1-3) Loaded 153 core type converters (total 153 type converters)
2012/03/14 14:55:39,111 INFO  [org.apache.camel.impl.converter.DefaultTypeConverter] (MSC service thread 1-3) Loaded additional 0 type converters (total 153 type converters) in 0.001 seconds
2012/03/14 14:55:40,197 INFO  [org.switchyard.component.soap.InboundHandler] (MSC service thread 1-3) Publishing WebService at
2012/03/14 14:55:40,630 情報    [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] (MSC service thread 1-3) Creating Service {urn:switchyard-quickstart:bean-service:1.0}OrderService from WSDL: vfs:/content/HelloSwitchYard.jar/wsdl/OrderService.wsdl
2012/03/14 14:55:41,376 情報    [org.apache.cxf.endpoint.ServerImpl] (MSC service thread 1-3) Setting the server's publish address to be
2012/03/14 14:55:41,504 ERROR [] (MSC service thread 1-3) JBAS015875: JBoss AS 7.1.0.Final "Thunder" started (with errors) in 7971ms - Started 143 of 178 services (1 services failed or missing dependencies, 31 services are passive or on-demand)
2012/03/14 14:55:41,549 INFO  [] (DeploymentScanner-threads - 2) JBAS018559: Deployed "HelloSwitchYard.jar"

Submit a WebService request using SoapUI

Assuming the namespace is "namespace", Import WSDL from into SoapUI and invoke.


<soapenv:Envelope xmlns:soapenv="" xmlns:urn="urn:switchyard-quickstart:bean-service:1.0">


<SOAP-ENV:Envelope xmlns:SOAP-ENV="">
      <orders:submitOrderResponse xmlns:orders="urn:switchyard-quickstart:bean-service:1.0">
            <status>Order Accepted</status>

Then you are all set to develop the SwitchYard application on OpenShift Express!
You may want to use the forge tool instead of editing switchyard.xml by hand. Let's see this: