This is actually a fairly pressing issue. I would appreciate any help I can get.

Thanks,

Tammy

Tammy Dugan wrote:
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
Tammy Dugan
Computer Programmer

Regenstrief Institute, Inc.
1050 Wishard Blvd., RG5
Indianapolis, IN 46202

(317) 630 - 7346

Confidentiality Notice: The contents of this message and any files transmitted 
with it may contain confidential and/or privileged information and are intended 
solely for the use of the named addressee(s). Additionally, the information 
contained herein may have been disclosed to you from medical records with 
confidentiality protected by federal and state laws. Federal regulations and 
State laws prohibit you from making further disclosure of such information 
without the specific written consent of the person to whom the information 
pertains or as otherwise permitted by such regulations. A general authorization 
for the release of medical or other information is not sufficient for this 
purpose.

If you have received this message in error, please notify the sender by return 
e-mail and delete the original message. Any retention, disclosure, copying, 
distribution or use of this information by anyone other than the intended 
recipient is strictly prohibited.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to