PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Web Services » SOAP » Bug #4076

SOAP_WSDL generateProxyCode needs additional constructor

Details

Request #4076SOAP_WSDL generateProxyCode needs additional constructor
Submitted2005-04-06 11:24 UTC
Fromlafriks at hello dot lv
Assignedchagenbu
StatusClosed
PackageSOAP
PHP VersionIrrelevant
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2005-04-06 11:24 UTC] lafriks at hello dot lv

Description:
------------
It would be great that when generating proxy code using SOAP_WSDL generateProxyCode function it would generate additional constructor for generated file. So it would be posible to when programming such way to define path to web service in configuration file and it wouldn't be necesery regenerate proxy code for development and production server if thay are using same web services just on diffrent servers.

Reproduce code:
---------------
Example for generated file:

class WebService_Test_TestSoap extends SOAP_Client
{
function WebService_Test_TestSoap()
{
$this->SOAP_Client("http://localhost/test.asmx", 0);
}
function WebService_Test_TestSoap($path)
{
$this->SOAP_Client($path, 0);
}

...

}

[2005-04-06 14:12 UTC] lafriks at hello dot lv

Diff for WSDL.php file:
460,461c460,461
< " function $classname()\n{\n".
< " \$this->SOAP_Client(\"$clienturl\", 0, 0,
---
> " function _soap_client(\$path) {\n".
> " \$this->SOAP_Client(\$path, 0, 0,
479,480c479,480
< " function $classname()\n{\n".
< " \$this->SOAP_Client(\"$clienturl\", 0);\n".
---
> " function _soap_client(\$path) {\n".
> " \$this->SOAP_Client(\$path, 0);\n".
482a483,488
> $class .= " function $classname() {\n".
> " \$this->_soap_client(\"$clienturl\");\n".
> " }\n".
> " function $classname(\$path) {\n".
> " \$this->_soap_client(\$path);\n".
> " }\n";

[2005-04-07 08:23 UTC] lafriks at hello dot lv

First patch was not working :)
This one should be working just fine ;)

--- E:\Macibas\pear_soap\SOAP-0.8.1\WSDL.php Sun Aug 22 23:39:32 2004
+++ E:\Macibas\pear_soap\WSDL.php Thu Apr 07 11:20:31 2005
@@ -457,8 +457,8 @@

if (is_array($this->proxy) && count($this->proxy) > 0) {
$class = "class $classname extends SOAP_Client\n{\n".
- " function $classname()\n{\n".
- " \$this->SOAP_Client(\"$clienturl\", 0, 0,
+ " function $classname(\$path=\"$clienturl\") {\n".
+ " \$this->SOAP_Client(\$path, 0, 0,
array(";

foreach($this->proxy as $key => $val) {
@@ -476,8 +476,8 @@
$class = str_replace(',))', '))', $class);
} else {
$class = "class $classname extends SOAP_Client\n{\n".
- " function $classname()\n{\n".
- " \$this->SOAP_Client(\"$clienturl\", 0);\n".
+ " function $classname(\$path=\"$clienturl\") {\n".
+ " \$this->SOAP_Client(\$path, 0);\n".
" }\n";
}