PHP5 under Wsdl,soap Call implementation process

Source: Internet
Author: User
First, the basic concept

Soap (Simple Object access Protocol) is a simple protocol for exchanging information in a decentralized or distributed environment and is an XML-based protocol that consists of four parts: Soap Encapsulation (envelop), encapsulation definition A framework that describes what the content in the message is, who sent it, who should accept and handle it, and how to deal with it; the SOAP encoding rule (encoding rules), which represents an instance of the data type that the application needs to use; SOAP RPC Representation (RPC representation), which represents the contract for remote procedure calls and replies; A SOAP binding (binding) that uses the underlying protocol to exchange information.

WSDL (Web service Description Language) is the standard XML format for describing XML Web services, and WSDL is presented by developers such as Ariba, Intel, IBM, and Microsoft. It defines the operations and messages sent and received by a given Web service in an abstract way that is not specific to the language. In its definition, you cannot consider WSDL as an Object interface definition language, for example, application architectures such as CORBA or COM use the Object interface definition language. WSDL maintains protocol neutrality, but it does have built-in support for binding soap, thus establishing an inextricable connection with soap. So, when I discuss WSDL in this article, I'll assume that you have soap as your communication protocol.

While soap and WSDL are two of the standards of Web service, they are not necessarily connected and can be used independently. The relationship between them is similar to the relationship between HTTP and HTML. The former is a protocol, and the latter is a description of a Web server.


Second, the configuration under the PHP5

In the PHP configuration file php.ini, locate the

Extension=php_soap.dll

then remove the previous; Number and restart the Web service

Iii. querying Web service methods and parameters, data types

One province telecom Company's entry interface is HTTP://***.******.COM/SERVICES/ACCEPTEDBUSINESS?WSDL
We use SoapClient's __geunctions () and __gettypes () methods to view the interface's methods, parameters, and data types
Only the interfaces listed in __getfunctions can be called by soap.
Create code under the root directory soap.php

 
  __getfunctions ());    Print_r ($client->__gettypes ());  } catch (SoapFault $e) {    print $e;}? >

After the browser runs: http://localhost/soap.php, the results are as follows

Array ([0] = Arrayof_xsd_anytype introduceacceptedbusiness (string $c 3, String $c 4, String $linkman, String $linknum , string $num, String $idcard, String $remark, String $address) [1] = Arrayof_xsd_anytype introduceacceptedbusiness Byaizhuangwei (String $subname, String $linkphone, String $idcard, String $address, String $businesstype, String $marketco De, String $surveycode, String $commanager, String $commanagerphone, String $bendiwang, String $fenju, String $zhiju, Stri Ng $remark) [2] = = String Introduceacceptedbusinessbystandardinterface (string $xmlStr) [3] = = string introduce Acceptedbusinessbycallout (String $xmlStr) [4] = = String Introduceacceptedbusinessbyyddj (string $xmlParam) [5] =&G T Arrayof_xsd_anytype Queryacceptedbusinessbyaizhuangwei (String $surveycode, String $starttime, String $endtime) [6] =&G T String Querycalloutorderbyconfig (String $xmlParam)) Array ([0] = AnyType arrayof_xsd_anytype[])

There is a method Introduceacceptedbusinessbystandardinterface (string $xmlStr) that will be the interface to be used in the development documentation, with the arguments as XML strings

There are other interfaces mentioned in the SoapHeader certification, which requires the addition of __setsoapheaders method, specific to see http://php.net/manual/zh/soapclient.setsoapheaders.php


Iv. Submission of orders

This step involves stitching the XML string according to the development document, and then passing in as a parameter to the Introduceacceptedbusinessbystandardinterface
Create a acceptedbusiness.php with the following content

 
      
 
        
  
   
    
   * *
  Telecom
         
  Zhang San 13412341234 
         
  
   
  
         
  
   
  
         
  
   
    
   Guangdong Shenzhen
  
         
  
   
    
   iPhone 6
  
         
  
         
  
   
    
   1111111111111111111111111111111
  
         2111      
  
   
    
   1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 111111111111111111111111111111111111111111111111111
  
       
 
    ";    $return = $client->introduceacceptedbusinessbystandardinterface ($xml);    Print_r ($return);} catch (SoapFault $e) {    print_r (' Exception: '. $e);}? >

After executing in the browser, return

 
  
 
      
  
   
    
   0
  
       
  
   
    
   into single success!
  
       
  
   
    
   2014100905523549742
  
   
 
  

Reference: http://www.cnblogs.com/txw1958/p/php5-soap-wsdl.html

The above describes the PHP5 under the WSDL,SOAP call implementation process, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.