當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SoapServer::addSoapHeader方法代碼示例

本文整理匯總了PHP中SoapServer::addSoapHeader方法的典型用法代碼示例。如果您正苦於以下問題:PHP SoapServer::addSoapHeader方法的具體用法?PHP SoapServer::addSoapHeader怎麽用?PHP SoapServer::addSoapHeader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SoapServer的用法示例。


在下文中一共展示了SoapServer::addSoapHeader方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __call

 /**
  * This method gets called once for every SOAP header the \SoapServer received
  * and afterwards once for the called SOAP operation.
  *
  * @param string $method The SOAP header or SOAP operation name
  * @param array $arguments
  *
  * @return mixed
  */
 public function __call($method, $arguments)
 {
     if ($this->serviceBinder->isServiceMethod($method)) {
         // @TODO Add all SoapHeaders in SoapRequest
         foreach ($this->headers as $name => $value) {
             if ($this->serviceBinder->isServiceHeader($method, $name)) {
                 $this->soapRequest->getSoapHeaders()->add($this->serviceBinder->processServiceHeader($method, $name, $value));
             }
         }
         $this->headers = null;
         $this->soapRequest->attributes->add($this->serviceBinder->processServiceMethodArguments($method, $arguments));
         // forward to controller
         $response = $this->container->get('http_kernel')->handle($this->soapRequest, HttpKernelInterface::SUB_REQUEST, false);
         $this->setResponse($response);
         // add response soap headers to soap server
         foreach ($response->getSoapHeaders() as $header) {
             $this->soapServer->addSoapHeader($header->toNativeSoapHeader());
         }
         // return operation return value to soap server
         return $this->serviceBinder->processServiceMethodReturnValue($method, $response->getReturnValue());
     } else {
         // collect request soap headers
         $this->headers[$method] = $arguments[0];
     }
 }
開發者ID:ashutosh-srijan,項目名稱:findit_akeneo,代碼行數:34,代碼來源:SoapWebServiceController.php

示例2: __call

 /**
  * This method gets called once for every SOAP header the \SoapServer received
  * and afterwards once for the called SOAP operation.
  *
  * @param string $method The SOAP header or SOAP operation name
  * @param array $arguments
  *
  * @return mixed
  */
 public function __call($method, $arguments)
 {
     if ($this->serviceBinder->isServiceMethod($method)) {
         if (!empty($this->headers)) {
             $firstHeaderName = array_keys($this->headers)[0];
             if (count($this->headers) === 1 && substr($firstHeaderName, -6) === 'Header') {
                 // headers are wrapped and returned as stdClass!
                 $this->headers = (array) $this->headers[$firstHeaderName];
             }
             // @TODO Add all SoapHeaders in SoapRequest
             foreach ($this->headers as $name => $value) {
                 if ($this->serviceBinder->isServiceHeader($method, $name)) {
                     $this->soapRequest->getSoapHeaders()->add($this->serviceBinder->processServiceHeader($method, $name, $value));
                 }
             }
         }
         $this->headers = null;
         $this->soapRequest->attributes->add($this->serviceBinder->processServiceMethodArguments($method, $arguments));
         // forward to controller
         $response = $this->container->get('http_kernel')->handle($this->soapRequest, HttpKernelInterface::SUB_REQUEST, false);
         $contentType = SoapMessage::getContentTypeForVersion($this->webserviceContext->getServiceDefinition()->getOption('version'));
         $response->headers->add(array('Content-Type' => $contentType));
         $this->setResponse($response);
         // add response soap headers to soap server
         foreach ($response->getSoapHeaders() as $header) {
             $this->soapServer->addSoapHeader($header->toNativeSoapHeader());
         }
         // return operation return value to soap server
         return $this->serviceBinder->processServiceMethodReturnValue($method, $response->getReturnValue());
     } else {
         // collect request soap headers
         $this->headers[$method] = $arguments[0];
     }
 }
開發者ID:vox-tecnologia,項目名稱:besimplesoap,代碼行數:43,代碼來源:SoapWebServiceController.php

示例3: __call

 /**
  * This method gets called once for every SOAP header the \SoapServer received
  * and afterwards once for the called SOAP operation.
  *
  * @param string $method The SOAP header or SOAP operation name
  * @param array $arguments
  *
  * @return mixed
  */
 public function __call($method, $arguments)
 {
     if ($this->serviceBinder->isServiceHeader($method)) {
         // collect request soap headers
         $this->soapRequest->getSoapHeaders()->add($this->serviceBinder->processServiceHeader($method, $arguments[0]));
         return;
     }
     if ($this->serviceBinder->isServiceMethod($method)) {
         $this->soapRequest->attributes->add($this->serviceBinder->processServiceMethodArguments($method, $arguments));
         // forward to controller
         $response = $this->kernel->handle($this->soapRequest, HttpKernelInterface::SUB_REQUEST, false);
         $this->soapResponse = $this->checkResponse($response);
         // add response soap headers to soap server
         foreach ($this->soapResponse->getSoapHeaders() as $header) {
             $this->soapServer->addSoapHeader($header->toNativeSoapHeader());
         }
         // return operation return value to soap server
         return $this->serviceBinder->processServiceMethodReturnValue($method, $this->soapResponse->getReturnValue());
     }
 }
開發者ID:RogerWebb,項目名稱:WebServiceBundle,代碼行數:29,代碼來源:SoapWebServiceController.php


注:本文中的SoapServer::addSoapHeader方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。