Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9008195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:53:05+00:00 2026-06-16T01:53:05+00:00

I have an EJB stateless bean web service and would like to get access

  • 0

I have an EJB stateless bean web service and would like to get access to the whole SOAP message, not just the SOAP Body as I’m currently getting in the parameter. I want to submit the message to a different component. I’m using Spring configuration but not Spring-WS. I followed this tutorial:

http://java.dzone.com/articles/creating-soap-message-handlers

as is and didn’t make any changes for now. It just logs the SOAP message. handleMessage() isn’t getting called.

@Stateless
@WebService(portName = "XRequest_PortType", serviceName = "XRequestService", endpointInterface = "XRequestPortType")
@Addressing(enabled = true)
@HandlerChain(file = "LogMessage_handler.xml")
@Interceptors(SpringBeanAutowiringInterceptor.class)
public class XRequest_PortTypeWS implements
        XRequestPortType {
...}

The LogMessage_handler.xml is slightly different from the tutorial but I tried it both ways:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<javaee:handler-chains 
     xmlns:javaee="http://java.sun.com/xml/ns/javaee" 
     xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <javaee:handler-chain>
    <javaee:handler>
      <javaee:handler-class>com.test.ws.LogMessageHandle</javaee:handler-class>
    </javaee:handler>
  </javaee:handler-chain>
</javaee:handler-chains>

LogMessageHandler:

package com.test.ws;

import java.io.IOException;
import java.util.Collections;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.handler.soap.SOAPHandler;
import javax.xml.ws.handler.soap.SOAPMessageContext;

/**
 * 
 * @author meerasubbarao
 */
public class LogMessageHandler implements SOAPHandler<SOAPMessageContext> {

    public boolean handleMessage(SOAPMessageContext messageContext) {
        log(messageContext);
        return true;

    }

    public Set<QName> getHeaders() {
        return Collections.EMPTY_SET;
    }

    public boolean handleFault(SOAPMessageContext messageContext) {
        return true;
    }

    public void close(MessageContext context) {
    }

    private void log(SOAPMessageContext messageContext) {
        SOAPMessage msg = messageContext.getMessage(); // Line 1
        try {
            msg.writeTo(System.out); // Line 3
        } catch (SOAPException ex) {
            Logger.getLogger(LogMessageHandler.class.getName()).log(
                    Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(LogMessageHandler.class.getName()).log(
                    Level.SEVERE, null, ex);
        }
    }

}

Is this even the best way to get the whole SOAP message? I would still need to to call a Spring bean from XRequest_PortTypeWS to send the SOAP message.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:53:07+00:00Added an answer on June 16, 2026 at 1:53 am

    I did use a SOAP Handler and was able to get the full SOAP Message. The details are in this other post.

    Sending Object from SOAP Handler to Web Service

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web service (built using jaxb/jaxws) that invokes a stateless EJB to
We have some JavaEE5 stateless EJB bean that passes the injected EntityManager to its
i have created a demo application Using JSF & EJB 3.0 (Stateless session bean
I've a web service, which is basically a @Stateless EJB annotated with @WebService, and
I have a stateless EJB that acceses my database. I need this bean in
I have a EJB bean that exposed to two interface like below: Local interface
I have two stateless EJB. One uses container managed transactions, another - bean managed.
I have a stateless EJB-3.1 session bean containing an asynchronous method that does some
I have a stateless bean with bean-managed transactions, and a method like this: @Stateless
I have a stateless bean something like: @Stateless public class MyStatelessBean implements MyStatelessLocal, MyStatelessRemote

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.