Handling SoapRequests/SoapResponse with attachments fix

This commit is contained in:
Petr Bechyně 2016-11-24 11:04:57 +01:00
parent 052ab20d67
commit f4a4619fe6
2 changed files with 4 additions and 4 deletions

View File

@ -52,7 +52,7 @@ class SoapResponseFactory
* @param SoapAttachment[] $attachments SOAP attachments
* @return Part[]
*/
private function createAttachmentParts(array $attachments = [])
private static function createAttachmentParts(array $attachments = [])
{
$parts = [];
foreach ($attachments as $attachment) {

View File

@ -146,7 +146,7 @@ class SoapServer extends \SoapServer
$handler = $this->soapServerOptions->getHandler();
if ($this->soapOptions->hasAttachments()) {
$this->injectAttachmentStorage($handler, $soapRequest, $this->soapOptions->getAttachmentType());
$this->injectAttachmentStorage($handler, $soapRequest);
}
ob_start();
@ -200,14 +200,14 @@ class SoapServer extends \SoapServer
return $soapResponse;
}
private function injectAttachmentStorage(AttachmentsHandlerInterface $handler, SoapRequest $soapRequest, $attachmentType)
private function injectAttachmentStorage(AttachmentsHandlerInterface $handler, SoapRequest $soapRequest)
{
$attachments = [];
if ($soapRequest->hasAttachments()) {
foreach ($soapRequest->getAttachments() as $attachment) {
$attachments[] = new SoapAttachment(
$attachment->getHeader('Content-Disposition', 'filename'),
$attachmentType,
$attachment->getHeader('Content-Type'),
$attachment->getContent()
);
}