How to deliver Binary Data from SOAP Server to SOAP Client
| From: | Stefan Kisker | Date: | Sun, 17 Oct 2004 10:23:20 +0000 |
| Subject: | How to deliver Binary Data from SOAP Server to SOAP Client | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-14927@lists.php.net to get a copy of this message | ||
Hi,
ich try to send XML-Data combined with Binary-Files in just one procedure
call, but it will not work.
So this is what i tried:
The (shortened) public function of the Web Service:
function doJob($id,$helper,$classname) {
$obj = $this->factory($classname); // just a factory method
$obj->id = $id;
$obj->helper = $helper;
$this->array = $obj->doJob();
return $this->array;
}
Building the array with the binary files:
...
for (){
...
$file = new
SOAP_Attachment($filename,"application/octet-stream",$root.$documents["dir".
[$i]."/".$documents["file"][$i]);
$files[] = $file;
...
}
...
The return statement:
$array['xml'] = $xml;
$array['files'] = $files;
return $array;
In the soap_fault object i can see that the files have been attached, but
not in the right way. I think the result ist not wellformed. Even
SOAP_Attachment->serialize() has the same result.
I think, transfering binary data has to be a common problem, but i just
found articles about sending attachments to the SOAP server via
SOAP_Attachment.
Thanks in advance,
Stefan