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

How to solve the failure of php calling webservice

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Most people do not understand the knowledge points of this article "how to solve the failure of php calling webservice", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to solve the failure of php calling webservice" article.

The solution to the failure of php calling webservice: 1, remove the semicolon before "; extension=php_soap.dll" and restart apache;2, create WSDL file and run creatService.php file; 3, close WSDL cache.

This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer

What if php fails to call webservice?

Php failed to write webservice case and webservice call

As a developer, if you want to write a webservice interface or call someone else's webservice interface, you first need to know what webservice is.

To put it simply, WebService means that some sites open up some services, and it can also be Service developed by yourself, that is, some methods, through URL, specify a certain method name, issue a request, the service (method) in the site, receive your request, do some processing according to the parameters passed, and then return the processed results to you in the form of XML, and your program parses the XML data. Then show it or do something else.

Before you start writing, you need to do some configuration for the php environment:

Open the php.ini file in the php installation directory

Find; extension=php_soap.dll, remove the previous semicolon, save, and restart apache.

Once the environment is configured, you can write php. Create a creatService.php file and copy the following code:

\ n\ n "; $serviceWSDL = 'isPublic () & &! $method- > isConstructor () {$portTypeWSDL.=' getName ()." Request\ "/ >\ ngetName ()." Response\ "/ >\ n\ n" $bindingWSDL.= 'service_name.'#'.$this- > class_name.'#'.$method- > getName (). "\" / >\ n\ n "; $messageWSDL.=' getParameters () Foreach ($parameters as $parameter) {$messageWSDL.= 'getName (). "Response\" >\ n "; $messageWSDL.=' class_name. ".wsdl", "w"); fwrite ($fso, sprintf ('% s% slots, $headerWSDL, $portTypeWSDL, $bindingWSDL, $serviceWSDL, $messageWSDL,')); exit;} / * * SoapDiscovery::getDiscovery () Returns discovery of WSDL. * * @ return string * * / public function getDiscovery () {return "\ n\ n" }}? > the above is about the article "how to solve the failure of php calling webservice". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

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

Development

Wechat

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

12
Report