Dizi içeriği. NET web hizmeti php müşteriden tam geçirilen değil

0 Cevap php

I want to pass an image as a byte array from php to a .NET web serice. The php client is as follows:

<?php
class Image{
  public $ImgIn = array();
}
$file = file_get_contents('chathura.jpg');
$ImgIn = str_split($file);
foreach ($ImgIn as $key=>$val) { $ImgIn[$key] = ord($val); }

$client = new SoapClient('http://localhost:64226/Service1.asmx?wsdl');
$result = $client->PutImage(new Image());
echo $result->PutImageResult;
//print_r($ImgIn);

?>

İşte ASP.NET web hizmeti web yöntem:

    [WebMethod]
    public string PutImage(byte[] ImgIn)
    {
        System.IO.MemoryStream ms =
           new System.IO.MemoryStream(ImgIn);
        System.Drawing.Bitmap b =
          (System.Drawing.Bitmap)Image.FromStream(ms);

        b.Save("imageTest", System.Drawing.Imaging.ImageFormat.Jpeg);
        return "test";
    }

When I run this the image content is correctly read to ImgIm array in php client. (In this instance the image had 16992 elements.) However when the array is passed to the web service method it contains only 5 elements (the first 5 elements of the image)
Can I know what is the reason for the loss of data ? How can I avoid it ?

Teşekkürler

0 Cevap