[PEAR::SOAP] Correctly attaching SOAP_Attachments to a SOAP message
| From: | Dave Dykshoorn | Date: | Thu, 18 Dec 2003 01:39:20 +0000 |
| Subject: | [PEAR::SOAP] Correctly attaching SOAP_Attachments to a SOAP message | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-1236@lists.php.net to get a copy of this message | ||
I am working on a soap server that has to correctly send mime attachments
back to the client. It basically does a "get file" function.
I am running into a problem where I am not correctly returning SOAP
attachments back to the client.
My question is how do I correctly attach a SOAP_Attachment to a SOAP message
that I send to the client?
Here is what I currently have written:
The Test Client:
$wsdl=new SOAP_WSDL('http://MySOAPServer.com/Server.php?wsdl');
$DCS=$wsdl->getProxy();
echo '<pre>';
$Attachment = $DCS->GetAttachment();
echo '<pre>';
print_r($Attachment);
print_r($DCS->xml);
echo '</pre>';
The Server:
(code snippets... not complete)
$this->__dispatch_map['SendAnAttachment'] =
array('in' => array(),
'out' => array('myAttachment'=>
'string'));
function GetAttachment()
{
$FullPath = 'C:/Junk/test.jpg';
if (file_exists($FullPath))
return new SOAP_Attachment('Response', 'application/octet-stream',
$FullPath);
else
return new SOAP_Value('return', 'boolean', false);
}
Thanks in Advance!
Dave Dykshoorn
Web Developer
SpeedLine Solutions