axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tammy Dugan <tdu...@regenstrief.org>
Subject problem with syncronous messages and attachments
Date Tue, 13 Mar 2007 14:29:14 GMT
I have a simple axis service with an operation with the following 
definition:

public OMElement queryStatisticsReturn(OMElement element)
    {
       
        try
        {
            return super.processAxisService(element);
        } catch (Exception ex)
        {
            InitializationServlet.error("", ex);
            return null;
        }
    }

My service extends a class called PreprocessSoap that contains 
processAxisService. processAxisService does some preprocessing, calls an 
abstract method called processBody that gets executed in my service 
class, and does some post processing. I am able to get the xml 
processing to work just fine but I can't get the attachments to work. I 
have the following attachment processing logic inside processAxisService:

MessageContext mc = 
MessageContext.getCurrentMessageContext().getOperationContext().getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
if (this.attachmentContent != null)
             {
                 for (int i = 0; i < this.attachmentContent.length; i++)
                 {
                     DataSource ds = new 
ByteArrayDataSource(this.attachmentContent[i].toByteArray(),
                                         this.attachmentContentType[i]);
                     DataHandler dh = new DataHandler(ds);
                     mc.addAttachment(dh);
                 }
             }
            mc.setSoapAction(bodyElement.getLocalName());
            mc.setDoingSwA(true);
            mc.setFLOW(MessageContext.OUT_FLOW);

All this seems to work fine until I check the response on the client 
side with the following bit of code:

response.getEnvelope().getBody().getFirstElement().serialize(System.out);
            System.out.println("\n\n# of attachments: " +
                      response.getOperationContext().
                       
getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getAttachmentMap().
                       getAllContentIDs().length);
            System.out.println("soap action: " +
                       response.getOperationContext().
                       
getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getSoapAction());

There was a soap action and an attachment in the sent message but it is 
not in the received message. I am guessing this is because I changed the 
wrong message context. How do I get access to the right message context, 
i.e. the message context that actually gets returned to the client?

Tammy Dugan




---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message