Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * $Id: AxisMessageAdapter.java 10489 2008-01-23 17:53:38Z dfeist $
   * --------------------------------------------------------------------------------------
   * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
   *
   * The software in this package is published under the terms of the CPAL v1.0
   * license, a copy of which has been included with this distribution in the
   * LICENSE.txt file.
   */
 
 package org.mule.transport.soap.axis;
 
 
 
 
 import  org.apache.axis.MessageContext;
 import  org.apache.axis.attachments.AttachmentPart;

AxisMessageAdapter wraps a soap message. The payload of the adapter is the raw message received from the transport, but you also have access to the SOAPMessage object by using adapter.getSOAPMessage()
 
 public class AxisMessageAdapter extends AbstractMessageAdapter
 {
    
Serial version
 
     private static final long serialVersionUID = -923205879581370143L;
 
     private final Object payload;
     private final SOAPMessage soapMessage;
     private Transformer trans = new SerializableToByteArray();
 
     public AxisMessageAdapter(Object messagethrows MessagingException
     {
         this. = message;
         try
         {
             MessageContext ctx = MessageContext.getCurrentContext();
 
             if (ctx != null)
             {
                 MuleSoapHeaders header = new MuleSoapHeaders(ctx.getMessage().getSOAPPart().getEnvelope()
                     .getHeader());
 
                 if (StringUtils.isNotBlank(header.getReplyTo()))
                 {
                     setReplyTo(header.getReplyTo());
                 }
 
                 if (StringUtils.isNotBlank(header.getCorrelationGroup()))
                 {
                     setCorrelationGroupSize(Integer.parseInt(header.getCorrelationGroup()));
                 }
                 if (StringUtils.isNotBlank(header.getCorrelationSequence()))
                 {
                     setCorrelationSequence(Integer.parseInt(header.getCorrelationSequence()));
                 }
                 if (StringUtils.isNotBlank(header.getCorrelationId()))
                 {
                     setCorrelationId(header.getCorrelationId());
                 }
 
                 this. = ctx.getMessage();
                 int x = 1;
                 try
                 {
                     for (Iterator i = this..getAttachments(); i.hasNext(); x++)
                     {
                         super.addAttachment(String.valueOf(x), ((AttachmentPart)i.next())
                             .getActivationDataHandler());
                     }
                 }
                 catch (Exception e)
                 {
                     // this will not happen
                     .fatal("Failed to read attachments"e);
                 }
             }
             else
             {
                 this. = null;
             }
         }
         catch (SOAPException e)
         {
            throw new MessagingException(SoapMessages.failedToProcessSoapHeaders(), messagee);
        }
    }
    public AxisMessageAdapter(AxisMessageAdapter template)
    {
        super(template);
         = template.soapMessage;
         = template.payload;
         = template.trans;
    }

    

Returns:
the current message
    public Object getPayload()
    {
        return ;
    }
    public SOAPMessage getSoapMessage()
    {
        return ;
    }
    public void addAttachment(String nameDataHandler dataHandlerthrows Exception
    {
        if (null != )
        {
            .addAttachmentPart(new AttachmentPart(dataHandler));
        }
        super.addAttachment(namedataHandler);
    }
    public void removeAttachment(String namethrows Exception
    {
        if ("all".equalsIgnoreCase(name))
        {
            .removeAllAttachments();
            .clear();
        }
        else
        {
            throw new SOAPException(SoapMessages.cannotRemoveSingleAttachment().toString());
        }
    }
    {
        return new AxisMessageAdapter(this);
    }
New to GrepCode? Check out our FAQ X