You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Glen Daniels <gd...@macromedia.com> on 2002/08/20 01:20:40 UTC

RE: Beta3: Problem with change in MsgProvider and FullMessageServ ice

Hi Alex:

If you look at the comment in the code, it says essentially - something that takes a MessageContext in is basically a Handler, so why not just use Handlers (and provider="handler").  So instead of something that looks like:

    public Document method(MessageContext msgContext);

you can have a class which extends BasicHandler and implements:

    public void invoke(MessageContext msgContext);

To return a Document in the body, you'd...

    {
        SOAPEnvelope env = msgContext.getRequestMessage().getSOAPEnvelope();
        Element resultBody;  // fill this in at some point
        ...processing...

        SOAPEnvelope reply = new SOAPEnvelope();
        SOAPBodyElement body = new SOAPBodyElement(resultBody);
        reply.addBodyElement(body);
        Message replyMsg = new Message(reply);
        msgContext.setResponseMessage(replyMsg);
    }

It's a tiny bit more work, but keeps similar patterns together, instead of mixing them.  The stuff dealt with by the MsgProvider is all DOM/SOAP classes, and the stuff dealt with by Handlers is MessageContexts.

Note that if you don't need all the stuff in the MessageContext, I'm planning to make one more change (as indicated in the comment) to remove the MessageContext call from MsgProvider entirely, and replace it with a call to a method that looks like:

    public SOAPEnvelope method(SOAPEnvelope request)

Then you could just take and return a SOAPEnvelope.  Sound reasonable to you?

--Glen

> -----Original Message-----
> From: Volanis, Alexander [mailto:AVolanis@rsasecurity.com]
> Sent: Monday, August 19, 2002 5:49 PM
> To: 'axis-dev@xml.apache.org'
> Subject: Beta3: Problem with change in MsgProvider and
> FullMessageService
> 
> 
> Hi everyone,
> 
> I have a service implemented as a "FullMessageService". It 
> worked with Axis
> Beta until about nightly build 7-26-2002. A change in the way 
> MsgProvider
> calls a service defined with the "FullMessageService" attribute is
> preventing me from getting anything out of my service. 
> Nightly 7-26 had this
> piece of code to process the request at the bottom of the 
> MsgProvider.java:
> 
>         // !!! WANT TO MAKE THIS SAX-CAPABLE AS WELL.  Some 
> people will
>         //     want DOM, but our examples should mostly lean 
> towards the
>         //     SAX side of things....
> 
>         Document retDoc = (Document) method.invoke( obj, argObjects );
> 
>         if ( retDoc != null ) {
>             SOAPBodyElement el = new
> SOAPBodyElement(retDoc.getDocumentElement());
>             resEnv.addBodyElement(el);
> 
> The latest nightly has instead this code:
> 
>             argObjects[0] = msgContext ;
>             method.invoke(obj, argObjects);
> 
> which completely ignores the return value of the invocation. 
> How can I get
> this functionality back? I liked the fact that I could get 
> the msgContext
> into my service and deal with the SOAPEnvelope myself. Do I 
> have to work
> with the MessageContext to build the response message instead 
> of returning
> anything from my method?
> 
> The signature of the function invoked is : 
> org.w3c.dom.Document 
> requestMethod(org.apache.axis.MessageContext msg);
> 
> Thank you in advance for your time,
> 
> Alex Volanis 
> Consulting Engineer 
> e-mail: avolanis@rsasecurity.com 
> _______________________________________ 
> RSA SECURITY Inc. 
> The Most Trusted Name in e-Security 
> 174 Middlessex Tpke, Bedford, MA 01730 USA 
> http://www.rsasecurity.com 
>