php-general Digest 31 Aug 2012 19:12:01 -0000 Issue 7945
Topics (messages 318933 through 318934):
Re: How to use wsdl files?
318933 by: Louis Huppenbauer
Re: What's the best way to make a dynamic plugin architecture?
318934 by: Mark
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
Hi there
2012/8/31 Michelle Konzack <linux4miche...@tamay-dogan.net>
> Hello Matijn Woudt,
>
> Am 2012-08-30 16:44:53, hacktest Du folgendes herunter:
> > You could start by looking at the PHP SoapClient [1], which takes a
> > URI to a WSDL descriptor as argument. You can enter the URL to the
> > WSDL file there, like this:
> > $client = new SoapClient("
> http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");
> >
> > Now you need to know which function you want to call, let's say it's
> > called SomeFunction, then you can do:
> > $client->SomeFunction($paramA, $paramB);
> >
> > Hope this gets you started.
>
> Ah thanks... Interesting how it works.
>
> However, I have found "wsdl2php" and converted the wsdl file to a PHP
> class, but I hate classes... Never used it in 12 years. :-D
>
> --8<--------------------------------------------------------------------
> <?php
>
> class checkVat{
> var $countryCode; //string
> var $vatNumber; //string
> }
>
> class checkVatResponse{
> var $countryCode; //string
> var $vatNumber; //string
> var $requestDate; //date
> var $valid; //boolean
> var $name; //string
> var $address; //string
> }
>
> class checkVatApprox{
> var $countryCode; //string
> var $vatNumber; //string
> var $traderName; //string
> var $traderCompanyType; //companyTypeCode
> var $traderStreet; //string
> var $traderPostcode; //string
> var $traderCity; //string
> var $requesterCountryCode; //string
> var $requesterVatNumber; //string
> }
>
> class checkVatApproxResponse{
> var $countryCode; //string
> var $vatNumber; //string
> var $requestDate; //date
> var $valid; //boolean
> var $traderName; //string
> var $traderCompanyType; //companyTypeCode
> var $traderAddress; //string
> var $traderStreet; //string
> var $traderPostcode; //string
> var $traderCity; //string
> var $traderNameMatch; //matchCode
> var $traderCompanyTypeMatch; //matchCode
> var $traderStreetMatch; //matchCode
> var $traderPostcodeMatch; //matchCode
> var $traderCityMatch; //matchCode
> var $requestIdentifier; //string
> }
>
> class checkVatService{
> var $soapClient;
>
> private static $classmap = array('checkVat' => 'checkVat'
> ,'checkVatResponse' => 'checkVatResponse'
> ,'checkVatApprox' => 'checkVatApprox'
> ,'checkVatApproxResponse' =>
> 'checkVatApproxResponse');
>
> function __construct($url='
> http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl')
> {
> $this->soapClient = new SoapClient($url,array("classmap" =>
> self::$classmap,
> "trace" => true,
> "exceptions" => true));
> }
>
> function checkVat(checkVat $checkVat)
> {
> $checkVatResponse = $this->soapClient->checkVat($checkVat);
> return $checkVatResponse;
> }
>
> function checkVatApprox(checkVatApprox $checkVatApprox)
> {
> $checkVatApproxResponse =
> $this->soapClient->checkVatApprox($checkVatApprox);
> return $checkVatApproxResponse;
> }
> }
>
> ?>
> --8<--------------------------------------------------------------------
>
> OK, tried
>
> $VALS = new checkVat;
>
> $VALS->countryCode = 'DE';
> $VALS->vatNumber = '278049239';
>
> $OBJECT = new checkVatService;
> $OBJECT->checkVat;
>
> and up the here I have no error. But How do I get the answer now?
>
> $ANS = $OBJECT->checkVat;
> or
> $ANS = $OBJECT->checkVat();
>
> do not seem to work
>
> print_r($ANS);
>
> Also
>
> $RET = new checkVatResponse;
> print_r($RET);
>
> seems not to work
>
> What I am missing?
>
> Thanks, Greetings and nice Day/Evening
> Michelle Konzack
>
>
>
The method checkVatService::checkVat is expecting an object of type
checkVat to work.
So you'll have to use something like this:
$VALS = new checkVat();
$VALS->countryCode = 'DE';
$VALS->vatNumber = '278049239';
$OBJECT = new checkVatService();
$ANS = $OBJECT->checkVat($VALS);
Sincerely
Louis H.
--- End Message ---
--- Begin Message ---
On Tue, Aug 28, 2012 at 1:43 PM, Matijn Woudt <tijn...@gmail.com> wrote:
> On Tue, Aug 28, 2012 at 1:16 AM, Larry Garfield <la...@garfieldtech.com>
> wrote:
>> On 8/27/12 6:11 PM, Matijn Woudt wrote:
>>
>>>> You should never be calling require() yourself. Just follow the PSR-0
>>>> naming standard and use an autoloader, then you don't have to even think
>>>> about it. There are many existing autoloaders you can use, including
>>>> Composer's, Symfony2's, and probably Zend has one as well.
>>>>
>>>
>>> I believe there's one in PHP by default now called SPLClassLoader or
>>> something like that..
>>>
>>> - Matijn
>>
>>
>> There was a proposal for one, but it was never added. You still need a
>> user-space class loader for PSR-0, but they're readily available.
>>
>>
>> --Larry Garfield
>>
>
> Ah thanks for the info. I heard about it way back and assumed it was
> implemented by now ;)
>
> - Matijn
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
I did some searching on that one since it sounds interesting. It's
laying dormant in bugzilla: https://bugs.php.net/bug.php?id=60128 (the
RFC : https://wiki.php.net/rfc/splclassloader)
Thanks for the advice so far. I will certainly implement Autoloading.
Why didn't i think of that :p Guess my PHP knowledge is a bit rusty
since i did make autoloaders before.
--- End Message ---