Skip to content

Commit 31306c2

Browse files
Preversion 2.4:
Bugfix: Added XSD type gMonth to the list of basic types Bugfix: The NuSOAP adapter didn't notice the array type definition changes from version 2.3 Bugfix: Endless loop if writing to the debug file didn't work Bugfix: The Servers extension produced invalid JSON JavaScript client code Changed: Download links won't be displayed anymore if the output of PHP was disabled f.e. Changed: PhpWsdl is now responsible for interpreting the @pw_set keyword Changed: The complex type classes from the generated PHP/JavaScript code now support constructor parameters. To enable the PHP constructor, have a look at the static PhpWsdlComplex::$DefaultEnablePhpConstructor property or the setting "phpconstructor" (@pw_set phpconstructor=1) Changed: PhpWsdlServers in XML RPC mode will recode complex types as object (the PHPs RPC-methods decode objects as array per default). To get the behavoir from version 2.3, you can set the PhpWsdlServers::$NoRpcRecode property to TRUE Changed: All documentation can now be found online at the Google Code Wiki of this project Changed: class.complextypedemo.php and demo2.php include enumeration and inherit demonstrations now Changed: The hook calling method didn't work with older PHP versions, it's strongly recommend to use PHP 5.2.10 or later. However, the change in this version should support older PHP versions. New: You can mix up handler methods in different classes when using the proxy class (see demo3.php) New: PhpWsdl allows you to mix up global and class methods (even from different classes and without the proxy) within one webservice (see demo7.php) when setting the PhpWsdl->CreateHandler property to TRUE New: The JavaScript proxy client of PhpWsdlServers does now support a callback data parameter (see democlient-json.html) New: The proxy class supports return value encodings (defined in PhpWsdl::$TypeEncoding) when setting the PhpWsdl::$EncodeProxyReturn to TRUE New: The SOAP client supports automatic parameter encoding (defined in PhpWsdl::$TypeEncoding) when setting the PhpWsdlClient->EncodeParameters to TRUE New: The PhpWsdlServers extension now supports a hook for encoding values from specific types. Per default basic types won't be encoded. You can encode them by yourself by hooking to EncodeTypeParameterHook and EncodeTypeReturnHook (or EncodeTypeHook for both). The same for decoding. New: Support for enumerations New: Support for inherited complex types. Note: Be careful with inheriting and SOAP. The native PHP SoapClient won't provide informations about parent classes to the PhpWsdlClient, so inherited complex types are not supported by PhpWsdlClient at all! New: Support for SOAP exceptions (see demo(2).php and class.complextypedemo.php) New: Debugging messages may be forwarded to a handler method New: Response compression may now be disabled in the Servers extension by setting PhpWsdlServers::$EnableCompression to FALSE git-svn-id: http://php-wsdl-creator.googlecode.com/svn/trunk@43 502c9374-d6e3-3b03-70e3-5bb7e65db109
1 parent 0ea3bab commit 31306c2

35 files changed

+1523
-213
lines changed

ajax/class.phpwsdlajax.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/*
44
PhpWsdl - Generate WSDL from PHP
5-
Copyright (C) 2011 Andreas Zimmermann, wan24.de
5+
Copyright (C) 2011 Andreas Müller-Saala, wan24.de
66
77
This program is free software; you can redistribute it and/or modify it under
88
the terms of the GNU General Public License as published by the Free Software
@@ -25,7 +25,7 @@
2525
/**
2626
* This webservice forwards a SOAP request to another SOAP server using the PhpWsdlClient
2727
*
28-
* @author Andreas Zimmermann, wan24.de
28+
* @author Andreas Müller-Saala, wan24.de
2929
*/
3030
class PhpWsdlAjax{
3131
/**

class.complextypedemo.php

+115-3
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,78 @@
1313
*
1414
* @pw_element string $StringA A string with a value
1515
* @pw_element string $StringB A string with a NULL value
16-
* @pw_set nillable=false The next element can't be NULL
1716
* @pw_element int $Integer An integer
18-
* @pw_set nillable=false The next element can't be NULL
1917
* @pw_element boolean $Boolean A boolean
18+
* @pw_element DemoEnum $Enum An enumeration
2019
* @pw_complex ComplexTypeDemo The complex type name definition
2120
*/
2221
class ComplexTypeDemo{
22+
/**
23+
* A string
24+
*
25+
* @var string
26+
*/
2327
public $StringA='String A';
28+
/**
29+
* Another string
30+
*
31+
* @var string
32+
*/
2433
public $StringB=null;
34+
/**
35+
* An integer
36+
*
37+
* @var int
38+
*/
2539
public $Integer=123;
40+
/**
41+
* A boolean
42+
*
43+
* @var boolean
44+
*/
2645
public $Boolean=true;
46+
/**
47+
* An enumeration
48+
*
49+
* @var DemoEnum
50+
*/
51+
public $Enum;
52+
53+
/**
54+
* The constructor
55+
*
56+
* @ignore
57+
*/
58+
public function ComplexTypeDemo(){
59+
$this->Enum=DemoEnum::$Enum['ValueB'];
60+
}
61+
}
62+
63+
// Now a demonstration how to implement inherited complex types:
64+
65+
/**
66+
* This complex type inherits all properties of ComplexTypeDemo
67+
*
68+
* @pw_element string $AdditionalString An additional string
69+
* @pw_set inherit=ComplexTypeDemo <- To tell PhpWsdl about the base type
70+
* @pw_complex ComplexTypeDemoB The complex type name definition
71+
*/
72+
class ComplexTypeDemoB extends ComplexTypeDemo{
73+
/**
74+
* An additional string
75+
*
76+
* @var string
77+
*/
78+
public $AdditionalString='';
79+
80+
/**
81+
* The constructor
82+
*
83+
* @ignore
84+
*/
85+
public function ComplexTypeDemoB(){
86+
parent::ComplexTypeDemo();
87+
}
2788
}
2889

2990
// You can also create array types as complex type. Here for the string type and the ComplexTypeDemo complex type.
@@ -33,7 +94,7 @@ class ComplexTypeDemo{
3394
* @pw_complex stringArray A string array type
3495
*/
3596
/**
36-
* @pw_complex ComplexTypeDemoArray An array of ComplexTypeDemo
97+
* @pw_complex ComplexTypeDemoBArray An array of ComplexTypeDemoB
3798
*/
3899

39100
// But you may also create an array without any name restrictions. To use the arrayOfInt[] finally, use the type
@@ -42,3 +103,54 @@ class ComplexTypeDemo{
42103
/**
43104
* @pw_complex arrayOfInt[] int An int array type
44105
*/
106+
107+
// This is how to implement an enumeration with the @pw_enum keyword. An enumeration needs a type, a name
108+
// and a comma seperated list of enumerateable values of the type. You should only use types that can be interpreted
109+
// when placing them between single or double quotes (string, int, float, ...). String values can't include a comma
110+
// because this is the list seperator.
111+
112+
/**
113+
* This is how to define an enumeration. You don't need the class DemoEnum - it's just to demonstrate how
114+
* I handle enumerations in PHP.
115+
*
116+
* @pw_enum string DemoEnum ValueA,ValueB,ValueC A sample enumeration
117+
*/
118+
abstract class DemoEnum{
119+
/**
120+
* A description for ValueA
121+
*
122+
* @var string
123+
*/
124+
const ValueA='ValueA';
125+
/**
126+
* A description for ValueB
127+
*
128+
* @var string
129+
*/
130+
const ValueB='ValueB';
131+
/**
132+
* A description for ValueC
133+
*
134+
* @var string
135+
*/
136+
const ValueC='ValueC';
137+
138+
/**
139+
* Constructor that will throw an exception because you can't instance an enumeration
140+
*/
141+
public function DemoEnum(){
142+
throw(new Exception('This is an enumeration - instances are not supported!'));
143+
}
144+
}
145+
146+
// This complex type will be used as exception type for all methods
147+
148+
/**
149+
* This is the exception type for all methods
150+
*
151+
* @pw_element string message The message
152+
* @pw_element int code The code
153+
* @pw_element string file The file name
154+
* @pw_element int line The line number
155+
* @pw_complex SoapFault A complex type describing the SoapFault exception
156+
*/

0 commit comments

Comments
 (0)