• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

SOAP with Attachment. and WSDL

 
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I think I have a bit of confusion regarding SOAP with attachments.

I know that in SOAP with attachments. I can attach various attachments with various type, for example :

  • Binary attachments encoded with Base64
  • Direct binary attachments


  • The whole SOAP message is encapsulated and sent within a MIME message.
    My question is :
    If I used SOAP with attachments, is this described in the WSDL file ??? Since a tag in the message will reference an attachment within the MIME message, how can this be described in WDSL, or this is beyond the scope of WSDL and can JAX-WS be used in case of SOAP with attachments ??

    Thanks in advance





     
    Ranch Hand
    Posts: 43
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Khaled,


    SOAP attachements are not enabled by default. If you were do deploy a service like this :


    the Image object would be returned to the client, depending on the SOAP style ( document or rpc ), as an BASE64 encoding right into the XML .



    this would be the HTTP response headers :




    and this would be the SOAP response:


    <?xml version="1.0" ?>
    <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
    <ns2:retrievePictureResponse xmlns:ns2="http://service.ivan.com/">
    <return xmlns="">iVBORwEWDx...</return>
    </ns2:retrievePictureResponse>
    </S:Body>
    </S:Envelope>



    However, if you would use the @MTOM annotation when deploying, like this:


    Take note that MTOM is used as an optimization of transferring large amounts of data through soap.
    The server would optimize binary transfers through SOAP, that is use the attachment part of the SOAP message to encode the Image:

    HTTP response headers:




    And this would be the WSDL generated by the appserver :



    So to answer your question, yes in the case of MTOM, there are clear specifications in the WSDL ( wsp:Policy elements ) on how to encode large binary attachments into the SOAP message. For a weird reason I cannot get the SOAP attachment to work ( it's something related to my client JARs ), but you can see it in depth in Ivan Kriszan notes chapter 10.3.

    And BTW , ALL binary transfers are Base64 encoded. There is no such thing as a Direct binary attachment.




    PS all of this are based on what Ivan Kriszan has explained in his notes. This example is not mine.
    Thanks,
    Victor
     
    Ranch Hand
    Posts: 2198
    1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi!
    For the cases where MTOM is not used, take a look at the following references:
    MIME binding in WSDL 1.1: http://www.w3.org/TR/2001/NOTE-wsdl-20010315#_Toc492291084
    Attachment description in the WS-I Attachments Profile 1.0: http://www.ws-i.org/Profiles/AttachmentsProfile-1.0.html#WSDLMIMEBINDING

    The short answer to your question is: yes.
    Best wishes!
     
    Khaled Mahmoud
    Ranch Hand
    Posts: 361
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi,

    Thanks for your reply. Surely I have to read about MTOM.

    But I have one small comment on what you said regarding binary attachments.


    And BTW , ALL binary transfers are Base64 encoded. There is no such thing as a Direct binary attachment.



    I have read in a course I download directly from Sun for free [Web Services Enabling Technologes], is that the whole SAOP request can be encapsulated within a MIME message, which contains both the SOAP request as the first attachment and the other attachments.The other attachments can have any encoding, not necessarily Base64, and be inserted in the request as is (Not necessarily base64).

    The example which the course listed




    Here is the link for the course :

    http://www.sun.com/training/catalog/courses/WJO-1118.xml


     
    expectation is the root of all heartache - shakespeare. tiny ad:
    We need your help - Coderanch server fundraiser
    https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
    reply
      Bookmark Topic Watch Topic
    • New Topic