PHP calls the interface code of the wsdl file type, _ PHP Tutorial

Source: Internet
Author: User
Tags array definition
PHP calls the interface code of the wsdl file type to share ,. PHP shares the interface code for calling the wsdl file type. the copied code is as follows: the php class is automatically generated by the system. it is only for testing purposes. the classIndexActionextendsAction {publicfunct PHP shares the interface code for calling the wsdl file type,

The code is as follows:


<? Php
// This class is automatically generated by the system for testing purposes only
Class IndexAction extends Action {
Public function index (){
// # API for submitting, modifying, canceling, and querying distributor orders
$ Wsdl1 = 'http: // 127.0.0.1: 8080/ejfxs/services/order? Wsdl ';
// # Contact address of the reseller's salable product
$ Wsdl = 'http: // 127.0.0.1: 8080/ejfxs/services/availableProducts? Wsdl ';
// Instantiate the object
$ Client = new SoapClient ($ wsdl );
// Interface parameters.
$ Param1 = array ('password' => '000000', 'dis _ code' => 'fxbzzhlyw', 'checkcode' => 'fxfaxm5u1y ');
// Interface method.
$ Ret1 = $ client-> getAvailableProducts ($ param1 );
// Convert XML data into an array
$ Array = (array) $ ret1;
// Convert to simplexml_load_string object
$ V = simplexml_load_string ($ array ['Return ']);
// Array definition
$ Varr = $ v-> ybproducts-> fzhproducts-> product;
// Obtain 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'
';
}
// Obtain all methods and parameters of the interface
// Print_r ($ client->__ getfunctions ());
// Print_r ($ client->__ getTypes ());
}
}
?>


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

This is probably the case! The above annotations are clear. Leave a message if you do not understand it. Or we recommend that you improve it. Leave a message.

The code is as follows: php // This class is automatically generated by the system and is only for testing purposes. class IndexAction extends Action {public funct...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.