/**
  * @return \BeSimple\SoapBundle\Soap\SoapResponse
  */
 public function callAction($webservice)
 {
     $webServiceContext = $this->getWebServiceContext($webservice);
     $this->serviceBinder = $webServiceContext->getServiceBinder();
     $this->soapRequest = SoapRequest::createFromHttpRequest($this->container->get('request'));
     $this->soapServer = $webServiceContext->getServerBuilder()->withSoapVersion11()->withHandler($this)->build();
     ob_start();
     $this->soapServer->handle($this->soapRequest->getSoapMessage());
     $response = $this->getResponse();
     $response->setContent(ob_get_clean());
     // The Symfony 2.0 Response::setContent() does not return the Response instance
     return $response;
 }
 public function testMtomMessage()
 {
     $content = $this->loadRequestContentFixture('mtom/simple.txt');
     $request = new SoapRequest(array(), array(), array(), array(), array(), array(), $content);
     $request->server->set('CONTENT_TYPE', 'multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:0ca0e16e-feb1-426c-97d8-c4508ada5e82+id=7";start-info="application/soap+xml"');
     $message = $request->getSoapMessage();
     $this->assertEquals(735, strlen(trim($message)));
     $this->assertEquals(1, count($request->getSoapAttachments()));
     $attachment = $request->getSoapAttachments()->get('http://tempuri.org/1/632618206527087310');
     $this->assertNotNull($attachment);
     $this->assertEquals('application/octet-stream', $attachment->getType());
     $this->assertEquals(767, strlen(trim($attachment->getContent())));
 }