]> granicus.if.org Git - php/commitdiff
This commit was manufactured by cvs2svn to create branch 'PHP_5_0'.
authorSVN Migration <svn@php.net>
Tue, 16 Nov 2004 12:07:33 +0000 (12:07 +0000)
committerSVN Migration <svn@php.net>
Tue, 16 Nov 2004 12:07:33 +0000 (12:07 +0000)
ext/soap/tests/classmap.wsdl [new file with mode: 0644]
ext/soap/tests/classmap001.phpt [new file with mode: 0644]
ext/soap/tests/classmap002.phpt [new file with mode: 0644]

diff --git a/ext/soap/tests/classmap.wsdl b/ext/soap/tests/classmap.wsdl
new file mode 100644 (file)
index 0000000..cb081b2
--- /dev/null
@@ -0,0 +1,60 @@
+<wsdl:definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.nothing.com" targetNamespace="http://schemas.nothing.com">\r
+       <wsdl:types>\r
+               <xsd:schema targetNamespace="http://schemas.nothing.com">\r
+                       <xsd:complexType name="book">\r
+                               <xsd:all>\r
+                                       <xsd:element name="a" type="xsd:string"/>\r
+                                       <xsd:element name="b" type="xsd:string"/>\r
+                               </xsd:all>\r
+                       </xsd:complexType>\r
+  </xsd:schema>\r
+       </wsdl:types>\r
+       <message name="dotestRequest">\r
+               <part name="dotestReturn" type="tns:book"/>\r
+  </message>\r
+       <message name="dotestResponse">\r
+               <part name="res" type="xsi:string"/>\r
+  </message>\r
+       <message name="dotest2Request">\r
+               <part name="dotest2" type="xsi:string"/>\r
+  </message>\r
+       <message name="dotest2Response">\r
+               <part name="res" type="tns:book"/>\r
+  </message>\r
+       <portType name="testPortType">\r
+               <operation name="dotest">\r
+                       <input message="tns:dotestRequest"/>\r
+                       <output message="tns:dotestResponse"/>\r
+               </operation>\r
+               <operation name="dotest2">\r
+                       <input message="tns:dotest2Request"/>\r
+                       <output message="tns:dotest2Response"/>\r
+               </operation>\r
+       </portType>\r
+       <binding name="testBinding" type="tns:testPortType">\r
+               <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>\r
+               <operation name="dotest">\r
+                       <soap:operation soapAction="http://localhost:81/test/interface.php?class=test/dotest" style="rpc"/>\r
+                       <input>\r
+                               <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://schemas.nabek.com"/>\r
+                       </input>\r
+                       <output>\r
+                               <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://schemas.nabek.com"/>\r
+                       </output>\r
+               </operation>\r
+               <operation name="dotest2">\r
+                       <soap:operation soapAction="http://localhost:81/test/interface.php?class=test/dotest2" style="rpc"/>\r
+                       <input>\r
+                               <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://schemas.nabek.com"/>\r
+                       </input>\r
+                       <output>\r
+                               <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://schemas.nabek.com"/>\r
+                       </output>\r
+               </operation>\r
+       </binding>\r
+       <service name="test">\r
+               <port name="testPort" binding="tns:testBinding">\r
+                       <soap:address location="http://localhost:81/test/interface.php?class=test"/>\r
+               </port>\r
+       </service>\r
+</wsdl:definitions>\r
diff --git a/ext/soap/tests/classmap001.phpt b/ext/soap/tests/classmap001.phpt
new file mode 100644 (file)
index 0000000..0bda167
--- /dev/null
@@ -0,0 +1,50 @@
+--TEST--
+SOAP Classmap 1: SoapServer support for classmap
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+$GLOBALS['HTTP_RAW_POST_DATA']="
+<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\" 
+       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" 
+       xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" 
+       xmlns:enc=\"http://schemas.xmlsoap.org/soap/encoding/\"
+       xmlns:ns1=\"http://schemas.nothing.com\"
+>
+  <env:Body>
+ <dotest>
+  <book xsi:type=\"ns1:book\">
+    <a xsi:type=\"xsd:string\">Blaat</a>
+    <b xsi:type=\"xsd:string\">aap</b>
+</book>
+</dotest>
+ </env:Body>
+<env:Header/>
+</env:Envelope>";      
+
+class test{
+       function dotest(book $book){
+               $classname=get_class($book);
+               return "Classname: ".$classname;
+       }       
+}
+
+class book{
+       public $a="a";
+       public $b="c";
+               
+}
+$options=Array(
+               'actor' =>'http://schema.nothing.com',
+               'classmap' => array('book'=>'book', 'wsdltype2'=>'classname2')
+               );
+
+$server = new SoapServer(dirname(__FILE__)."/classmap.wsdl",$options);
+$server->setClass("test");
+$server->handle();
+echo "ok\n";
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.nabek.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:dotestResponse><res xsi:type="xsd:string">Classname: book</res></ns1:dotestResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
+ok
diff --git a/ext/soap/tests/classmap002.phpt b/ext/soap/tests/classmap002.phpt
new file mode 100644 (file)
index 0000000..551198e
--- /dev/null
@@ -0,0 +1,44 @@
+--TEST--
+SOAP Classmap 2: SoapClient support for classmap
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class TestSoapClient extends SoapClient{
+  function __doRequest($request, $location, $action, $version) {
+               return <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://schemas.nabek.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body>
+<ns1:dotest2Response><res xsi:type="ns1:book">
+  <a xsi:type="xsd:string">Blaat</a>
+  <b xsi:type="xsd:string">aap</b>
+</res>
+</ns1:dotest2Response></SOAP-ENV:Body></SOAP-ENV:Envelope>
+EOF;
+       }       
+}
+
+class book{
+       public $a="a";
+       public $b="c";
+               
+}
+
+$options=Array(
+               'actor' =>'http://schema.nothing.com',
+               'classmap' => array('book'=>'book', 'wsdltype2'=>'classname2')
+               );
+
+$client = new TestSoapClient(dirname(__FILE__)."/classmap.wsdl",$options);
+$ret = $client->dotest2("???");
+var_dump($ret);
+echo "ok\n";
+?>
+--EXPECT--
+object(book)#2 (2) {
+  ["a"]=>
+  string(5) "Blaat"
+  ["b"]=>
+  string(3) "aap"
+}
+ok