search
Homephp教程PHP源码php soap 实例

<script>ec(2);</script>

  Server+Client+WSDL

 

声明:很简单!!!!!!

参考了如下:

 

先建Server,然后使用wsdl工具来生成wsdl,我用的是zend development environment,

zde中的tools中的wsdl generator wizard

第一页是名字,和输出地址(输出后直接挪过去就OK)

第二页是类和地址,类挑上勾,URL那里添server那个文件的地址

第三页 finish

别忘了拷那个wsdl过去...

 

记得server引用的那个类文件里不要有输出.

 

一共有两个需要添地址的地方

一个是wsdl中的描述http://127.0.0.1/test/CulculatorServer.php

一个是client中的连接http://127.0.0.1/test/Culculator.wsd

 

类文件

 

/**

 * @name Culculator.php

 * @date Fri Jan 25 12:43:40 CST 2008

 * @copyright 马永占(MyZ)

 * @author 马永占(MyZ)

 * @link http://blog.111cn.net/mayongzhan/

 */

 

class Culculator

{

       /**

        * 求和

        *

        * @param float $x

        * @param float $y

        * @return float

        */

       public function add($x, $y)

       {

              return $x + $y;

       }

}

?>

 

Server

 

/**

 * @name CulculatorServer.php

 * @date Fri Jan 25 12:44:04 CST 2008

 * @copyright 马永占(MyZ)

 * @author 马永占(MyZ)

 * @link http://blog.111cn.net/mayongzhan/

 */

 

include(''./Culculator.php'');

$server = new SoapServer(''./Culculator.wsdl'');

$server->setClass(''Culculator'');

$server->handle();

?>

 

Client

 

/**

 * @name CulculatorClient.php

 * @date Fri Jan 25 12:43:54 CST 2008

 * @copyright 马永占(MyZ)

 * @author 马永占(MyZ)

 * @link http://blog.111cn.net/mayongzhan/

 */

 

$soap = new SoapClient(''http://127.0.0.1/test/Culculator.wsdl'');

echo $soap->add(1, 2);

?>

 

WSDL

 

 

 

      

             

             

      

      

             

      

      

             

                    

                            求和

                    

                    

                    

             

      

      

             

             

                    

                    

                           

                    

                    

                           

                    

             

      

      

             

                    

             

      

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),