Re: Re: How to use wsdl files?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there

2012/8/31 Michelle Konzack <linux4michelle@xxxxxxxxxxxxxxx>

> 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.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux