Outbound SOAP response with empty SOAP body

Posted on

We are trying to create a web service ESB connector with Apache Camel CXF library in JBoss Fuse 6.2.1. Below is the cxf end point configuration in blueprint.xml

<cxf:cxfEndpoint id="o365EndPoint" 
                address="${o365.phenom.endpoint}"
                serviceName="s:ExchangeService" 
                serviceClass="org.trinityhealth.api.o365.ExchangeServicePortType"
                wsdlURL="wsdl/O365-v1.wsdl" 
                loggingFeatureEnabled="true"
    xmlns:s="http://schemas.microsoft.com/exchange/services/2006/messages">
    <cxf:properties>
        <entry key="faultStackTraceEnabled" value="true" />
        <entry key="exceptionMessageCauseEnabled" value="true" />
    </cxf:properties>       
</cxf:cxfEndpoint>

And this is the processor class

public class FindMeetingTimesProcessor implements Processor {
Logger logger = LoggerFactory.getLogger(FindMeetingTimesProcessor.class);

@Override
public void process(Exchange exchg) throws Exception
{                           
    FindAvailableMeetingTimesType findAvailableMeetingTimes = null;

    RequestServerVersion requestServerVersion = null;

    MessageContentsList contents = (MessageContentsList)exchg.getIn().getBody();

    for(Object object : contents){

        if(findAvailableMeetingTimes == null && object instanceof FindAvailableMeetingTimesType){
             findAvailableMeetingTimes = (FindAvailableMeetingTimesType)object;
            logger.info("Start Window : " + findAvailableMeetingTimes.getSearchWindowStart().toString());
            logger.info("Duration : " + findAvailableMeetingTimes.getSearchWindowDuration());

        }
        if(requestServerVersion ==  null && object instanceof RequestServerVersion){
             requestServerVersion = (RequestServerVersion)object;
            logger.info("Version : " + requestServerVersion.getVersion().toString());
        }
    }

    javax.xml.ws.Holder findAvailableMeetingTimesResult = new javax.xml.ws.Holder();
    javax.xml.ws.Holder serverVersion = new javax.xml.ws.Holder();  

    O365Connection.connectO365API(exchg);
    logger.info("O365 Connection successful");
    O365Connection.getExchangeServicePortType().findAvailableMeetingTimes(
            findAvailableMeetingTimes, requestServerVersion, findAvailableMeetingTimesResult, serverVersion);
    logger.info("After calling findAvailableMeetingTimes");     

    FindAvailableMeetingTimesResponseMessageType responseResult = 
            (FindAvailableMeetingTimesResponseMessageType)findAvailableMeetingTimesResult.value;
    ServerVersionInfo serverVersionResponse = (ServerVersionInfo)serverVersion.value;

    logger.info("responseResult.getResponseCode() : " + responseResult.getResponseCode());
    logger.info("serverVersionResponse.getMajorBuildNumber() : " + serverVersionResponse.getMajorBuildNumber());

    MessageContentsList newList = new MessageContentsList();
    newList.add(responseResult);
    newList.add(serverVersionResponse);

    exchg.getOut().setBody(newList);
}

}

The underlying Camel CXF library is able to unmarshall inbound the SOAP XML correctly as evidenced by the log statement printing values.

But the outbound SOAP response back to client has a SOAP envelope with empty tag instead of XML populated with values.

Any idea of why we are getting empty SOAP body?

Responses