Two Laptop Bag*
The moose likes Web Services and the fly likes Handler: how to send information to ejbs ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Handler: how to send information to ejbs ?" Watch "Handler: how to send information to ejbs ?" New topic
Author

Handler: how to send information to ejbs ?

Olivier Mocquais
Greenhorn

Joined: Aug 01, 2005
Posts: 8
Hi,

I have developed a handler which extracts xml information from the soap message.

I want to send this information to the ejb which implements a web service.

Maybe I can store this information (the xml fragment stored as a string) in the context.

Is it possible ?

How does the ejb find the information in the context ?

Thanks for your help.

Olivier
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
javax.xml.rpc.handler.MessageContext
javax.xml.rpc.handler.soap.SOAPMessageContext

  • Save the bean's sessionContext in the bean's setSessionContext(SessionContext ctx) method.
  • In the handler: In the handleRequest(MessageContext msgCtx) method you are handed a MessageContext. Store your info in an Object and save it with msgCtx.setProperty(String name, Object value);
  • In the bean: SOAPMessageContext msgCtx = (SOAPMessageContext) sessionContext.getMessageContext();
  • Then use msgCtx.getProperty(String name) to retrieve the info.

  • Olivier Mocquais
    Greenhorn

    Joined: Aug 01, 2005
    Posts: 8
    I have tested it and it works.

    Thanks.

    Olivier
     
    Don't get me started about those stupid light bulbs.
     
    subject: Handler: how to send information to ejbs ?
     
    Similar Threads
    Spring+MDB+JMS+MQ+xml architecture
    how to get server name and version from an EAR
    Whizlabs Question about handler elemet
    Servlet & XML Request-Response
    XML Transformation