Accessing the SOAP Message

If you require access to the SOAP message extending the Curam receiver class can allow you to do this as shown in the following example:

Figure 1. Sample Custom Receiver to Access the SOAP Message
package webservice;

import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
import org.apache.log4j.Logger;

/**
 * Sample SOAP message access.
 */
public class CustomReceiverInOutAccessSOAPMsg
  extends  curam.util.connectors.axis2.CuramMessageReceiver  {

  /** Class logger. */
  private final Logger log =
    Logger.getLogger(CustomReceiverInOutAccessSOAPMsg.class);

  /**
  * Access the SOAP message and invoke
  * Curam receiver invokeBusinessLogic.
  *
  * @param messageContextIn Input MessageContext.
  * @param messageContextOut Output MessageContext.
  *
  * @throws AxisFault based on called method.
  */
  @Override
  public void invokeBusinessLogic(final MessageContext messageContextIn,
    final MessageContext messageContextOut) throws AxisFault {
    if (messageContextIn != null) {
      final org.apache.axiom.soap.SOAPEnvelope inEnv = 
        messageContextIn.getEnvelope();
      if (inEnv != null) {
        // Insert custom SOAP processing here.
        log.debug("Sample access of SOAP message: " + inEnv.toString());
      }
    }

    super.invokeBusinessLogic(messageContextIn, messageContextOut);
  }
}

Note, the invocation of super.invokeBusinessLogic() must be made.

See Building Custom Receiver Code on how to specify and build this custom class.