Return to bug35142.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / soap / tests / bugs |
1.1 misho 1: --TEST-- 2: Bug #35142 (SOAP Client/Server Complex Object Support) 3: --SKIPIF-- 4: <?php require_once('skipif.inc'); ?> 5: --INI-- 6: soap.wsdl_cache_enabled=0 7: --FILE-- 8: <?php 9: ini_set("soap.wsdl_cache_enabled",0); 10: $timestamp = "2005-11-08T11:22:07+03:00"; 11: $wsdl = dirname(__FILE__)."/bug35142.wsdl"; 12: 13: function PostEvents($x) { 14: var_dump($x); 15: exit(); 16: return $x; 17: } 18: 19: class TestSoapClient extends SoapClient { 20: 21: function __construct($wsdl, $options) { 22: parent::__construct($wsdl, $options); 23: $this->server = new SoapServer($wsdl, $options); 24: $this->server->addFunction('PostEvents'); 25: } 26: 27: function __doRequest($request, $location, $action, $version, $one_way = 0) { 28: echo "$request\n"; 29: $this->server->handle($request); 30: return $response; 31: } 32: 33: } 34: 35: $soapClient = new TestSoapClient($wsdl, 36: array('trace' => 1, 'exceptions' => 0, 37: 'classmap' => array('logOnEvent' => 'LogOnEvent', 38: 'logOffEvent' => 'LogOffEvent', 39: 'events' => 'IVREvents'))); 40: 41: $logOnEvent = new LogOnEvent(34567, $timestamp); 42: $logOffEvents[] = new LogOffEvent(34567, $timestamp, "Smoked"); 43: $logOffEvents[] = new LogOffEvent(34568, $timestamp, "SmokeFree"); 44: $ivrEvents = new IVREvents("1.0", 101, 12345, 'IVR', $logOnEvent, $logOffEvents); 45: 46: $result = $soapClient->PostEvents($ivrEvents); 47: 48: class LogOffEvent { 49: public $audienceMemberId; 50: public $timestamp; 51: public $smokeStatus; 52: public $callInitiator; 53: 54: function __construct($audienceMemberId, $timestamp, $smokeStatus) { 55: $this->audienceMemberId = $audienceMemberId; 56: $this->timestamp = $timestamp; 57: $this->smokeStatus = $smokeStatus; 58: $this->callInitiator = "IVR"; 59: } 60: } 61: 62: class LogOnEvent { 63: public $audienceMemberId; 64: public $timestamp; 65: 66: function __construct($audienceMemberId, $timestamp) { 67: $this->audienceMemberId = $audienceMemberId; 68: $this->timestamp = $timestamp; 69: } 70: } 71: 72: class IVREvents { 73: public $version; 74: public $activityId; 75: public $messageId; 76: public $source; 77: public $logOnEvent; 78: public $logOffEvent; 79: 80: function __construct($version, $activityId, $messageId, $source, $logOnEvent=NULL, $logOffEvent=NULL) { 81: $this->version = $version; 82: $this->activityId = $activityId; 83: $this->messageId = $messageId; 84: $this->source = $source; 85: $this->logOnEvent = $logOnEvent; 86: $this->logOffEvent = $logOffEvent; 87: } 88: } 89: ?> 90: --EXPECTF-- 91: <?xml version="1.0" encoding="UTF-8"?> 92: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://testurl/Message"><SOAP-ENV:Body><ns1:ivrEvents version="1.0" activityId="101" messageId="12345" source="IVR"><ns1:logOffEvent audienceMemberId="34567" timestamp="2005-11-08T11:22:07+03:00" smokeStatus="Smoked" callInitiator="IVR"/><ns1:logOffEvent audienceMemberId="34568" timestamp="2005-11-08T11:22:07+03:00" smokeStatus="SmokeFree" callInitiator="IVR"/><ns1:logOnEvent audienceMemberId="34567" timestamp="2005-11-08T11:22:07+03:00"/></ns1:ivrEvents></SOAP-ENV:Body></SOAP-ENV:Envelope> 93: 94: object(IVREvents)#%d (6) { 95: ["version"]=> 96: string(3) "1.0" 97: ["activityId"]=> 98: int(101) 99: ["messageId"]=> 100: int(12345) 101: ["source"]=> 102: string(3) "IVR" 103: ["logOnEvent"]=> 104: object(LogOnEvent)#%d (2) { 105: ["audienceMemberId"]=> 106: int(34567) 107: ["timestamp"]=> 108: string(25) "2005-11-08T11:22:07+03:00" 109: } 110: ["logOffEvent"]=> 111: array(2) { 112: [0]=> 113: object(LogOffEvent)#%d (4) { 114: ["audienceMemberId"]=> 115: int(34567) 116: ["timestamp"]=> 117: string(25) "2005-11-08T11:22:07+03:00" 118: ["smokeStatus"]=> 119: string(6) "Smoked" 120: ["callInitiator"]=> 121: string(3) "IVR" 122: } 123: [1]=> 124: object(LogOffEvent)#%d (4) { 125: ["audienceMemberId"]=> 126: int(34568) 127: ["timestamp"]=> 128: string(25) "2005-11-08T11:22:07+03:00" 129: ["smokeStatus"]=> 130: string(9) "SmokeFree" 131: ["callInitiator"]=> 132: string(3) "IVR" 133: } 134: } 135: }