Sending a byte array from PHP to WCF problem

Posted by shin on Stack Overflow See other posts from Stack Overflow or by shin
Published on 2010-06-06T22:22:57Z Indexed on 2010/06/06 22:32 UTC
Read the original article Hit count: 570

Filed under:
|
|
|
|

Hi I have this problem:

I have to send a byte array (encoded photo) from my PHP client to the WCF host. when I do a var_dump() on my array in PHP I get an array[2839] which is ok but on the server side when i debug I see that received array is only byte[5]...any idea how I can fix it?

I used code like this

$file = file_get_contents($_FILES['Filedata']['tmp_name']);
        $byteArr = str_split($file);
        foreach ($byteArr as $key=>$val) { $byteArr[$key] = ord($val); }

$client = new SoapClient('http://localhost:8000/MgrService?wsdl',
                    array(
                    'location' => 'http://localhost:8000/MgrService/SOAP11',
                    'trace' => true,
                    'soap_version' => SOAP_1_1
                    ));
  $par1->profileId = 13;
  $par1->photo = $byteArr;          

  $client->TestByte($par1);

And as I wrote erlier on the wcf host i get only byte[5] :/ maybe it needs some decoding to right soap serialize? should I use Base64 decoding or sommthing??

General I just want to upload posted file to c# function with byte[] as parameter :/ Help

© Stack Overflow or respective owner

Related posts about c#

Related posts about php