Get the App
SLTechnology News&Howtos  ›  Servers  › 

What is the CentOS SOAP extension module triggering the service side to perform the corresponding operation?

Shulou Source: shulou.com Published: 2022-06-01 07:15:29 09月25日 Update

CentOS SOAP expansion module triggers the service side to perform the corresponding operation, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

The CentOS SOAP extension module is built in from PHP5, through which we can easily send a CentOS SOAP message to Service, which triggers the service side to perform the corresponding operation and return the result.

First of all, to make sure that the CentOS SOAP extension is installed, the fact that it is not installed is that there will be an error of php error Class' SoapClient' not found when running code that uses soapclient. At this time, you should install php-soap. You can easily use the yum update installation package > yum install php-soap to update these installation packages on CentOS SOAP. After updating these installation packages, you need to restart the apache service, and then the SoapClient class can be used in php script. The following is an example of how to use it:

1.in WSDL mode,soapCall application web service, the example uses asp.net 's web service, providing service.asmx pages, calling and viewing are relatively simple, and most of the example in the manual is of this type, which is relatively simple.

Protocol sent by CentOS SOAP:

POST / servicepath/service.asmx HTTP/1.1 Host: 211.186.1.4 Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://211.186.5.15/Service/ServiceMethod" string string string

Call method:

$client = new SoapClient ("http://www.xxx.com/service/service.asmx?WSDL"); / / send parameter values $param1 =" p1 "; $param2 =" p2 "; $param3 =" p3 "to the SOAP server

/ / serviceParam1,serviceParam2,serviceParam3 is the parameter name corresponding to the sending parameter value (or the field name provided by the service side) $param = array ('serviceParam1' = > $param1,'serviceParam2' = > $param2,'serviceParam3' = > $param3)

/ / the method is named ServiceMethod, and the parameter array is $param. By default, the passed parameter array $arr = $client- > _ _ soapCall ('ServiceMethod',array (' parameters' = > $param) is marked with the parameters field); print_r ($arr)

Here, print_r ($arr) prints out an object, similar to

StdClass Object ([BindValidateResult] = > 01062947546)

After many attempts, I found that using $arr [1], $arr [0] and $arr [BindValidateResult] could not get a valid value. Later, I found that the return value can be accessed through $arr- > BindValidateResult.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Tags: Parameters modules fields arrays methods help updates services valid clear code examples content for this objects manuals articles novice time more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Xiaomi Linux Huawei macOS