Results 1 to 10 of 15

Thread: Attachments / MTOM

Hybrid View

  1. #1
    Join Date
    May 2007
    Posts
    7

    Default Attachments / MTOM

    Hi,

    I read that you support SwA attachments by casting WebServiceMessage to SoapMessage. Then operate on SoapMessage in the normal J2EE way. I guess I could create interceptors analogous to JAX-RPC handlers in J2EE. These handlers could operate on the SoapMessage while the implementation deals mainly with payload.

    Also, I saw that you will support MTOM with JAXB2. Does that mean that the JAXB endpoint binding is the first to support MTOM and that the other supported data bindings will eventually have support as well.

    Hopefully, you will have samples of how to manipulate MTOM attachments. Basically, you will have to give us a javax.activation.DataHandler for input attachments and we will have to give you a javax.activation.DataHandler for output attachments.

    Thanks.

  2. #2
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    Quote Originally Posted by TDean View Post
    Also, I saw that you will support MTOM with JAXB2. Does that mean that the JAXB endpoint binding is the first to support MTOM and that the other supported data bindings will eventually have support as well.
    That's the idea. I created an abstraction called MimeMarshaller, which can marshal a DataHandler or a byte[] to a MIME attachment.

    Quote Originally Posted by TDean View Post
    Hopefully, you will have samples of how to manipulate MTOM attachments. Basically, you will have to give us a javax.activation.DataHandler for input attachments and we will have to give you a javax.activation.DataHandler for output attachments.
    I'm not sure if I have time to create a sample, but at least you can look at the unit test code to see how it works.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  3. #3

    Default

    Hello,

    i have a web service that i want to return an attachment.
    i use jaxb2 and spring-ws- rc1.

    i try with 2 schemas:

    first:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://www.qindel.com/padron"
            xmlns="http://www.qindel.com/padron"
            elementFormDefault="qualified"
            attributeFormDefault="unqualified">
    
      <xs:element name="RespuestaVolante" type="tipo_RespuestaVolante"/>
    
      ...
    
      <xs:complexType name="tipo_RespuestaVolante">
        <xs:sequence>
        <xs:element name="attfake" type="xs:base64Binary"/>
        </xs:sequence>
      </xs:complexType>
    this generate a byte [] attfake.

    the second
    Code:
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://www.qindel.com/padron"
            xmlns="http://www.qindel.com/padron"
            xmlns:xmime="http://www.w3.org/2005/05/xmlmime">
    
      <xs:element name="RespuestaVolante" type="tipo_RespuestaVolante"/>
      ...
      <xs:complexType name="tipo_RespuestaVolante">
        <xs:sequence>
        <xs:element name="attfake" type="xs:base64Binary" xmime:expectedContentTypes="application/octet-stream"/>
        </xs:sequence>
      </xs:complexType>
    </xs:schema>
    this generate a DataHandler attfake.

    In the two cases the web service works and returns the same:
    Code:
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><ns2:RespuestaVolante xmlns:ns2="http://www.qindel.com/padron"><ns2:attfake>Sk9ERVIhISE=</ns2:attfake></ns2:RespuestaVolante></SOAP-ENV:Body></SOAP-ENV:Envelope>
    but not in an attachment!
    how configure it for returns the byte in an attachment?

    thanks in advance,
    César.

  4. #4
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    I'll try and generate a sample that shows MTOM attachments soon.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  5. #5
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    I've created that sample. It's called 'mtom' (quite a fitting name ), and has a JAX-WS client, so it's pretty interoperable.

    I came across a couple of bugs in the MTOM supports, so I fixed those as well. No wonder you couldn't make it work: sorry about that.

    The sample will be includes in the RC2 release, to be performed later this week.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  6. #6
    Join Date
    Jan 2006
    Location
    Edmonton, Alberta, Canada
    Posts
    62

    Default

    Hi, Arjen,

    Thank you for your sample, it is very helpful. One more question, if change to AxiomSoapMessageFactory, what are the dependencies? Thanks.

  7. #7
    Join Date
    Jun 2007
    Location
    Szczecin, Poland
    Posts
    16

    Default

    Quote Originally Posted by Arjen Poutsma View Post
    I've created that sample. It's called 'mtom' (quite a fitting name ), and has a JAX-WS client, so it's pretty interoperable.
    Are you sure that:

    Code:
    17   	     <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
    18 	        <property name="contextPath" value="org.springframework.ws.samples.mtom.schema"/>
    19 	    </bean>
    in /samples/mtom/src/main/webapp/WEB-INF/spring-ws-servlet.xml is correct?

    It works, but this won't create attachment (just will send base64 encoded content).

    As it is mtom example i think that mtomEnabled property should be set to true. Default value is false.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •