Phpsoap instances do not use wsdl

Source: Internet
Author: User
Blog. csdn. netmayongzhan

Http://blog.csdn.net/mayongzhan-ma yongzhan, myz, mayongzhan Server + Client end with the wsdl write this do not need wsdl. Statement: Very simple !!!!!! See: http://blog.csdn.net/phphot/archive/2007/07/15/1692109.aspx class files? Php/*** class that implements business logic. This class is

Http://blog.csdn.net/mayongzhan-ma yongzhan, myz, mayongzhan

Server + Client

In the previous article, wsdl is used to write data without wsdl.

Statement: Very simple !!!!!!

Refer to the following:

Http://blog.csdn.net/phphot/archive/2007/07/15/1692109.aspx

Class File

/**

* Class that implements business logic. This class is a common class.

*

*/

Class Basic {

/**

* Returns a string: Hello World!

*

* @ Return string

*/

Public function returnString ($ test ){

Return "Hello World! ". $ Test;

}

}

?>

Server

/**

* The Web Service Server, including class files.

*/

Require_once ("basic. php ");

/**

* Create a Server Object

*/

$ ArrOptions = array ('url' => 'checkapi '); // you can specify a namespace.

$ ObjSoapServer = new SoapServer (null, $ arrOptions );

/**

* Register all methods of the Basic class

*/

$ ObjSoapServer-> setClass ("Basic ");

/**

* Request processing

*/

$ ObjSoapServer-> handle ();

?>

Client

/**

* Client: first, create a Client object.

*/

$ ArrOptions = array ('url' => 'checkapi ', // set the namespace

'Location' => 'HTTP: // localhost/user/soaptest. php', // set the Server address

'Track' => true );

$ ObjSoapClient = new SoapClient (null, $ arrOptions );

/**

* Remote Call

*/

$ Test = 'ok123 ';

Try {

$ StrReturn = $ objSoapClient-> returnString ($ test );

} Catch (Exception $ e ){

}

/**

* Print the result

*/

Echo $ strReturn;

?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.