Re: [SOAP] SOAP and attachment
| From: | Samisa Abeysinghe | Date: | Fri, 25 Jan 2008 07:39:38 +0000 |
| Subject: | Re: [SOAP] SOAP and attachment | ||
| References: | 1 2 3 | Groups: | php.soap |
| Request: | Send a blank email to php-soap+get-2747@lists.php.net to get a copy of this message | ||
Yes you can send binary data base64 encoded. However, technically it is base64 data transfer as far as SOAP message is concerned. Not an optimized attachment.
When you encode base64 the size grows by a factor of about 1.33. Hence in the SOAP world that is called non-optimized. Anyway this factor would be negligible based on the file sizes you want to send and the amount of requests you serve.
The other thing is that, any client needs to decode to get the original binary. That could be simple, but in the optimized case, you do not have to do that.
Thanks,
Samisa...
Shanon Swafford wrote:
Looks like if you can transfer the data encoded, anything should be able to decode it right? We send Word, PDF, JPG, BMP, exe, .... document attachments all the time using NuSOAP as the client/server although I haven't had time to upgrade it to PHP5 native. I'm waiting on a way to generate the WSDL as easy as NuSOAP does:) In my servers WSDL, I have: .. <xsd:element name="file_name" type="xsd:string" new_order="file_name" /> <xsd:element name="file_size" type="xsd:string" new_order="file_size" /> <xsd:element name="file_type" type="xsd:string" new_order="file_type" /> <xsd:element name="file_contents" type="xsd:base64Binary" new_order="file_contents" /> .. Then in my NuSOAP client, I base64_encode any file that I can read as a string. In my case, files that are uploaded ($_FILES[]) to the SOAP client via a web form. Using: $file_contents = base64_encode($uploaded_content); Back on the server, I think NuSOAP decodes it for me because I'm not doing anything special, just stuffing it in a MySQL blob. To get it out of the blob, I just SELECT and echo it out to state it simply. I even have several Windows (.net) clients using that WSDL. Regards, Shanon www.ntxinternet.com -----Original Message----- From: Samisa Abeysinghe [mailto:samisa.abeysinghe@gmail.com] Sent: Thursday, January 24, 2008 8:15 PM To: Guilhem Martin Cc: soap@lists.php.net Subject: Re: [SOAP] SOAP and attachment Guilhem Martin wrote:Hello all, I was not able to find in the PHP SOAP documentation anything aboutsendingattachment. So my question is: does PHP SOAP extension support SOAP attachment?No. Samisa...