NFePHP\Common\Soap\CurlSoap::getWsdl PHP Метод

getWsdl() публичный Метод

getWsdl Baixa o arquivo wsdl do webservice
public getWsdl ( $urlservice ) : boolean | string
Результат boolean | string
    public function getWsdl($urlservice)
    {
        $aURL = explode('?', $urlservice);
        if (count($aURL) == 1) {
            $urlservice .= '?wsdl';
        }
        $resposta = $this->zCommCurl($urlservice);
        //verifica se foi retornado o wsdl
        $nPos = strpos($resposta, '<wsdl:def');
        if ($nPos === false) {
            $nPos = strpos($resposta, '<definit');
        }
        if ($nPos === false) {
            //não retornou um wsdl
            return false;
        }
        $wsdl = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" . trim(substr($resposta, $nPos));
        return $wsdl;
    }

Usage Example

Пример #1
0
 /**
  * downloadWsdl
  * Baixa o arquivo wsdl necessário para a comunicação SOAP nativa
  * O WSDL pode também ser usado para verificar a mensagem SOAP com o 
  * uso do SOAPUI um recurso muito importante para testes off-line.
  * @param string $url
  * @param string $priKeyPath
  * @param string $pubKeyPath
  * @param string $certKeyPath
  * @return string
  */
 public function downLoadWsdl($url, $priKeyPath, $pubKeyPath, $certKeyPath)
 {
     $soap = new Soap\CurlSoap($priKeyPath, $pubKeyPath, $certKeyPath);
     $resposta = $soap->getWsdl($url);
     if (!$resposta) {
         $this->soapDebug = $soap->soapDebug;
         return '';
     }
     return $resposta;
 }