I am trying to send the MS Word document to a Webservice through SOAP. Do I have to serialize the data first? or is it possible to send it 64bit encoded?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, you have to think of the Word document as simply any binary file stream. To send a binary file stream through a SOAP or any type of webservice, it must be sent in a manner that the receiving service is going to be able to parse and utilize it. So serializing a big binary file is not going to be very efficient but it can be done. If you absolutely need to make sure the file is included as part of whatever other data you are sending, then that is just something you have to live with. If you have the control or ability to configure the service to do something more efficient, then you could send the file via some other method (IE, use FTP or WEBDEV to get it to a pickup folder) and then in your SOAP request you simply send the filename of the file you dropped off in the pickup folder for you to process as part of your request.
Added:
I’ll try to elaborate in more detail on ways to handle including the file in the SOAP request…..
Basically if you want to try sending the file, open it as a file and just read the binary file in. Then how it gets encoded is either going to be at the whim of the SOAP library you are using (IE, the dotNET Framework if you are using that), or you would have to manually control that by doing something such as Base64 encode the binary data before passing it to your SOAP methods. If you are creating both the client and the server side code, and are using the same SOAP library on both, then it should be safe to just pass the binary to your SOAP method and use whatever techniques it might intrinsically use to convert the binary stream to valid values it will pass and can be decoded properly on the other end –assuming that it will encode the binary stream using some encoding methodology.
However, if you need to make this available to other platforms or where other persons using the service might be using a different SOAP library implementation, then you should probably use a standardized method such as Base64 encoding the data before you hand it off to SOAP so that you can forcefully make sure it is implemented consistently regardless of the tools being used. I had a client once who decided they wanted to write their own SOAP library instead of using one of the many existing implementations — guess how often we ran into issues with that?!? So if you have to potentially have others talk to your web service, then you want to make sure your binary data is encoded in a format that you can dictate. Hope this helps…