Hello, I have narrowed my problem down more. Firstly, the truncation is happening for base64 images that are as small as 2,010 bytes. Further, the data being passed into the function "submitSighting" appears to be fine. That is, I compared the length of the $photovideo argument within submitSighting on the SOAP server with the length of the image on the client side, before it is sent to the SOAP server, and they are identical. So I am lead to believe that the base64_encode function producing strings that are not the same as those my client are producing. My solution for now is to just rip the original client-formatted base64 representation of the image out of the request as follows: if (preg_match('/<photovideo xsi:type="xsd:base64Binary">(.*)<\/photovideo>/ims', $request, $matches)) { $myPhotoVideo = $matches[1]; } This is less than ideal, and opens me up to potential security vulnerabilities, but it works for now. If anyone has any advice, I'd love to hear it. Best, Brian On Nov 25, 2009, at 1:35 AM, Brian Miles wrote: > > Hello, > > I have defined a SOAP message for submitting mixed data, including a base64 encoded image. Everything works fine when the images I send are small (640x480). However when my images grow too large (1024x768), the image data coming out of the SOAP request appears to be truncated. For example, instead of being 169,048 bytes, it is 166,448 bytes. > > What I'm doing is re-encoding the image data that SoapServer has decoded for me for the purpose of storing it in a text field in a mysql table. So it may be that SoapServer is truncating the data. Or (less likely?) it may be that base64_encode is truncating the data. > > Is there a size limit for message sub-nodes that SoapServer can handle? > > I have attached relevant sections of my server and WSDL file below. > > > Thanks in advance for any advice. > > Brian > > > Here are the relevant parts of my SOAP server: > > <?php > > function submitSighting($collector_id, > $species_common_name, > $sighting_datetime, > $location_lat, > $location_long, > $notes = NULL, > $alive_flag = true, > $photovideo = NULL) { > > $species_common_name = mysql_real_escape_string($species_common_name); > $sighting_datetime = mysql_real_escape_string($sighting_datetime); > $location_lat = mysql_real_escape_string($location_lat); > $location_long = mysql_real_escape_string($location_long); > if (NULL != $notes) { > $notes = mysql_real_escape_string($notes); > } else { > $notes = ""; > } > if (true == $alive_flag) { > $alive_flag = 'Y'; > } else { > $alive_flag = 'N'; > } > if (NULL != $photovideo) { > $photovideo = base64_encode($photovideo); > } else { > $photovideo = ""; > } > > $species_id = getSpeciesIdFromCommonName($species_common_name, $link); // function definition removed from this snippet > if (!$species_id) { > $msg = "The species " . $species_common_name . " is unknown."; > } > > // Insert into the sightings table > $query = sprintf("insert into pws_sightings values (NULL, %d, %d, 'N', '%s', %f, %f, '%s', '%s', '%s')", > $collector_id, > $species_id, > $sighting_datetime, > $location_lat, > $location_long, > $notes, > $alive_flag, > $photovideo); > > $result = mysql_query($query); > if ($result) { > $msg = "Success"; > } else { > $msg .= " was NOT successfully submitted due to error: " . mysql_error(); > } > > error_log($msg, 0); > > return $msg; > } > > // SOAP stuff > ini_set("soap.wsdl_cache_enabled", "1"); // Enable WSDL cache > $server = new SoapServer("pws.wsdl"); > > $server->addFunction("submitSighting"); > > $server->handle(); > > ?> > > > Here is the relevant excerpt from my WSDL file: > > <message name='submitSightingRequest'> > <part name='collector_id' type='xsd:integer'/> > <part name='species_common_name' type='xsd:string'/> > <part name='sighting_datetime' type='xsd:dateTime'/> > <part name='location_lat' type='xsd:double'/> > <part name='location_long' type='xsd:double'/> > <part name='notes' type='xsd:string'/> > <part name='alive_flag' type='xsd:boolean'/> > <part name='photovideo' type='xsd:base64Binary'/> > </message> > <message name='submitSightingResponse'> > <part name='Result' type='xsd:string'/> > </message> > -- PHP Soap Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php