Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report