This extension wraps easywsdl2php as gii module.
It's an easy to use WSDL to PHP code generator. Just enter the address of the WSDL and the application will generate the library that you will use to write your code.
I did some minor changes to the original EasyWsdl2PHP.php code (formatting, 'extends' params) but did't change the code generation.
No warrenty that easywsdl always will be able to generate valid code, but for my purpose it works (tested with Silverlight/Delphi/Yii soap servers).
Example:
gii will generate the class file 'GeoIpService.php' in protected/components (=default). This file contains all necessary classes generated from wsdl.
Create a controller action:
public function actionMyIp() { $geoIpService = new GeoIpService; $response = $geoIpService->GetGeoIPContext(new GetGeoIPContext); $geoIp = $response->GetGeoIPContextResult; echo sprintf('Your IP: %s (%s, %s)',$geoIp->IP,$geoIp->CountryName,$geoIp->CountryCode); }
If you want you can
v.0.5.2
v.0.5.1
Total 13 comments
Hello and thanks for the extension. I have still some problems with calling webservices. I get the error "WSDL Service Url is not a valid URL" when I placed my wsdl file in an accessible directory and called "http://localhost/yii_app_path/my.wsdl". The wsdl file is accessible when I call the url in my browser. Another thing that I tried was to echo out the whole file content in a php file. That also did not work. Any ideas?
Hi, I install and generated the file with class of conection but i dont know how send params and recive params of web services:
this is code generate: class getTransactionInformation { public $request; //getTransactionInformationType; }
class getTransactionInformationType { public $EntityCode; //string; public $TicketId; //string; }
class getTransactionInformationResponse { public $getTransactionInformationResult; //getTransactionInformationResponseType; }
class getTransactionInformationResponseType { public $EntityCode; //string; public $TicketId; //string; public $TrazabilityCode; //string; public $TranState; //string; public $ReturnCode; //string; public $TransValue; //decimal; public $TransVatValue; //decimal; public $PayCurrency; //string; public $CurrencyRate; //decimal; public $BankProcessDate; //date; public $BankName; //string; public $PaymentSystem; //string; public $ReferenceArray; //string; public $RetriesTicketId; //retriesTicketIdType; }
class retriesTicketIdType { public $TicketId; //string; public $TranState; //string; }
class createTransactionPayment { public $request; //createTransactionType; }
class createTransactionType { public $EntityCode; //string; public $SrvCode; //string; public $TransValue; //decimal; public $TransVatValue; //decimal; public $SrvCurrency; //string; public $URLResponse; //string; public $URLRedirect; //string; public $Sign; //string; public $SignFields; //string; public $ReferenceArray; //string; }
class createTransactionPaymentResponse { public $createTransactionPaymentResult; //createTransactionResponseType; }
class createTransactionResponseType { public $ReturnCode; //string; public $TicketId; //string; public $eCollectUrl; //string; }
/** * The soap client proxy class */ class PruebasWsdl { public $soapClient;
private static $classmap = array( 'getTransactionInformation'=>'getTransactionInformation', 'getTransactionInformationType'=>'getTransactionInformationType', 'getTransactionInformationResponse'=>'getTransactionInformationResponse', 'getTransactionInformationResponseType'=>'getTransactionInformationResponseType', 'retriesTicketIdType'=>'retriesTicketIdType', 'createTransactionPayment'=>'createTransactionPayment', 'createTransactionType'=>'createTransactionType', 'createTransactionPaymentResponse'=>'createTransactionPaymentResponse', 'createTransactionResponseType'=>'createTransactionResponseType', ); function __construct($url='http://zeus.mipuntodepago.com/d_express/webservice/eCollectWebservicesv2.asmx?wsdl') { $this->soapClient = new SoapClient($url,array("classmap"=>self::$classmap,"trace" => true,"exceptions" => true)); } function getTransactionInformation($getTransactionInformation) { $getTransactionInformationResponse = $this->soapClient->getTransactionInformation($getTransactionInformation); return $getTransactionInformationResponse; } function createTransactionPayment($createTransactionPayment) { $createTransactionPaymentResponse = $this->soapClient->createTransactionPayment($createTransactionPayment); return $createTransactionPaymentResponse; }}
as Instantius several classes in one file and not see yii mistake that can not find the class
Sorry, I can't help with this issue, because it is a problem of the easywsdl2php implementation.
I have only implemented the wrapper, so that it can be used as gii module and I didn't study the implementation of easywsdl2php.
Hi Joblo, I have some problems with the generated code, when a webservice operation have input message and output message like these:
Thre generated code is:
Tried also with the patch proposed by Patrice and the result is:
Nice extension. I just changed the vendor source(EasyWsdl2PHP.php) in order to manage functions that have more than one parameter.
Now it's working.
Thank you very much!
See comment 7706 for the solution.
It looks like the fix in v0.5.1 wasn't finished correctly
Hi.
I managed to get it installed within Gii, but when I click the "Preview" button, nothing shows up under the list of generated code.
I'm using Yii 1.1.10., MAMP 2.0.2, OSX Lion.
Regards.
I downloaded V0.5.1 but could not get it to run. I eventually traced it to a problem with my version of wsdl2php\Wsdl2phpGenerator.php
"Wsdl2PhpCode" should be replaced with "Wsdl2phpCode" ....
Otherwise, a really usefull extension for me. Thanks
fixed in v0.5.1 gii was searching for a file 'Wsdl2phpGenerator.php' but the filename was 'Wsdl2PhpGenerator.php', so I didn't realize this, because I'm working on windows...
I don't see wsdl2php in my gii. I don't have any other gii extensions installed so I tried with and without the application path set. Do I need something else installed as well?
Extract the files under /protected/gii.
gii is looking for extensions by default in this path.
So the files of the extension are located under:
YIIDIR/protected/gii/wsdl2php/Wsdl2PhpCode.php ...
If you have installed another gii extension (giix,...), where the generatorPaths is specified you have to add this defaultpath too:
You call gii with index.php?r=gii (or index.php/gii if urlManager is configured)
I believe it is supposed to be index.php?r=gii and I don't know where to extract those files as putting it in /protected/gii or in yiidir/gii made anything like Wsdl2Php Generator appear in gii...
Leave a comment
Please login to leave your comment.