Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Attachments / MTOM

  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
    63

    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
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    My focus has been on doing SAAJ MTOM support, and so far I haven't had time to investigate Axiom's MTOM stuff. So, for now MTOM on Axiom might work, but I haven't tried it yet.
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  8. #8

    Default

    Hello again,

    i think that i have mtom enable in web service , because log:
    Code:
    09 jul 2007 13:15:36,965 DEBUG org.springframework.ws.server.endpoint.AbstractMarshallingPayloadEndpoint.marshalResponse(AbstractMarshallingPayloadEndpoint.java:147) Marshalling [javax.xml.bind.JAXBElement@1e9d0cc] to response payload 
    09 jul 2007 13:15:37,137 ERROR org.springframework.ws.server.endpoint.interceptor.AbstractValidatingInterceptor.handleResponseValidationErrors(AbstractValidatingInterceptor.java:206) XML validation error on response: cvc-type.3.1.2: Element 'ns2:attfake' is a simple type, so it must have no element information item [children]. 
    09 jul 2007 13:15:37,200 DEBUG org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:164) MessageDispatcher with name 'padron' sends response [------=_Part_0_21630945.1183979737137
    Content-Type: application/xop+xml; type="text/xml"; charset=utf-8
    
    <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:url>http://fedorareg:9080/fedora/get/navreg:38/nav:FopServiceDef/xml2Pdf</ns2:url><ns2:attfake><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:f17f47ca-9033-49b9-b3f4-3b95830be82b%40www.qindel.com"/></ns2:attfake></ns2:RespuestaVolante></SOAP-ENV:Body></SOAP-ENV:Envelope>
    ------=_Part_0_21630945.1183979737137
    Content-Type: application/octet-stream
    Content-ID: <f17f47ca-9033-49b9-b3f4-3b95830be82b@www.qindel.com>
    
    QUE PASA!!!
    ------=_Part_0_21630945.1183979737137--] for request [<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><ns2:PeticionVolante xmlns:ns2="http://www.qindel.com/padron"><ns2:Documento>50200203N</ns2:Documento></ns2:PeticionVolante></SOAP-ENV:Body></SOAP-ENV:Envelope>]
    but my client doesn't work:
    Code:
    public class PadronMarshallClient extends WebServiceGatewaySupport {
      ...
      JAXBElement response = (JAXBElement)getWebServiceTemplate().marshalSendAndReceive(request);
      respuestaVolante = (TipoRespuestaVolante)response.getValue();
      byte []attfake = respuestaVolante.getAttfake();
      logger.info("attfake: " + new String(attfake));
      logger.info("attfake.length(): " + attfake.length);
    the others elements of the response has values, but attfake not, is empty.
    Code:
      <bean id="padronMarshallClient" class="com.qindel.padron.ws.client.PadronMarshallClient">
        <property name="defaultUri" value="${padron.ws.url}"/>
        <property name="marshaller" ref="jaxbMarshaller"/>
        <property name="unmarshaller" ref="jaxbMarshaller"/>
      </bean>
    
      <bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
        <description>
            The validating JAXB Marshaller is used by the peticionVolanteMarshallEndpoint to unmarshal XML to objects and
            vice-versa.
        </description>
        <property name="mtomEnabled" value="true"/>
        <property name="contextPath" value="com.qindel.padron.ws.xml.jaxb"/>
      </bean>
    what's wrong with my client configuration?

    thank in advance,
    César.

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

    Default

    I think the client-side support for JAXB2 MTOM marshalling is not working well. Could you create a JIRA issue for this please?
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  10. #10

Posting Permissions

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