Contact Us 1-800-596-4880

CXF Module Reference

Mule runtime engine version 3.8 reached its End of Life on November 16, 2021. For more information, contact your Customer Success Manager to determine how to migrate to the latest Mule version.

When sending requests to an external web service, the recommended approach is to use the Web Service Consumer rather than the CXF Module.

The Mule CXF module provides support for web service integration via Apache CXF. Apache CXF is an open source services framework that helps you build and develop services using front-end programming APIs, like JAX-WS.

Using the CXF Module

Use the following links for information on configuring and using the CXF transport with your implementation of Mule.

Building and Consuming Services

Web Service Standards

Troubleshooting

This section includes common problems and solutions you might encounter when using the CXF transport.

I’ve received a "java.lang.IllegalArgumentException: wrong number of arguments" when using the CXF outbound endpoint

The CXF outbound endpoint uses the CXF generated to client to send messages. Because of this, your message payload must match the signature of the operation being invoked. This error results when the payload does not match the signature.

Here’s an example. If you have an operation on the client like this:

public void sendData(String data1, String data2, String data3);

Your message payload must be like this:

Object payload = new Object[] { "data1", "data2", "data3" };

My WSDL does not have the correct service address (such as, its localhost instead of foo.com)

If you are doing WSDL-first development, ensure that your @WebService annotation on your service implementation has the correct name, serviceName, targetNamespace, and portName attributes. If these are not correct, CXF cannot navigate your WSDL, find the address, and replace it with the address currently being used.

Your WebService annotation should look like this:

@WebService(name = "YourWSDLPortType",
            serviceName = "YourServiceName",
            portName = "YourPortName",
            targetNamespace = "http://your-namespace",
            endpointInterface = "your.endpoint.Interface",
            wsdlLocation = "your.wsdl")