繁体   English   中英

symfony 2 +肥皂

[英]symfony 2 + soap

我试图用symfony 2做一个肥皂服务,结果我得到了这个:

     <trace>at Symfony\Component\HttpKernel\Debug\ErrorHandler->handle('2', 'SoapFault::SoapFault() expects at least 2 parameters, 1 given', '/var/www/Symfony/src/Acme/TxBundle/Controller/DefaultController.php', '39', array('ref' => '333', 'stockinfos' => null))  in  line</trace>

我的功能:

 public function getInformationStockAction($ref)
{
      $stockinfos = $this->container->get('doctrine')->getRepository('TxBundle:LlxProduct')->findOneBy(array('ref'=>$ref))
  ;


     if (!$stockinfos)
    {
       throw new \SoapFault(sprintf('No warehouse found for the given productRef : "%s" ', $ref ));

         }

       return $this->container->get('besimple.soap.response')->setReturnValue($stockinfos);

}

有人有主意吗? 谢谢

正如SoapFault文档所建议的那样,在创建异常时需要提供2个参数:

$faultCode = "yourCode"; // must be a string

throw new \SoapFault(
    $faultCodeHere, // This is the parameter you're missing :-)
    sprintf('No warehouse found for the given productRef : "%s" ', $ref)
);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM