axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tnel...@raba.com
Subject RE: where to assert multipart requirements for jms transport
Date Tue, 24 Feb 2004 19:09:47 GMT
Jaime,

Thanks so much for your response!

For now, (as you suggested) I'm setting a jms property
in the header in JMSSender and picking it up in SimpleJMSWorker.
This fixes my tests for sending various types. I still need to
look into where to provide for multipart return types.

In JMSSender:
	// If the request message contains attachments, set
	// a contentType property to go in the outgoing message header
    String ret = null;
    Message message = msgContext.getRequestMessage();
    Attachments mAttachments = message.getAttachmentsImpl();
    if (mAttachments != null && 0 != mAttachments.getAttachmentCount()) {
        String contentType = mAttachments.getContentType();
        if(contentType != null && !contentType.trim().equals("")) {
            props.put("contentType", contentType);
        }
    }


In SimpleJMSWorker:
    String contentType = null;
    try { 
        contentType = message.getStringProperty("contentType");
        System.err.println("contentType = "+contentType);
    } catch(Exception e) { /* ignore */ }

    Message msg = null;
    if(contentType != null && !contentType.trim().equals("")) {
        MimeHeaders header = new MimeHeaders();
        header.addHeader("Content-Type", contentType);
        msg = new Message(in, true, header);
    } else {
        msg = new Message(in);
    }

Thanks again!
Tom Nelson
RABA Technologies


On Feb 24 2004, Jaime Meritt wrote:

> Depending on which JMS vendor you are using, the answer may be
> different.  SonicMQ provides an XMLMessage and a MultipartMessage API
> extension.  My intent was to do the differentiation based on message
> type and defer to the JMSVendorAdapter to discover if my message has
> attachments or not.  In non-SonicMQ installations we could differentiate
> based on TextMessage vs. BytesMessage or something more standard.
> 
> Another way to do it would be to add the content type header as a JMS
> header property and work off of that value.  
> 
> Thoughts?
> Jaime Meritt
> Sonic Software
> 
> -----Original Message-----
> From: tnelson@raba.com [mailto:tnelson@raba.com] 
> Sent: Tuesday, February 24, 2004 9:51 AM
> To: axis-dev@ws.apache.org
> Subject: where to assert multipart requirements for jms transport
> 
> This is for axis-1_2alpha, using jms transport intead of http for an
> application like the EchoAttachments sample.
> 
> I'm looking into how one would patch SimpleJMSWorker to add a
> MimeHeaders argument to the Message CTOR at line 122.
> By doing this:
>     MimeHeaders header =3D new MimeHeaders();
>     header.addHeader("Content-Type", "multipart/related");
>     msg =3D new Message(in, true, header); the server will correctly
> process a call with a DataHander argument (like the EchoAttachments
> sample).
> I only want to add the MimeHeader with content-type if the incoming
> message is multipart.
> 
> My question is how the axis developers would prefer to provide
> information in an incoming message that I can query in order to decide
> to add the MimeHeaders object to the Message CTOR.
> 
> Something similar will probably be required to handle return types that
> use multipart attachments.
> 
> Any thoughts or opinions about how this should be done would be
> appreciated.
> 
> Thanks,
> Tom Nelson
> 
> 
> 

Mime
View raw message