new features
| From: | brad lafountain | Date: | Sun, 02 Jun 2002 18:06:42 +0000 |
| Subject: | new features | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-42@lists.php.net to get a copy of this message | ||
After talking to shane I added a few things to php-soap.
I extended the soapvar class so you can override the namespace and type
definitions.
new SoapVar(data, encode, type, namespace);
data - the data that you are encoding
encode - this is how the data is actually encoded
type - string of the type you want
namespace - namespace of the type
$ret->long = 123;
$ret->string = "1234";
$ret = new SoapVar($ret, SOAP_ENC_OBJECT, "SOAPStruct",
"http://soapinterop.org/xsd");
the SOAP_ENC_OBJECT parameter is how the data is acually encode.
SOAP_ENC_OBJECT means to encode the ret like it is a soap struct. This is
usefull when you want to control how the data is encode. There is a list of
encodings on the webpage.
here is a usefull example of this.
$ret = new SoapVar(time(), XSD_DATETIME, "myDate", "urn:myDate");
now you are passing in a int time but since the way xsd_datetime is encode it
will convert the in to the xsd equivant date.
<return xsi:type="ns1:myDate"
xmlns:ns1="urn:myDate">2002-06-02T14:10:31</return>
You can pass null as the parameter and it will "guess" how to encode the data.
The second thing I added is the ability to override the return name of a
function.
You can do this by returning the new SoapReturn class
return new SoapReturn($data, "returnName");
These changes are in currently in cvs.
- Brad
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com