Exemplo n.º 1
0
 function testAddComplexType()
 {
     $wsdl = new Zend_Soap_Wsdl('MyService', 'http://localhost/MyService.php');
     
     $wsdl->addComplexType('Zend_Soap_Wsdl_Test');
     
     $this->assertEquals($wsdl->toXml(), 
                         '<?xml version="1.0"?>' . PHP_EOL .
                         '<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" '
                            . 'xmlns:tns="http://localhost/MyService.php" '
                            . 'xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" '
                            . 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" '
                            . 'xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" '
                            . 'name="MyService" targetNamespace="http://localhost/MyService.php">'
                            . '<types>'
                            .   '<xsd:schema targetNamespace="">'
                            .     '<xsd:complexType name="Zend_Soap_Wsdl_Test">'
                            .       '<xsd:all>'
                            .         '<xsd:element name="var1" type="xsd:int"/>'
                            .         '<xsd:element name="var2" type="xsd:string"/>'
                            .       '</xsd:all>'
                            .     '</xsd:complexType>'
                            .   '</xsd:schema>'
                            . '</types>'
                       . '</definitions>' . PHP_EOL);
 }
Exemplo n.º 2
0
 /**
  * @group ZF-5430
  */
 public function testMultipleSequenceDefinitionsOfSameTypeWillBeRecognizedOnceBySequenceStrategy()
 {
     $wsdl = new Zend_Soap_Wsdl("MyService", "http://localhost/MyService.php");
     $wsdl->setComplexTypeStrategy(new Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence());
     $wsdl->addComplexType("string[]");
     $wsdl->addComplexType("int[]");
     $wsdl->addComplexType("string[]");
     $xml = $wsdl->toXml();
     $this->assertEquals(1, substr_count($xml, "ArrayOfString"), "ArrayOfString should appear only once.");
     $this->assertEquals(1, substr_count($xml, "ArrayOfInt"), "ArrayOfInt should appear only once.");
 }