2 Replies Latest reply on Apr 13, 2008 7:10 PM by anacarda

    Obtain SOAP attachment from PostMethod

    anacarda

      Hi,

      I have written a client bean that calls a SOAP method, that returns back an attachment.

      I can sucessfully call and return back the raw message, however, I want to obtain just the attachment (and maybe save it to file or something).

      I can get the raw message, by just calling getResponseBodyAsStream.

      I am wondering, is there a nice InputStream to SOAPMessageAttachment type of function avaliable?

      Or how is the best way to do this?

      As a side note, the "raw" inputstream returns back something like the following:

      ------=_Part_35_28169467.1207870927386 Content-Type: text/xml; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-ID: <rootpart@ws.jboss.org> <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header


      If that helps with any other ways I could be saving the attachment

      Antonio Broughton

        • 1. Re: Obtain SOAP attachment from PostMethod
          thomas.diesler

           

          /**
           * The interface <code>MessageContext</code> abstracts the message
           * context that is processed by a handler in the <code>handle</code>
           * method.
           *
           * <p>The <code>MessageContext</code> interface provides methods to
           * manage a property set. <code>MessageContext</code> properties
           * enable handlers in a handler chain to share processing related
           * state.
           *
           * @since JAX-WS 2.0
           */
          public interface MessageContext extends Map<String, Object>
          {
          
           /**
           * Standard property: message direction, <code>true</code> for
           * outbound messages, <code>false</code> for inbound.
           * <p>Type: boolean
           */
           public static final String MESSAGE_OUTBOUND_PROPERTY = "javax.xml.ws.handler.message.outbound";
          
           /**
           * Standard property: Map of attachments to a message for the inbound
           * message, key is the MIME Content-ID, value is a DataHandler.
           * <p>Type: java.util.Map<String,DataHandler>
           */
           public static final String INBOUND_MESSAGE_ATTACHMENTS = "javax.xml.ws.binding.attachments.inbound";
          
           /**
           * Standard property: Map of attachments to a message for the outbound
           * message, key is the MIME Content-ID, value is a DataHandler.
           * <p>Type: java.util.Map<String,DataHandler>
           */
           public static final String OUTBOUND_MESSAGE_ATTACHMENTS = "javax.xml.ws.binding.attachments.outbound";
          
          


          • 2. Re: Obtain SOAP attachment from PostMethod
            anacarda

            How can I get the MessageContext from an InputStream though?

            The InputStream I am talking about is the one from the call from loPostMethod.getResponseBodyAsStream()...

            This is because I am using a PostMethod to call / obtain the raw message back.