Reading Time: 5 minutes

I'm going to provide an overview on how to build a simple contract-first web-service and JAX-WS client that consumes the web-service with Mule Studio.

The sample below is going to build the following:

  • Build SOAP/ HTTP web service using & CXF that is CRUD web service to create, retrieve, update and delete an order and returns the order id. This exercise implements only the create operation for this service.
  • Build the Order Receiver Service
  • Receives the order information from HTTP Inbound Endpoint.
  • Invokes CRUDOrder web service to create the order
  • Returns the order id to Portal

Building the CXF web-service

latest report
Learn why we are the Leaders in management and

Following are steps needed to build a CXF based web-service using Mule

  • Create a Mule project
  • Import WSDL into the project
  • Configure the HTTP inbound endpoint
  • Configure the SOAP component.
  • Create the service implementation.
  • Final Service configuration.
  • Test the Service

Create a Mule Project

  • Click File → New → Mule Project [singlepic id=64 w=580 h=355]
  • Enter a project name as below [singlepic id=73 w=580 h=355]
  • Enter the flow name called service-cxf-wsdlfirst [singlepic id=74 w=580 h=355]
  • Then click Finish to complete the project creation.

Import WSDL into the project

  • Select File→ Import
  • Select General → File System [singlepic id=75 w=580 h=355]
  • Select the File and in the “Into Folder” –  “src/main/resources” and click Finish [singlepic id=76 w=580 h=355]

Configure the HTTP inbound endpoint

  • Drag and drop HTTP Inbound EndPoint [singlepic id=77 w=580 h=355]
  • Double-click the HTTP endpoint and configure the HTTP address of the service
  • Click Advanced TAB to configure the address to the required WSDL end point. If the address field is configured then remove the http host, port & application field.[singlepic id=78 w=580 h=355]

Configure the SOAP component

  • Drag and Drop a soap component [singlepic id=79 w=580 h=355]
  • Double click the SOAP component to configure the SOAP end point, and select Operation = JAX-WS Service [singlepic id=80 w=580 h=355]
  • Generate the WSDL to Java Classes
  • Click Import [singlepic id=65 w=580 h=355]
  • Select the WSDL location from current project and package name for all the JAVA classes. [singlepic id=66 w=580 h=355]

Tips: Ensure the WSDL name is full path including the WSDL extension

  • Mule Studio automatically generates all the java classes once you import the WSDL.

After the classes are generated, ensure the Service  Class Name field would point to actual Service Interface Definition not the Implementation Class and click “OK”.

Create the service implementation class

  • Select package the Select → New Class [singlepic id=68 w=580 h=355]
  • Enter the class name & select “Add” to select the Interface Definition [singlepic id=69 w=580 h=355]
  • Define all the logic in this class.

Final Mule Flow configuration

  • Drag and Drop a Java Component [singlepic id=70 w=580 h=355]
  • Double-Click the Java Component to configure the implementation class that was created in the above “Service Implementation” section. [singlepic id=71 w=580 h=355]

Test Service

  • Run the Service [singlepic id=72 w=580 h=355]
  • Go to webpage and type – . Ensure you can see the complete WSDL including all operations