Implementation of SOAP calls in the WSDL in PHP5

Source: Internet
Author: User
: This article mainly introduces the implementation process of SOAP call in the WSDL of PHP5. if you are interested in the PHP Tutorial, refer to it. I. Basic concepts

Simple Object Access Protocol (SOAP) is a Simple Protocol for exchanging information in a distributed or distributed environment. it is an XML-based Protocol that consists of four parts: the SOAP encapsulation (envelop) defines a framework that describes the content in a message, who sent the message, who should accept and process it, and how to process it; the SOAP encoding rules (encoding rules) are used to represent the data type instances required by the application; the soap rpc representation (RPC representation) indicates the protocols for remote process calls and responses; SOAP binding, which uses the underlying protocol to exchange information.

Web Service Description Language (WSDL) is the standard XML format used to describe XML Web services. WSDL is proposed by developers such as Arba, Intel, IBM, and Microsoft. It defines the operations and messages sent and received by a given Web service in an abstract way unrelated to a specific language. In terms of its definition, you cannot regard WSDL as an object interface definition language. for example, the application architecture such as CORBA or COM will use the object interface definition language. WSDL maintains protocol neutral, but it does have built-in support for binding SOAP, thus establishing an inseparable relationship with SOAP. So when I talk about WSDL in this article, I assume that you use SOAP as your communication protocol.

Although SOAP and WSDL are two standards of web services, they are not necessarily related 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.


2. PHP5 configuration

In the php configuration file php. ini, find

extension=php_soap.dll

Remove the previous; number, and then restart the web service.

III. query web service methods, parameters, and data types

The incoming ticket interface of a provincial telecommunications company is http: // *****. *******. com/services/AcceptedBusiness? Wsdl
We use the _ geunctions () and _ getTypes () methods of SoapClient to view the methods, parameters, and data types of this interface.
Only interfaces listed in _ getFunctions can be called by soap.
Create code soap. php in the root directory

 __getFunctions());    print_r($client->__getTypes());  } catch (SOAPFault $e) {    print $e;}?>

After you run http: // localhost/soap. php in a browser, the following result is returned:

Array(    [0] => ArrayOf_xsd_anyType introduceAcceptedBusiness(string $c3, string $c4, string $linkman, string $linknum, string $num, string $idcard, string $remark, string $address)    [1] => ArrayOf_xsd_anyType introduceAcceptedBusinessByAiZhuangWei(string $subname, string $linkphone, string $idcard, string $address, string $businesstype, string $marketcode, string $surveycode, string $commanager, string $commanagerphone, string $bendiwang, string $fenju, string $zhiju, string $remark)    [2] => string introduceAcceptedBusinessByStandardInterface(string $xmlStr)    [3] => string introduceAcceptedBusinessByCallOut(string $xmlStr)    [4] => string introduceAcceptedBusinessByYddj(string $xmlParam)    [5] => ArrayOf_xsd_anyType queryAcceptedBusinessByAiZhuangWei(string $surveycode, string $starttime, string $endtime)    [6] => string queryCallOutOrderByConfig(string $xmlParam))Array(    [0] => anyType ArrayOf_xsd_anyType[])

There is a method introduceAcceptedBusinessByStandardInterface (string $ xmlStr), which will be the interface to be used in the development documentation. the parameter is an xml string.

In addition, some interfaces mentioned SoapHeader authentication, which requires the _ setSoapHeaders method, the specific can view the http://php.net/manual/zh/soapclient.setsoapheaders.php


4. submit an incoming ticket

This step is to concatenate an xml string according to the development document, and then pass it as the introduceacceptedbusinpolicystandardinterface parameter.
Create acceptedbusiness. php with the following content:

     
       
  
   
** China Telecom
        
        
  
   
Zhang San
        
  
   
13412341234
        
  
   
Guangdong, Shenzhen
        
  
   
IPhone 6
        
        
  
   
1111111111111111111111111111111
  2111      
  
   
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
      
 "; $ Return = $ client-> introduceAcceptedBusinessByStandardInterface ($ xml); print_r ($ return);} catch (SOAPFault $ e) {print_r ('exception :'. $ e) ;}?>

After Execution in the browser, return

 
     
  
   
0
      
  
   
Ticket entered!
      
  
   
2014100905523549742
  
 

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

The above introduces the WSDL and SOAP call implementation process in PHP5, including some content. I hope my friends who are interested in the PHP Tutorial can help me.

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.