PHP calls the interface code share of the WSDL file type,
Copy CodeThe code is as follows:
<?php
This class is automatically generated by the system and is intended for testing purposes only
Class Indexaction extends Action {
Public Function index () {
#分销商订单提交, modify, Cancel, query interface
$wsdl 1= ' http://127.0.0.1:8080/ejfxs/services/order?wsdl ';
#分销商可销售产品接口地址
$wsdl = ' http://127.0.0.1:8080/ejfxs/services/availableProducts?wsdl ';
Instantiating an Object
$client =new soapclient ($WSDL);
Interface parameters.
$param 1=array (' password ' = ' 123456 ', ' dis_code ' = ' fxbzzhlyw ', ' checkcode ' = ' fxfaxm5u1y ');
interface method.
$ret 1 = $client->getavailableproducts ($param 1);
Convert XML data to an array
$array = (array) $ret 1;
Convert to Simplexml_load_string Object
$v =simplexml_load_string ($array [' return ']);
Array definition
$Varr = $v->ybproducts->fzhproducts->product;
Get to a 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 interface all methods and parameters
Print_r ($client->__getfunctions ());
Print_r ($client->__gettypes ());
}
}
?>
=================================================================
That's probably the way it is! The above comments are quite clear. Do not understand the message. or suggestions for improvement. Message.
http://www.bkjia.com/PHPjc/914059.html www.bkjia.com true http://www.bkjia.com/PHPjc/914059.html techarticle PHP calls the WSDL file type interface code share, copy the code as follows: PHP//This class is automatically generated by the system, for testing purposes class Indexaction extends Action {public funct ...