Skip navigation

SwitchYard

6 Posts authored by: tfennelly

The SwitchYard 0.2 release contained full JBoss AS6 and JBoss AS7 distributions i.e. modified AS6 and AS7 distributions containing the "bits" to allow it run SwitchYard applications.  SwitchYard 0.3 will also contain a JBoss AS7 Installer, which will allow you to install SwitchYard into an existing JBoss AS7 instance.

 

This installer is a simple .zip file containing an Ant script plus all the components for AS7.  It reduces the download binary size quite a bit - 40M Vs 120M (for the full distribution), and we'll be reducing it more.

 

The nightly builds can be found here.  Just download the "SwitchYard-AS7-Installer.zip" file, unzip it and follow the instructions in the README.txt file.

We just implemented code to help creation of Webservice-friendly CDI/bean services.  Check out the screencast I just ran off.

 

The basic gist of what's happening here is simple enough.  When SwitchYard sees a CDI @Service with operations implemented using JAXB annotated types, it automatically installs JAXB transformers to transform between these JAXB types and their corresponding XML namespace.  If then (for example), you use the same wsdl (as used to generate the JAXB Java types) to expose a Webservice via the SwitchYard SOAP Gateway, all the transformation logic is automatically set up for the service, so no need to implement and configure any transformers.

 

Give it a try and let us know what you think!!

SwitchYard AS6 & AS7 distros are available for download and test from the JBoss Maven repository.  These are full distributions of JBoss AS6 and AS7 pre-configured with SwitchYard v0.1.0 SNAPSHOT:

 

 

We'd love for people to download one of these deployments, test against the SwitchYard Quickstarts and let us know what you think and whatever issues you encounter.  Simply:

 

  1. Download one of the above distributions and install it on your system in the same way you would the normal AS6 or AS7 distribution (don't forget to point $JBOSS_HOME at the unzipped ditro).
  2. Clone the Quickstarts from github (you need git installed on your system):
    • git clone git://github.com/jboss-switchyard/quickstarts.git
  3. Build the Quickstarts:
    • mvn clean package

 

After building you'll find there are a number of quickstarts jar files that can be deployed to your SwitchYard enabled AS Server.  We'll be adding proper readmes/docs to the quickstarts before the release but here's a quick rundown:

 

  1. demos/orders:  This Quickstart demos the SwitchYard SOAP component combind with the CDI based Bean Services.  Deploy it to your App Server and then use a SOAP Client (e.g. soapUI) to invoke the SOAP endpoint binding (see the AS console for the Service URL and then add "?wsdl" to get the wsdl).  This invokes CDI Bean implemented SwitchYard Service through the SwitchYard Exchange mechansim.
  2. camel-binding:  This Quickstart demos SwitchYard's Apache Camel integration.  A CDI Bean Service is exposed via a Camel File Endpoint.  To exercise the quickstart you need to drop a "test.txt" file (containing some text) into the "target/input" folder off your App Server's bin directory (e.g. "switchyard-as6-0.1/bin/target/input").
  3. camel-service:  This quickstart is currently broken and we are working on fixing it.

 

Please give it a try and let us hear about any issues you encounter !!

I've been working on making improvements to the unit testing of SwitchYard Services.  See Dev Forum post.

 

Imagine I have a CDI bean service as follows...

 

@Service
public class BasicOrderManagementService {

    public OrderResponse createOrder(OrderRequest request) { 
        return new OrderResponse(request.orderId);
    }
}

 

Up to this point, invoking/testing the createOrder operation on that service in a test would have involved code like the following...

 

ServiceDomain domain = ServiceDomains.getDomain();

// Consume the OM model...
MockHandler responseConsumer = new MockHandler();
org.switchyard.Service service = domain.getService(new QName("BasicOrderManagementService"));
Exchange exchange = domain.createExchange(service, new BaseExchangeContract(new InOutOperation("createOrder")), responseConsumer);

Message inMessage = exchange.createMessage();
inMessage.setContent(new OrderRequest("D123", "ABCD")); 

exchange.send(inMessage); 

// wait, since this is async
responseConsumer.waitForOKMessage();

OrderResponse response = (OrderResponse) responseConsumer.getMessages().poll().getMessage().getContent();
Assert.assertEquals("D123", response.orderId);

 

By extending the new SwitchYardCDITestCase class, we can now express the same test as...

 

Message responseMsg = newInvoker("BasicOrderManagementService.createOrder").
                            sendInOut(new OrderRequest("D123", "ABCD"));

OrderResponse response = (OrderResponse) responseMsg.getContent(); 
Assert.assertEquals("D123", response.orderId);

Magesh recently wrote some SwitchYard components to enable SOAP bindings on a SwitchYard Service, while at the same time, I did some work to allow SwitchYard expose POJOs as Services.  Keith mentioned this in his last blog post.

 

As part of my work, I looked at approaches to making these components work more smoothly together.  I recorded a VERY rough screencast of some of this work.  It was recorded in one pass, so I talked too much about some things and forgot to menton others, but still... it gives an idea of what we've been doing.  Take a look: http://www.screencast.com/t/85kxYxF6Cs6e

 

Also see docs on creating CDI based bean services: http://community.jboss.org/wiki/CreatingServiceswithBeanComponent

Filter Blog

By date:
By tag: