Interface code sharing of PHP calling wsdl file type

  • 2021-08-05 09:09:01
  • OfStack


<?php
// 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 and Query Interface
         $wsdl1='http://127.0.0.1 : 8080/ejfxs/services/order?wsdl';
         //# Interface address of distributor saleable products
        $wsdl='http://127.0.0.1 : 8080/ejfxs/services/availableProducts?wsdl';
        // Instantiate object
        $client=new SoapClient($wsdl);
        // Interface parameters.
        $param1=array('password'=>'123456','dis_code'=>'fxBZZHLYW','checkcode'=>'FXFAXM5U1Y');
        // Interface method.
        $ret1 = $client->getAvailableProducts($param1);
        // Will XML Convert data into arrays
        $array=(array)$ret1;
        // Convert to simplexml_load_string Object
        $v=simplexml_load_string($array['return']);
        // Array definition
        $Varr=$v->ybproducts->fzhproducts->product;
        // Get the concrete 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 '<br/>';
        }
        // Get all methods and parameters of the interface
        // print_r($client->__getfunctions());
        // print_r($client->__getTypes());
    }
}
?>

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

That's probably what it looks like! The above notes are clear. Don't understand the message. Or suggest improvements. Leave a message.


Related articles: