3

I am writing some web services and working with Spring at the server side. How can I create soap messages using javascript to upload files and how is the server side implementation of this service?

bob-the-destroyer
  • 3,164
  • 2
  • 23
  • 30
elfar
  • 461
  • 2
  • 6
  • 21
  • Possible duplicate: http://stackoverflow.com/questions/124269/simplest-soap-example-using-javascript – gmaliar Jan 01 '13 at 07:39
  • @Guy: constructing a soap message via javascript, yes. But the question revolves around uploading a file through javascript via soap and to a Spring service. – bob-the-destroyer Jan 01 '13 at 07:51

1 Answers1

1

I suggest you familiarize yourself with MTOM for sending attachments over SOAP. An MTOM message can be created using any programming language. An example can be found here: http://www.crosschecknet.com/intro_to_mtom.php

Marcel Stör
  • 22,695
  • 19
  • 92
  • 198
  • thanks, but the example was for .NET. Actually I can't get how can I determine in my soap message which file I am going to upload(transfer). – elfar Jan 02 '13 at 07:19
  • 1
    Yes, but the concept of how to construct the message remain just the same. "which file I am going to upload" - sorry, don't understand your question. – Marcel Stör Jan 02 '13 at 08:18
  • see, I have the file path on client's side. now how can I transfer that file's content to my soap request (how can I generate the request)? as mentioned in the question's description, I want to generate the message using javascript, so I can't use libraries like axis, jaxb, etc. – elfar Jan 08 '13 at 16:50
  • 1
    @elfar, if your question is how to read a file from the browser's machine with JavaScript then you need to look into the [HTML5 file API](http://html5demos.com/file-api). Read the file, encode it with base64 (there are JavaScript libs for that) and use the base64 string in the SOAP message. – Marcel Stör Jan 22 '13 at 18:03