Blog

Home
Mule Studio

WSDL first service is the second approach for creating a JAX-WS service with CXF in Mule. I have explained the first approach in my earlier blog (JAX-WS Service with CXF in Mule 3.4)

In this approach we start with a WSDL(Web Services Description Language) contract and generate Java objects to implement the service. This approach is preferred for new development as we define the services in the WSDL and then generate the code to implement them. This approach also makes sure that service is an abstract entity that is implementation neutral. In this approach one spends more time in creating the interface required by the service before starting the implementation.

First step in this approach is to create a WSDL with all the operations needed to be exposed by the service. Lets create a WSDL with two operations sayHello and serviceOperation as below.

Now we need to generate the service, request & response objects from the WSDL. CXF includes a maven plugin to generate java code from the WSDL. Add the plugin to your pom.xml and specify the wsdl location, sourceRoot & the goal like below.

Run the maven command “mvn generate-sources” from the project. This will generate the service, request & response objects.

Now we need to implement the service (CXFWebservice) and code the logic for each operation in the service like below.

/**
* Class to implement CXFWebservice interface
*/
package com.confluex.service.impl;

import java.util.List;
import javax.jws.WebService;
import com.confluex.service.CXFWebservice;

/**
* @author Brigilin Stanley
*
*/
@WebService( endpointInterface = "com.confluex.service.CXFWebservice", serviceName="CXFWebservice", wsdlLocation="cxfwebservice.wsdl")
public class CXFWebserviceImpl implements CXFWebservice
{
    /* (non-Javadoc)
     * @see com.confluex.service.CXFWebservice#sayHello(java.lang.String)
     */
    @Override
    public String sayHello(String strUser)
    {
        return "Welcome to Confluex!!! 'The Mule ESB experts.' " + strUser;
    }

    /* (non-Javadoc)
     * @see com.confluex.service.CXFWebservice#serviceOperation(java.util.List)
     */
    @Override
    public String serviceOperation(List list)
    {
        // TODO Auto-generated method stub
        return null;
    }
}

Final step is to create a mule flow to use the WSDL and implementation class as a JAX-WS service with CXF. In the mule flow specify a HTTP Inbound Endpoint with the exchange-pattern as request-response. Add cxf:jaxws-service within the inbound endpoint and specify the service generated above from the WSDL above as the service class.

Add a Component after the HTTP Inbound Endpoint and specify the implementation class created above.

Build and run the application as a mule application within MuleStudio

Open the following url ( http://localhost:8081/cxfwsdlwebservice?wsdl ) in a browser and we can see the WSDL generated by CXF framework.

 

 

   

CXF is a services framework which helps to build and develop web services using programming APIs like JAX-WS & JAX-RS. CXF supports a variety of web service standards including SOAP, WSDL, WS-Addressing, WS-Security, WS-Policy. For REST services CXF supports JAX-RS.

In JAX-WS, a web service operation invocation is represented by

Read More

Git is pretty handy for managing source code, at Confluex we use it for some of our Mule ESB applications. Since Mule Studio doesn’t come with git support out of the box (at least up to version 1.3.2), here’s a quick guide to get you started.


Read More

Mule ESB 3.3 came out a few weeks ago with several upgrades to the framework. For being a minor release, there were some very nice improvements. The two that stand out for me are updated Spring libraries and exception handling. I haven’t really had a chance to focus on Test-Driven Development (TDD) within an ESB, but the now opportunity is there. MuleStudio needs some fixes, but like always, the MuleSoft engineers are on it.


Read More

I recently began using Mule Studio and, like my colleague Erich, was pleasantly surprised to discover that I enjoyed the experience. If you’re new to Mule ESB I highly recommend you get started using Mule Studio and if you’re a grizzled Mule veteran I encourage you to give Mule Studio a shot. Try it out, you might be surprised. Here’s why:

Read More

I was sitting here saying that I can code some XML configurations faster by hand rather than with a tool, either using Eclipse or VI, when I started my first MuleStudio development project. It really has not interested me until this point that a visual development tool existed for Mule ESB because I am proficient at configuring Mule through a standard XML editor. Our first test project was to create simple flow that listens for a CSV file on the filesystem, parses the file, creates a Java object with a custom transformer, splits the list of objects with the collection splitter, transforms the POJO into XML, uses XSLT to transform the XML, and then FTP’s the file to a local FTP server. That seemed easy enough.

Read More


©2013 Confluex, Inc. All Rights Reserved.