Home >Backend Development >PHP Tutorial >Usage examples of soap in PHP, PHPsoap usage examples_PHP tutorial
The examples in this article describe the usage of soap in PHP and are shared with everyone for your reference. The specific usage analysis is as follows:
PHP There are two ways to use soap.
1. Use wsdl file
Server side:
服务器端:
echo $soap->Add(1,2);
}catch(Exction $e){
echo print_r($e->getMessage(),true);
}
?>
希望本文所述对大家的PHP程序设计有所帮助。
How to determine that it cannot be used? Without pictures and facts, it is impossible to determine the cause of the error (only php5 and above support soap)
try {
$this->soap-> = new SoapClient ( "localhost/WebService.asmx?wsdl" );//Note that this is the asmx service using c#.
$ obj = $this->soap->webservice method name (array ("server parameter name"=>"parameter value","second server parameter name"=>"second parameter value") ) ;
return $this->json_decode_CSharp ($obj);//Here are different parsing bodies implemented according to different SERVICE (we return JSON data).json_decode_csharp is my custom function
} catch ( Exception $e ) {
$this->file->vim ( $e->__toString (), $this->logpath . date ( "Ymd" ) . ".log" );
return null;
}
You can join the PHP learning exchange group and ask in the group: 40383880