Home > Backend Development > PHP Tutorial > Sharing of interface code for PHP calling wsdl file type, _PHP tutorial

Sharing of interface code for PHP calling wsdl file type, _PHP tutorial

WBOY
Release: 2016-07-13 10:13:38
Original
1054 people have browsed it

Sharing the interface code for PHP calling wsdl file type,

Copy code The code is as follows:

// This class is automatically generated by the system and is for testing purposes only
class IndexAction extends Action {
Public function index(){
//#Distributor order submission, modification, cancellation, query interface
            $wsdl1='http://127.0.0.1:8080/ejfxs/services/order?wsdl';
//#Interface address of products that distributors can sell
          $wsdl='http://127.0.0.1:8080/ejfxs/services/availableProducts?wsdl';
​​​​ //Instantiated object
          $client=new SoapClient($wsdl);
​​​​ //Interface parameters.
          $param1=array('password'=>'123456','dis_code'=>'fxBZZHLYW','checkcode'=>'FXFAXM5U1Y');
​​​​ //Interface method.
           $ret1 = $client->getAvailableProducts($param1);
//Convert XML data into array
          $array=(array)$ret1;
//Convert to simplexml_load_string object
           $v=simplexml_load_string($array['return']);
//Array definition
           $Varr=$v->ybproducts->fzhproducts->product;
//Get the specific value
for ($i=0; $i < count($Varr); $i++) {
echo $Varr[$i]->prod_id;
echo $Varr[$i]->product_name;
echo $Varr[$i]->prod_code;
echo $Varr[$i]->prod_category;
echo $Varr[$i]->supply_id;
echo $Varr[$i]->price;
echo $Varr[$i]->parprice;
echo $Varr[$i]->total_ticket_num;
echo $Varr[$i]->inventory;
echo $Varr[$i]->product_name;
echo $Varr[$i]->product_name;
echo '
';
}
//Get all methods and parameters of the interface
// print_r($client->__getfunctions());
// print_r($client->__getTypes());
}
}
?>

================================================== ===============

That’s probably what it looks like! The comments above are clearer. I don’t understand the message. Or suggest improvements. message.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/914059.htmlTechArticlePHP calls the interface code of wsdl file type to share, copy the code as follows: php // This class is automatically generated by the system , for testing purposes only class IndexAction extends Action { public funct...
Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template