Upload images from gallery to web service using SOAP

I trawled the network and cannot find the documentation for sending images (or any attachments) to a web service using SOAP.

I send text data in order, but now I need to send images from the gallery along with text data, which creates another problem - the simultaneous execution of two or more asynchronous tasks. I will need to make 4 calls in total IF the record for sending has an image associated with it;

  • Send text data.
  • Check if the file exists on the server.
  • Send the file.
  • Associate the file with the record on the server using u_id sent from the server.

I was advised to use the Base64 method to convert the file to String and then send it, but I have the feeling that this is a cleaner way to do this using SOAP (no pun intended).

Any positive feedback.

* Please note that I used httpClient, but I had to switch to using SOAP, I am also relatively new to Android, so forgive me if I said something stupid here.

+7
source share
1 answer

There are three ways to send attachments using SOAP.

  • base64Binary
  • SwA - SOAP with attachments
  • MTOM

base64Binary sends attachments as base64 inline in a SOAP message. those. An application embedded in a SOAP message. Increases the message by 33%.

The SWA sends the application outside the SOAP message (the SOAP message contains a link to the attachment). But SOAP information does not contain attachments.

MTOM Provides the best of the world. An attachment is sent outside the SOAP message with a link to it, but the attachment appears as if it were embedded in the SOAP message (SOAP information contains the attachment)

Due to the fact that attachments sent using MTOM appear because the attachment is part of the SOAP message, it allows you to use other WS-QOS (Quality of Service) attributes. For example, MTOM messages can be signed and encrypted using WS-Security. Thus, it provides a mechanism for sending secure applications without the need for additional specifications.

This example shows how to use MTOM with Apache AXIS2.

+6
source

All Articles