示例#1
0
 protected function initializeMtomSoapMessage(array $contentTypeHeader, $content)
 {
     if (!isset($contentTypeHeader['start']) || !isset($contentTypeHeader['start-info']) || !isset($contentTypeHeader['boundary'])) {
         throw new \InvalidArgumentException();
     }
     $mimeMessage = Message::createFromMessage($content, $contentTypeHeader['boundary']);
     $mimeParts = $mimeMessage->getParts();
     $soapMimePartId = trim($contentTypeHeader['start'], '<>');
     $soapMimePartType = $contentTypeHeader['start-info'];
     $rootPart = array_shift($mimeParts);
     $rootPartType = $this->splitContentTypeHeader($rootPart->type);
     // TODO: add more checks to achieve full compatibility to MTOM spec
     // http://www.w3.org/TR/soap12-mtom/
     if ($rootPart->id != $soapMimePartId || $rootPartType['_type'] != 'application/xop+xml' || $rootPartType['type'] != $soapMimePartType) {
         throw new \InvalidArgumentException();
     }
     foreach ($mimeParts as $mimePart) {
         $this->soapAttachments->add(new SoapAttachment($mimePart->id, $mimePart->type, $mimePart->getContent()));
     }
     // handle content decoding / prevent encoding
     return $rootPart->getContent();
 }
 /**
  * @param SoapHeader $soapHeader
  */
 public function addSoapHeader(SoapHeader $soapHeader)
 {
     $this->soapHeaders->add($soapHeader);
 }
 private function createComplexTypeCollection(array $properties)
 {
     $collection = new Collection('getName', 'BeSimple\\SoapBundle\\ServiceDefinition\\ComplexType');
     foreach ($properties as $property) {
         $complexType = new Definition\ComplexType();
         $complexType->setName($property[0]);
         $complexType->setValue($property[1]);
         if (isset($property[2])) {
             $complexType->setNillable($property[2]);
         }
         $collection->add($complexType);
     }
     return array('properties' => $collection);
 }