コード例 #1
0
ファイル: Action.php プロジェクト: im286er/ent
 /**
  * 创建一个服务
  */
 public function soap($uri, $className, $config = null)
 {
     if (isset($_GET['wsdl'])) {
         $autodiscover = new AutoDiscover();
         $autodiscover->setClass($className)->setUri($uri);
         return $autodiscover->toXml();
     } else {
         $wsdl = strpos($uri, '?') === false ? $uri . '?wsdl' : $uri . '&wsdl';
         $server = new SoapServer($wsdl);
         $obj = $config == null ? new $className() : new $className($config);
         $server->setObject($obj);
         $server->handle();
         $response = $server->getLastRequest();
         if ($response instanceof \SoapFault) {
             $response = exceptionMsg($response);
             $this->log($response);
         }
         return $response;
     }
 }
コード例 #2
0
ファイル: AutoDiscoverTest.php プロジェクト: nieldm/zf2
 /**
  * @group ZF-5736
  */
 public function testAmpersandInUrlIsCorrectlyEncoded()
 {
     $autodiscover = new AutoDiscover();
     $autodiscover->setUri("http://example.com/?a=b&b=c");
     $autodiscover->setClass('\\ZendTest\\Soap\\TestAsset\\Test');
     $wsdl = $autodiscover->toXml();
     $this->assertContains("http://example.com/?a=b&b=c", $wsdl);
 }
コード例 #3
0
    /**
     * @group ZF-8948
     * @group ZF-5766
     */
    public function testRecursiveWsdlDependencies()
    {
        $autodiscover = new AutoDiscover('\Zend\Soap\Wsdl\Strategy\ArrayOfTypeComplex');
        $autodiscover->setClass('\ZendTest\Soap\TestAsset\Recursion');
        $wsdl = $autodiscover->toXml();

        //  <types>
        //      <xsd:schema targetNamespace="http://localhost/my_script.php">
        //          <xsd:complexType name="Zend_Soap_AutoDiscover_Recursion">
        //              <xsd:all>
        //                  <xsd:element name="recursion" type="tns:Zend_Soap_AutoDiscover_Recursion"/>


        $path = '//wsdl:types/xsd:schema/xsd:complexType[@name="ZendTest.Soap.TestAsset.Recursion"]/xsd:all/xsd:element[@name="recursion" and @type="tns:ZendTest.Soap.TestAsset.Recursion"]';
        $this->assertWsdlPathExists($wsdl, $path);
    }